diff --git a/packages/styled/react/src/types.ts b/packages/styled/react/src/types.ts index b7714b179a..1dca91aa93 100644 --- a/packages/styled/react/src/types.ts +++ b/packages/styled/react/src/types.ts @@ -927,23 +927,51 @@ export type UtilityProps< Extract, string> >]?: LastPart extends keyof PropertyTokenType ? PropertyTokenType[LastPart] extends 'sizes' - ? - | WithSizeNegativeValue - | ExtendRNStyle, LastPart> + ? key extends `$web-${string}` + ? WithSizeNegativeValue | (string & {}) + : + | WithSizeNegativeValue + | ExtendRNStyle> : PropertyTokenType[LastPart] extends 'space' - ? - | WithNegativeValue< - StringifyToken< - keyof GSConfig['tokens'][PropertyTokenType[LastPart]] + ? key extends `$web-${string}` + ? + | WithNegativeValue< + StringifyToken< + //@ts-ignore + keyof GSConfig['tokens'][PropertyTokenType[LastPart]] + > + > + | (string & {}) + : + | WithNegativeValue< + StringifyToken< + keyof GSConfig['tokens'][PropertyTokenType[LastPart]] + > + > + | ExtendRNStyle< + GetRNStyles, + LastPart > - > - | ExtendRNStyle, LastPart> : PropertyTokenType[LastPart] extends keyof GSConfig['tokens'] - ? - | StringifyToken< - keyof GSConfig['tokens'][PropertyTokenType[LastPart]] - > - | ExtendRNStyle, LastPart> + ? key extends `$web-${string}` + ? + | (string & {}) + | StringifyToken< + //@ts-ignore + keyof GSConfig['tokens'][PropertyTokenType[LastPart]] + > + | ExtendRNStyle< + GetRNStyles, + LastPart + > + : + | StringifyToken< + keyof GSConfig['tokens'][PropertyTokenType[LastPart]] + > + | ExtendRNStyle< + GetRNStyles, + LastPart + > : LastPart extends keyof GetRNStyles ? GetRNStyles[LastPart] : never @@ -957,21 +985,56 @@ export type UtilityProps< >]?: LastPart extends keyof Aliases ? Aliases[LastPart] extends keyof GetRNStyles ? PropertyTokenType[Aliases[LastPart]] extends 'sizes' - ? - | WithSizeNegativeValue - | ExtendRNStyle< - GetRNStyles, - Aliases[LastPart] - > + ? key extends `$web-${string}` + ? + | (string & {}) + | WithSizeNegativeValue + | ExtendRNStyle< + GetRNStyles, + //@ts-ignore + Aliases[LastPart] + > + : + | WithSizeNegativeValue + | ExtendRNStyle< + GetRNStyles, + Aliases[LastPart] + > : PropertyTokenType[Aliases[LastPart]] extends 'space' - ? - | WithNegativeValue< - StringifyToken< - keyof GSConfig['tokens'][PropertyTokenType[Aliases[LastPart]]] + ? key extends `$web-${string}` + ? + | (string & {}) + | WithNegativeValue< + StringifyToken< + //@ts-ignore + keyof GSConfig['tokens'][PropertyTokenType[Aliases[LastPart]]] + > + > + | ExtendRNStyle< + GetRNStyles, + //@ts-ignore + Aliases[LastPart] > + : + | WithNegativeValue< + StringifyToken< + keyof GSConfig['tokens'][PropertyTokenType[Aliases[LastPart]]] + > + > + | ExtendRNStyle< + GetRNStyles, + Aliases[LastPart] + > + : key extends `$web-${string}` + ? + | (string & {}) + | StringifyToken< + //@ts-ignore + keyof GSConfig['tokens'][PropertyTokenType[Aliases[LastPart]]] > | ExtendRNStyle< GetRNStyles, + //@ts-ignore Aliases[LastPart] > :