Skip to content

Commit

Permalink
[core] Simplify types of styled (#19243)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon authored Jan 15, 2020
1 parent 341d0f3 commit cdb956c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions packages/material-ui-styles/src/styled/styled.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Omit, IsAny, CoerceEmptyInterface } from '@material-ui/types';
import { Omit } from '@material-ui/types';
import {
CreateCSSProperties,
StyledComponentProps,
Expand All @@ -12,20 +12,20 @@ import { DefaultTheme } from '../defaultTheme';
*/
export type ComponentCreator<Component extends React.ElementType> = <
Theme = DefaultTheme,
Props extends {} = any
Props extends {} = {}
>(
styles:
| CreateCSSProperties<Props>
| ((props: { theme: Theme } & CoerceEmptyInterface<Props>) => CreateCSSProperties<Props>),
| ((props: { theme: Theme } & Props) => CreateCSSProperties<Props>),
options?: WithStylesOptions<Theme>,
) => React.ComponentType<
Omit<
JSX.LibraryManagedAttributes<Component, React.ComponentProps<Component>>,
'classes' | 'className'
> &
StyledComponentProps<'root'> & { className?: string } & CoerceEmptyInterface<
Props extends { theme: Theme } ? Omit<Props, 'theme'> & { theme?: Theme } : Props
>
StyledComponentProps<'root'> & { className?: string } & (Props extends { theme: Theme }
? Omit<Props, 'theme'> & { theme?: Theme }
: Props)
>;

export interface StyledProps {
Expand Down
12 changes: 6 additions & 6 deletions packages/material-ui/src/styles/styled.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Omit, IsAny, CoerceEmptyInterface } from '@material-ui/types';
import { Omit } from '@material-ui/types';
import {
CreateCSSProperties,
StyledComponentProps,
Expand All @@ -16,20 +16,20 @@ import * as React from 'react';
*/
export type ComponentCreator<Component extends React.ElementType> = <
Theme = DefaultTheme,
Props extends {} = any
Props extends {} = {}
>(
styles:
| CreateCSSProperties<Props>
| ((props: { theme: Theme } & CoerceEmptyInterface<Props>) => CreateCSSProperties<Props>),
| ((props: { theme: Theme } & Props) => CreateCSSProperties<Props>),
options?: WithStylesOptions<Theme>,
) => React.ComponentType<
Omit<
JSX.LibraryManagedAttributes<Component, React.ComponentProps<Component>>,
'classes' | 'className'
> &
StyledComponentProps<'root'> & { className?: string } & CoerceEmptyInterface<
Props extends { theme: Theme } ? Omit<Props, 'theme'> & { theme?: Theme } : Props
>
StyledComponentProps<'root'> & { className?: string } & (Props extends { theme: Theme }
? Omit<Props, 'theme'> & { theme?: Theme }
: Props)
>;

export interface StyledProps {
Expand Down

0 comments on commit cdb956c

Please sign in to comment.