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

Minor TS types tweak in @emotion/styled #1951

Merged
merged 1 commit into from
Aug 1, 2020
Merged

Conversation

Andarist
Copy link
Member

Extracted from the closed #1948

@Andarist Andarist requested a review from JakeGinnivan July 30, 2020 21:59
@changeset-bot
Copy link

changeset-bot bot commented Jul 30, 2020

💥 No Changeset

Latest commit: 8f08aa2

Merging this PR will not cause any packages to be released. If these changes should not cause updates to packages in this repo, this is fine 🙂

If these changes should be published to npm, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 30, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 8f08aa2:

Sandbox Source
Emotion Configuration

@@ -105,7 +105,7 @@ export interface CreateStyled {
> = keyof React.ComponentProps<C>
>(
component: C,
options: FilteringStyledOptions<PropsOf<C>, ForwardedProps>
options: FilteringStyledOptions<React.ComponentProps<C>, ForwardedProps>
Copy link
Member Author

Choose a reason for hiding this comment

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

this is not an equivalent, but actually I think the new version is more correct - we don't need to resolve defaultProps here (I don't care as much about resolving propTypes)

the even more correct version would use React.ComponentPropsWithoutRef but that is using conditional type + Exclude and Pick combo, so probably better to avoid it if we can, and the gain from using this over a simpler React.ComponentProps wouldnt be that big

@Andarist Andarist force-pushed the ts/minor-tweak-styled branch from 6e46a19 to 8f08aa2 Compare August 1, 2020 11:23
@@ -432,3 +432,13 @@ const Section = styled('section')`
`
;<StyledWithAs as="section" />
;<StyledWithAs as={Section} />

{
const MemoedComponent = React.memo((_props: { foo: string }) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

this is not relevant for this change, just something I've wanted to check - there were no other types tests involving .memo so I've decided to add this here.

@Andarist Andarist merged commit d083a76 into next Aug 1, 2020
@Andarist Andarist deleted the ts/minor-tweak-styled branch August 1, 2020 11:25
louisgv pushed a commit to louisgv/emotion that referenced this pull request Sep 6, 2020
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