-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[typescript] Style typing improvements (#12492)
* Make Omit work with unions * Use React.ComponentType instead of React.ComponentClass * Rename WithWidthProps to WithWidth for consistency with WithTheme and WithStyles * Add AnyComponent and WithProps helpers to eliminate need for type annotation * Get the typing right when passing withTheme: true * Remove caveat about union props from the docs * Tweak variable names * Formatting
- Loading branch information
Showing
10 changed files
with
65 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { Theme } from './createMuiTheme'; | ||
import { ConsistentWith } from '..'; | ||
import { AnyComponent, ConsistentWith, Overwrite } from '..'; | ||
|
||
export interface WithTheme { | ||
theme: Theme; | ||
innerRef?: React.Ref<any> | React.RefObject<any>; | ||
} | ||
|
||
declare const withTheme: () => <P extends ConsistentWith<P, WithTheme>>( | ||
component: React.ComponentType<P & WithTheme>, | ||
) => React.ComponentClass<P>; | ||
component: AnyComponent<P & WithTheme>, | ||
) => React.ComponentType<Overwrite<P, Partial<WithTheme>>>; | ||
|
||
export default withTheme; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters