-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add other missing types #4127
base: main
Are you sure you want to change the base?
Add other missing types #4127
Conversation
// Distribute unions early to avoid quadratic expansion | ||
P extends any ? OmitU<ReactDefaultizedProps<C, P> & O, A> & Partial<PickU<P & O, A>> : never; | ||
|
||
export type StyledComponentProps< |
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 a bit overwhelming to add to the list of things to maintain
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.
I think so too (I thought it was difficult when I wrote it)
I'm having a hard time deciding how to maintain this complicated type definition, or considering alternatives, so I'd like some advice.
what do you think you should do
| InterpolationFunction<Props> | ||
| FlattenInterpolation<Props>; | ||
|
||
export type InterpolationFunction<P extends object> = (props: P) => Interpolation<P>; |
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.
InterpolationFunction
and other types here looks like they come from the Definitely Typed definitions for v5.
InterpolationFunction
from v5 can be replaced with StyleFunction
from v6.
Maybe we can either write a migration guide from v5 to v6, or consider just aliasing some of the types that are 1 to 1 replacements?
I don't think we should copy all of the types over from Definitely Typed because there are new, similar types defined in v6. It might get really confusing to maintain two very similar copies of the same type but with different names.
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.
Oh, sorry, and thank you!!
I didn't realize the new types were defined because I only referred to the migration guide to define the types.
consider just aliasing some of the types that are 1 to 1 replacements?
For now, I'll try aliasing some of the types that are 1 to 1 replacements. thank you!!
refs #4062 #4117 #4126
Add more missing types in addition to #4126.
I added some of them.
I also added the types they depend on.
referenced here https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/styled-components/index.d.ts