Socket
Socket
Sign inDemoInstall

@types/styled-components

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/styled-components - npm Package Compare versions

Comparing version 5.1.26 to 5.1.29

6

styled-components/cssprop.d.ts

@@ -1,5 +0,5 @@

import {} from 'react';
import { CSSProp } from '.';
import {} from "react";
import { CSSProp } from ".";
declare module 'react' {
declare module "react" {
interface Attributes {

@@ -6,0 +6,0 @@ // NOTE: unlike the plain javascript version, it is not possible to get access

@@ -1,13 +0,1 @@

// Type definitions for styled-components 5.1
// Project: https://github.com/styled-components/styled-components, https://styled-components.com
// Definitions by: Igor Oleinikov <https://github.com/Igorbek>
// Ihor Chulinda <https://github.com/Igmat>
// Jessica Franco <https://github.com/Jessidhia>
// Jason Killian <https://github.com/jkillian>
// Sebastian Silbermann <https://github.com/eps1lon>
// Matthew Wagerfield <https://github.com/wagerfield>
// Yuki Ito <https://github.com/Lazyuki>
// Aaron Reisman <https://github.com/lifeiscontent>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// forward declarations

@@ -23,5 +11,5 @@ declare global {

import * as CSS from 'csstype';
import * as React from 'react';
import * as hoistNonReactStatics from 'hoist-non-react-statics';
import * as CSS from "csstype";
import * as hoistNonReactStatics from "hoist-non-react-statics";
import * as React from "react";

@@ -50,8 +38,7 @@ export type CSSProperties = CSS.Properties<string | number>;

// Wrap in an outer-level conditional type to allow distribution over props that are unions
type Defaultize<P, D> = P extends any
? string extends keyof P
? P
: PickU<P, Exclude<keyof P, keyof D>> &
Partial<PickU<P, Extract<keyof P, keyof D>>> &
Partial<PickU<D, Exclude<keyof D, keyof P>>>
type Defaultize<P, D> = P extends any ? string extends keyof P ? P
:
& PickU<P, Exclude<keyof P, keyof D>>
& Partial<PickU<P, Extract<keyof P, keyof D>>>
& Partial<PickU<D, Exclude<keyof D, keyof P>>>
: never;

@@ -80,10 +67,9 @@

// The Component passed with "forwardedAs" prop
FAsC extends string | React.ComponentType<any> = C
FAsC extends string | React.ComponentType<any> = C,
> =
// Distribute O if O is a union type
O extends object
? WithOptionalTheme<
MakeAttrsOptional<C, O, A> & MakeAttrsOptional<FAsC, O, A>,
T
>
O extends object ? WithOptionalTheme<
MakeAttrsOptional<C, O, A> & MakeAttrsOptional<FAsC, O, A>,
T
>
: never;

@@ -97,3 +83,3 @@

AsC extends string | React.ComponentType<any> = C,
FAsC extends string | React.ComponentType<any> = C
FAsC extends string | React.ComponentType<any> = C,
> = StyledComponentProps<C, T, O, A, FAsC> & { as?: AsC | undefined; forwardedAs?: FAsC | undefined };

@@ -118,3 +104,5 @@

export interface GlobalStyleComponent<P extends { theme?: T | undefined }, T> extends React.ComponentClass<ThemedGlobalStyledClassProps<P, T>> {}
export interface GlobalStyleComponent<P extends { theme?: T | undefined }, T>
extends React.ComponentClass<ThemedGlobalStyledClassProps<P, T>>
{}

@@ -147,8 +135,8 @@ // remove the call signature from StyledComponent so Interpolation can still infer InterpolationFunction

O extends object = {},
A extends keyof any = never
A extends keyof any = never,
> = // the "string" allows this to be used as an object key
// I really want to avoid this if possible but it's the only way to use nesting with object styles...
string &
StyledComponentBase<C, T, O, A> &
hoistNonReactStatics.NonReactStatics<C extends React.ComponentType<any> ? C : never>;
& string
& StyledComponentBase<C, T, O, A>
& hoistNonReactStatics.NonReactStatics<C extends React.ComponentType<any> ? C : never>;

@@ -159,6 +147,8 @@ export interface StyledComponentBase<

O extends object = {},
A extends keyof any = never
A extends keyof any = never,
> extends ForwardRefExoticBase<StyledComponentProps<C, T, O, A>> {
// add our own fake call signature to implement the polymorphic 'as' prop
(props: StyledComponentProps<C, T, O, A> & { as?: never | undefined; forwardedAs?: never | undefined }): React.ReactElement<
(
props: StyledComponentProps<C, T, O, A> & { as?: never | undefined; forwardedAs?: never | undefined },
): React.ReactElement<
StyledComponentProps<C, T, O, A>

@@ -187,3 +177,3 @@ >;

O extends object = {},
A extends keyof any = never
A extends keyof any = never,
> {

@@ -211,3 +201,3 @@ (first: TemplateStringsArray): StyledComponent<C, T, O, A>;

O extends object = {},
A extends keyof any = never
A extends keyof any = never,
> extends ThemedStyledFunctionBase<C, T, O, A> {

@@ -220,3 +210,3 @@ // Fun thing: 'attrs' can also provide a polymorphic 'as' prop

[others: string]: any;
} = {}
} = {},
>(

@@ -245,11 +235,8 @@ attrs: Attrs<StyledComponentPropsWithRef<C> & U, NewA, T>,

any
>
? I
: C extends StyledComponent<infer I, any, any>
? I
> ? I
: C extends StyledComponent<infer I, any, any> ? I
: C;
export type StyledComponentPropsWithRef<
C extends keyof JSX.IntrinsicElements | React.ComponentType<any>
> = C extends AnyStyledComponent
? React.ComponentPropsWithRef<StyledComponentInnerComponent<C>>
C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,
> = C extends AnyStyledComponent ? React.ComponentPropsWithRef<StyledComponentInnerComponent<C>>
: React.ComponentPropsWithRef<C>;

@@ -261,6 +248,4 @@ export type StyledComponentInnerOtherProps<C extends AnyStyledComponent> = C extends StyledComponent<

any
>
? O
: C extends StyledComponent<any, any, infer O>
? O
> ? O
: C extends StyledComponent<any, any, infer O> ? O
: never;

@@ -304,5 +289,5 @@ export type StyledComponentInnerAttrs<C extends AnyStyledComponent> = C extends StyledComponent<any, any, any, infer A>

// Pick that distributes over union types
export type PickU<T, K extends keyof T> = T extends any ? {[P in K]: T[P]} : never;
export type PickU<T, K extends keyof T> = T extends any ? { [P in K]: T[P] } : never;
export type OmitU<T, K extends keyof T> = T extends any ? PickU<T, Exclude<keyof T, K>> : never;
type WithOptionalTheme<P extends { theme?: T | undefined }, T> = OmitU<P, 'theme'> & {
type WithOptionalTheme<P extends { theme?: T | undefined }, T> = OmitU<P, "theme"> & {
theme?: T | undefined;

@@ -346,3 +331,5 @@ };

component: React.ComponentProps<C> extends { theme?: T | undefined } ? C : never,
) => React.ForwardRefExoticComponent<WithOptionalTheme<JSX.LibraryManagedAttributes<C, React.ComponentPropsWithRef<C>>, T>>;
) => React.ForwardRefExoticComponent<
WithOptionalTheme<JSX.LibraryManagedAttributes<C, React.ComponentPropsWithRef<C>>, T>
>;
export type WithThemeFnInterface<T extends object> = BaseWithThemeFnInterface<AnyIfEmpty<T>>;

@@ -376,3 +363,3 @@ export const withTheme: WithThemeFnInterface<DefaultTheme>;

export const ThemeContext: React.Context<AnyIfEmpty<DefaultTheme>>;
export const ThemeConsumer: typeof ThemeContext['Consumer'];
export const ThemeConsumer: typeof ThemeContext["Consumer"];

@@ -403,2 +390,3 @@ export interface Keyframes {

seal(): void;
clearTag(): void;
}

@@ -405,0 +393,0 @@

@@ -1,3 +0,3 @@

export { default } from '.';
export * from '.';
export { default } from ".";
export * from ".";

@@ -4,0 +4,0 @@ /**

{
"name": "@types/styled-components",
"version": "5.1.26",
"version": "5.1.29",
"description": "TypeScript definitions for styled-components",

@@ -10,39 +10,44 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/styled-components",

"name": "Igor Oleinikov",
"url": "https://github.com/Igorbek",
"githubUsername": "Igorbek"
"githubUsername": "Igorbek",
"url": "https://github.com/Igorbek"
},
{
"name": "Ihor Chulinda",
"url": "https://github.com/Igmat",
"githubUsername": "Igmat"
"githubUsername": "Igmat",
"url": "https://github.com/Igmat"
},
{
"name": "Jessica Franco",
"url": "https://github.com/Jessidhia",
"githubUsername": "Jessidhia"
"githubUsername": "Jessidhia",
"url": "https://github.com/Jessidhia"
},
{
"name": "Jason Killian",
"url": "https://github.com/jkillian",
"githubUsername": "jkillian"
"githubUsername": "jkillian",
"url": "https://github.com/jkillian"
},
{
"name": "Sebastian Silbermann",
"url": "https://github.com/eps1lon",
"githubUsername": "eps1lon"
"githubUsername": "eps1lon",
"url": "https://github.com/eps1lon"
},
{
"name": "Matthew Wagerfield",
"url": "https://github.com/wagerfield",
"githubUsername": "wagerfield"
"githubUsername": "wagerfield",
"url": "https://github.com/wagerfield"
},
{
"name": "Yuki Ito",
"url": "https://github.com/Lazyuki",
"githubUsername": "Lazyuki"
"githubUsername": "Lazyuki",
"url": "https://github.com/Lazyuki"
},
{
"name": "Aaron Reisman",
"url": "https://github.com/lifeiscontent",
"githubUsername": "lifeiscontent"
"githubUsername": "lifeiscontent",
"url": "https://github.com/lifeiscontent"
},
{
"name": "Aaron Rose",
"githubUsername": "acdr",
"url": "https://github.com/acdr"
}

@@ -63,4 +68,4 @@ ],

},
"typesPublisherContentHash": "c277cf04cb1cb2a61c61038d2821b4ae55e724f8e5aa1846850201d8de4c4916",
"typeScriptVersion": "4.0"
"typesPublisherContentHash": "bb22ef310a68a1fbc28911238312a26af34a6aef0200e0f2071e0ba5719483be",
"typeScriptVersion": "4.5"
}

@@ -11,7 +11,6 @@ # Installation

### Additional Details
* Last updated: Wed, 10 Aug 2022 19:32:16 GMT
* Dependencies: [@types/csstype](https://npmjs.com/package/@types/csstype), [@types/react](https://npmjs.com/package/@types/react), [@types/hoist-non-react-statics](https://npmjs.com/package/@types/hoist-non-react-statics)
* Global values: none
* Last updated: Wed, 18 Oct 2023 18:04:04 GMT
* Dependencies: [@types/hoist-non-react-statics](https://npmjs.com/package/@types/hoist-non-react-statics), [@types/react](https://npmjs.com/package/@types/react), [csstype](https://npmjs.com/package/csstype)
# Credits
These definitions were written by [Igor Oleinikov](https://github.com/Igorbek), [Ihor Chulinda](https://github.com/Igmat), [Jessica Franco](https://github.com/Jessidhia), [Jason Killian](https://github.com/jkillian), [Sebastian Silbermann](https://github.com/eps1lon), [Matthew Wagerfield](https://github.com/wagerfield), [Yuki Ito](https://github.com/Lazyuki), and [Aaron Reisman](https://github.com/lifeiscontent).
These definitions were written by [Igor Oleinikov](https://github.com/Igorbek), [Ihor Chulinda](https://github.com/Igmat), [Jessica Franco](https://github.com/Jessidhia), [Jason Killian](https://github.com/jkillian), [Sebastian Silbermann](https://github.com/eps1lon), [Matthew Wagerfield](https://github.com/wagerfield), [Yuki Ito](https://github.com/Lazyuki), [Aaron Reisman](https://github.com/lifeiscontent), and [Aaron Rose](https://github.com/acdr).

@@ -1,2 +0,2 @@

import type { StyledComponent } from './index';
import type { StyledComponent } from "./index";

@@ -7,2 +7,5 @@ export function find(element: HTMLElement, styledComponent: StyledComponent<any, any, any, any>): HTMLElement | null;

export function enzymeFind<Wrapper extends { find: (selector: string) => any }>(wrapper: Wrapper, styledComponent: StyledComponent<any, any, any, any>): Wrapper;
export function enzymeFind<Wrapper extends { find: (selector: string) => any }>(
wrapper: Wrapper,
styledComponent: StyledComponent<any, any, any, any>,
): Wrapper;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc