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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript support for extended Styled Components #110

Merged
merged 2 commits into from
Jul 22, 2020

Conversation

ben-rogerson
Copy link
Owner

Temporary solution for #38

const Button = tw.button`text-white`

// tw component wrapping is now a-ok in TypeScript
const PinkButton = tw(Button)`bg-black`

Thanks to @A-Shleifman for the code 馃憤

@ben-rogerson ben-rogerson force-pushed the feature/typescript-component-wrapping branch from 9a0a86d to 59f04ef Compare July 20, 2020 11:46
@ben-rogerson ben-rogerson self-assigned this Jul 20, 2020
Copy link

@Vinlock Vinlock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!! 馃憤

@A-Shleifman
Copy link

A-Shleifman commented Jul 21, 2020

Thanks for the library!

We can replace any with Record to satisfy eslint:

type TwComponentWrapper = <T extends ComponentType<Record>>(component: T) => TemplateFn<T>;

@ben-rogerson
Copy link
Owner Author

ben-rogerson commented Jul 21, 2020

We can replace any with Record to satisfy eslint:

I'm seeing some issues with Record:

image

I'll probably roll with any for now, as I'm planning on adding this to an upcoming release.
Perhaps we can look at a more solid solution afterwards.

@ben-rogerson ben-rogerson merged commit 545214a into master Jul 22, 2020
@ben-rogerson ben-rogerson deleted the feature/typescript-component-wrapping branch July 29, 2020 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants