Skip to content

Commit

Permalink
fix(types): invalid color prop
Browse files Browse the repository at this point in the history
  • Loading branch information
gregberge committed Mar 22, 2021
1 parent 0335114 commit 0660565
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/styled-components/src/createX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,22 @@ type JSXElementKeys = keyof JSX.IntrinsicElements

const tags = Object.keys(styled)

type SafeIntrinsicComponent<T extends keyof JSX.IntrinsicElements> = (
props: Omit<JSX.IntrinsicElements[T], 'color'>,
) => React.ReactElement<any, T>

export const createX = <TProps extends object>(generator: StyleGenerator) => {
type X<TProps extends object> = {
extend<TExtendProps extends object>(
...generators: StyleGenerator[]
): X<TExtendProps>
} & {
[Key in JSXElementKeys]: StyledComponent<Key, DefaultTheme, TProps, never>
[Key in JSXElementKeys]: StyledComponent<
SafeIntrinsicComponent<Key>,
DefaultTheme,
TProps,
'color'
>
}

// @ts-ignore
Expand Down

0 comments on commit 0660565

Please sign in to comment.