ben-rogerson / twin.macro

🦹‍♂️ Twin blends the magic of Tailwind with the flexibility of css-in-js (emotion, styled-components, solid-styled-components, stitches and goober) at build time.
MIT License
7.89k stars 184 forks source link

Property 'cs' is missing in type.... #839

Open OnkelTem opened 9 months ago

OnkelTem commented 9 months ago

For some time now we've been getting this error:

Property 'cs' is missing in type '{ children: (ReactNode | Element)[]; ref: RefObject<HTMLDivElement> | null | undefined; css: any; }' but required in type 'Pick<ModalWindowProps, keyof MotionProps | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | ... 248 more ... | "cs">'.ts(2741)

I think it may be related to the update of @types/react which is now 18.2.38.

I didn't have time to investigate it.

twin.macro version: 3.4.0.

ben-rogerson commented 9 months ago

Hey there

I haven't heard if this error popping up before, my guess is that it's related to the cs type defined here. The cs prop is an alternative spot to add twins "short css" classes (instead of alongside tw classes), this feature was added before tailwind released their own version of the feature so it's due for removal in a future version of twin.

As for a fix, perhaps you could try overriding the type in one of your own myProject.d.ts files:

declare module 'react' {
  interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> {
    cs?: never
  }
}
OnkelTem commented 9 months ago

@ben-rogerson Thanks, I'll try it!