Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/material-ui/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export { StyledComponentProps };
* certain `classes`, on which one can also set a top-level `className` and inline
* `style`.
*/
export type StandardProps<C, ClassKey extends string, Removals extends keyof C = never> = Omit<
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why not just redefine Omit to allow using any valid key type?

export type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes. It is better. Thank you! 👍

export type StandardProps<C, ClassKey extends string, Removals extends Extract<keyof C, string> = never> = Omit<
C,
'classes' | Removals
> &
Expand Down Expand Up @@ -54,7 +54,7 @@ export type ConsistentWith<T, U> = Pick<U, keyof T & keyof U>;
*
* @internal
*/
export type Overwrite<T, U> = (U extends ConsistentWith<U, T> ? T : Omit<T, keyof U>) & U;
export type Overwrite<T, U> = (U extends ConsistentWith<U, T> ? T : Omit<T, Extract<keyof U, string>>) & U;

export namespace PropTypes {
type Alignment = 'inherit' | 'left' | 'center' | 'right' | 'justify';
Expand Down