variant-classnames icon indicating copy to clipboard operation
variant-classnames copied to clipboard

"VariantsOf" type incompatibility

Open mertturkmenoglu opened this issue 2 years ago • 3 comments

Hi everyone,

I'm just trying this library and I'm looking at the TypeScript support.

When I try the example here https://github.com/mattvalleycodes/variant-classnames#nested-properties-auto-complete, TypeScript gives me an error:

TS2345: Argument of type 'VariantsOf<Props, $Hooks1<OmitType<Required<Props>, Function>>>' is not assignable to parameter of type 'RootVariations'.   Type 'VariantsOf<Props, $Hooks1<OmitType<Required<Props>, Function>>>' is not assignable to type '{ $forward?: MaybeString; }'.     Types of property '$forward' are incompatible.       Type 'string | { [x: string]: string | VariantsOf<$Hooks1<Omit<$Hooks1<OmitType<Required<Props>, Function>>, "$forward">>, $Hooks1<...>> | undefined; } | undefined' is not assignable to type 'MaybeString'.         Type '{ [x: string]: string | VariantsOf<$Hooks1<Omit<$Hooks1<OmitType<Required<Props>, Function>>, "$forward">>, $Hooks1<OmitType<Required<$Hooks1<Omit<$Hooks1<...>, "$forward">>>, Function>>> | undefined; }' is not assignable to type 'MaybeString'.

Library versions:

  • variant-classnames: ^1.2.0
  • react: 18.2.0
  • typescript: 4.8.2

Can you help me with this issue?

Thank you.

mertturkmenoglu avatar Nov 13 '22 19:11 mertturkmenoglu

@mertturkmenoglu Hi there; we're aware of this and will work on this to fix it. For the time being, I would recommend to use // @ts-ignore

cc @jhesgodi

mattvalleycodes avatar Nov 15 '22 03:11 mattvalleycodes

Thank you @mattvalleycodes. Appreciate it.

mertturkmenoglu avatar Nov 15 '22 07:11 mertturkmenoglu

Hey, neat little library. Any update on this issue?

dev-frid avatar Apr 04 '23 08:04 dev-frid