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

Add other missing types #4127

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

takurinton
Copy link
Contributor

refs #4062 #4117 #4126

Add more missing types in addition to #4126.

I added some of them.

  • FlattenInterpolation
  • FlattenSimpleInterpolation
  • InterpolationFunction
  • SimpleInterpolation
  • StyledComponentBase

I also added the types they depend on.

referenced here https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/styled-components/index.d.ts

@takurinton takurinton marked this pull request as ready for review August 10, 2023 23:22
@takurinton takurinton marked this pull request as draft August 10, 2023 23:57
@takurinton takurinton marked this pull request as ready for review August 11, 2023 00:02
// 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<
Copy link
Contributor

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

Copy link
Contributor Author

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>;
Copy link
Contributor

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.

Copy link
Contributor Author

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!!

@takurinton takurinton marked this pull request as draft August 19, 2023 04:17
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.

None yet

3 participants