Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Commit

Permalink
fix: utility props typings
Browse files Browse the repository at this point in the history
  • Loading branch information
ankit-tailor committed Nov 7, 2023
1 parent 438ca61 commit 341a39a
Showing 1 changed file with 34 additions and 35 deletions.
69 changes: 34 additions & 35 deletions packages/react/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -840,8 +840,7 @@ export type PropsCombinations =
export type UtilityProps<
GenericComponentStyles,
Variants,
GenericComponentProps,
Tokens = GSConfig['tokens']
GenericComponentProps
> = Omit<
TokenizedRNStyleProps<GetRNStyles<GenericComponentStyles>>,
keyof GenericComponentProps
Expand All @@ -851,41 +850,41 @@ export type UtilityProps<
keyof GenericComponentProps
> &
Partial<{
//@ts-ignore
[key in PropsCombinations]?: Aliases[LastPart<key>] extends keyof GetRNStyles<GenericComponentStyles>
? //@ts-ignore
PropertyTokenType[Aliases[LastPart<key>]] extends 'sizes'
?
| WithSizeNegativeValue<Tokens>
//@ts-ignore
| ExtendRNStyle<GenericComponentStyles, Aliases[LastPart<key>]>
: //@ts-ignore
PropertyTokenType[Aliases[LastPart<key>]] extends 'space'
?
| WithNegativeValue<
StringifyToken<
//@ts-expect-error
keyof Tokens[PropertyTokenType[Aliases[LastPart<key>]]]
[key in PropsCombinations]?: LastPart<key> extends keyof Aliases
? Aliases[LastPart<key>] extends keyof GetRNStyles<GenericComponentStyles>
? PropertyTokenType[Aliases[LastPart<key>]] extends 'sizes'
?
| WithSizeNegativeValue<GSConfig['tokens']>
| ExtendRNStyle<GenericComponentStyles, Aliases[LastPart<key>]>
: PropertyTokenType[Aliases[LastPart<key>]] extends 'space'
?
| WithNegativeValue<
StringifyToken<
keyof GSConfig['tokens'][PropertyTokenType[Aliases[LastPart<key>]]]
>
>
| ExtendRNStyle<
GetRNStyles<GenericComponentStyles>,
Aliases[LastPart<key>]
>
:
| StringifyToken<
keyof GSConfig['tokens'][PropertyTokenType[Aliases[LastPart<key>]]]
>
| ExtendRNStyle<
GetRNStyles<GenericComponentStyles>,
Aliases[LastPart<key>]
>
>
| ExtendRNStyle<
GetRNStyles<GenericComponentStyles>,
//@ts-ignore
Aliases[LastPart<key>]
>
:
| StringifyToken<
//@ts-ignore
keyof Tokens[PropertyTokenType[Aliases[LastPart<key>]]]
>
| ExtendRNStyle<
GetRNStyles<GenericComponentStyles>,
//@ts-ignore
Aliases[LastPart<key>]
>
: never;
: never
: any;
}> &
VerbosedUtilityProps<GenericComponentStyles, Variants, GenericComponentProps>;
Partial<
VerbosedUtilityProps<
GenericComponentStyles,
Variants,
GenericComponentProps
>
>;
// &
// Partial<{
// [key in `$${IState | PLATFORMS | IMediaQueries}-${string}`]?: any;
Expand Down

0 comments on commit 341a39a

Please sign in to comment.