Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
OnkelTem opened this issue Nov 22, 2023 · 2 comments
Open

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

OnkelTem opened this issue Nov 22, 2023 · 2 comments

Comments

@OnkelTem
Copy link

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
Copy link
Owner

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants