-
-
Notifications
You must be signed in to change notification settings - Fork 32.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
[types] Moved types from OverridableComponent.d.ts to @material-ui/types #23265
[types] Moved types from OverridableComponent.d.ts to @material-ui/types #23265
Conversation
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.
We need to fork at some point in the chain of used types started from OverrideProps
since that type is coupled with @material-ui/styles
. StyledComponentProps
or ClassNameMap
should not be part of @material-ui/types
.
|
Or we could exclude the |
@eps1lon can you check now? |
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.
From what I understand, the purpose of @material-ui/types
is to host type utilities that are shared between different packages. Two questions:
- Why create a distinction between JavaScript logic and TypeScript only logic. Would it make sense to merge
@material-ui/types
inside@material-ui/utils
? (keeping them both for private usage) - It seems that these types don't need to be shared. Would it be simpler to host them in
@material-ui/unstyled
and havecore
import them fromunstyled
?
/** | ||
* @deprecated Not used in this library. | ||
*/ | ||
export type Simplify<T> = T extends any ? { [K in keyof T]: T[K] } : never; | ||
|
||
/** | ||
* @deprecated Not used in this library. | ||
*/ | ||
// tslint:disable-next-line: deprecation | ||
export type SimplifiedPropsOf<C extends React.ElementType> = Simplify<React.ComponentProps<C>>; |
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.
Should we remove it?
/** | |
* @deprecated Not used in this library. | |
*/ | |
export type Simplify<T> = T extends any ? { [K in keyof T]: T[K] } : never; | |
/** | |
* @deprecated Not used in this library. | |
*/ | |
// tslint:disable-next-line: deprecation | |
export type SimplifiedPropsOf<C extends React.ElementType> = Simplify<React.ComponentProps<C>>; |
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.
Yes, please!
One has zero runtime cost the other doesn't. We don't create the distinction but reflect it. But I'm fine with unifiying them so that we have less stuff to maintain. Though we should really just move
That sounds more reasonable. |
So is the best way to start moving to the If that's what we want I will close this and #23264 and start with just creating the @eps1lon @oliviertassinari do we agree with this? |
@mnajdova Sound fair. I'm not sure that we need to give up on the two existing pull requests. |
Let's open that one and we'll see if it can be broken down to more PRs |
Another PR that prepares unnecessary changes for introducing the
@material-ui/unstyled
package. It moves the typings from@material-ui/core/OverridableComponent
to@material-ui/types
so that those can be reused in the new package. All previous typings from@material-ui/core/OverridableComponent
are now just re-exported from@material-ui/types