-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Conversation
💥 No ChangesetLatest 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 changesetsWhen 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 |
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:
|
@@ -105,7 +105,7 @@ export interface CreateStyled { | |||
> = keyof React.ComponentProps<C> | |||
>( | |||
component: C, | |||
options: FilteringStyledOptions<PropsOf<C>, ForwardedProps> | |||
options: FilteringStyledOptions<React.ComponentProps<C>, ForwardedProps> |
There was a problem hiding this comment.
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
6e46a19
to
8f08aa2
Compare
@@ -432,3 +432,13 @@ const Section = styled('section')` | |||
` | |||
;<StyledWithAs as="section" /> | |||
;<StyledWithAs as={Section} /> | |||
|
|||
{ | |||
const MemoedComponent = React.memo((_props: { foo: string }) => { |
There was a problem hiding this comment.
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.
Extracted from the closed #1948