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

fix for typescript error on strict builds #100

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jblossomweb
Copy link

@jblossomweb jblossomweb commented Oct 22, 2023

Hello!

I was using tailwind-styled-components in another project, and when I ran my build, it was getting caught on a Typescript error coming from this package:

> tsc && vite build

node_modules/tailwind-styled-components/dist/tailwind.d.ts:27:81 - error TS2344: Type 'P' does not satisfy the constraint '{}'.

27 declare type TailwindPropHelper<P, O extends object = {}> = PickU<MergeProps<O, P>, keyof MergeProps<O, P>>;
                                                                                   ~

  node_modules/tailwind-styled-components/dist/tailwind.d.ts:27:33
    27 declare type TailwindPropHelper<P, O extends object = {}> = PickU<MergeProps<O, P>, keyof MergeProps<O, P>>;
                                       ~
    This type parameter might need an `extends {}` constraint.

node_modules/tailwind-styled-components/dist/tailwind.d.ts:27:105 - error TS2344: Type 'P' does not satisfy the constraint '{}'.

27 declare type TailwindPropHelper<P, O extends object = {}> = PickU<MergeProps<O, P>, keyof MergeProps<O, P>>;
                                                                                                           ~

  node_modules/tailwind-styled-components/dist/tailwind.d.ts:27:33
    27 declare type TailwindPropHelper<P, O extends object = {}> = PickU<MergeProps<O, P>, keyof MergeProps<O, P>>;
                                       ~
    This type parameter might need an `extends {}` constraint.


Found 2 errors in the same file, starting at: node_modules/tailwind-styled-components/dist/tailwind.d.ts:27

So I figured I would submit a fix, based on Typescript's suggestion.
This extends object for an input type in 2 places, similarly to adjacent input types.

All tests pass, and the package builds. Happy to respond to any questions!
Let me know if/when this can be bundled into the next version, as I'll be maintaining a fork for my project in the meantime.

Thank you!

jblossomweb added a commit to jblossomweb/miradx-demo that referenced this pull request Oct 22, 2023
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

Successfully merging this pull request may close these issues.

1 participant