Skip to content

Commit 0660565

Browse files
committed
fix(types): invalid color prop
1 parent 0335114 commit 0660565

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/styled-components/src/createX.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,22 @@ type JSXElementKeys = keyof JSX.IntrinsicElements
66

77
const tags = Object.keys(styled)
88

9+
type SafeIntrinsicComponent<T extends keyof JSX.IntrinsicElements> = (
10+
props: Omit<JSX.IntrinsicElements[T], 'color'>,
11+
) => React.ReactElement<any, T>
12+
913
export const createX = <TProps extends object>(generator: StyleGenerator) => {
1014
type X<TProps extends object> = {
1115
extend<TExtendProps extends object>(
1216
...generators: StyleGenerator[]
1317
): X<TExtendProps>
1418
} & {
15-
[Key in JSXElementKeys]: StyledComponent<Key, DefaultTheme, TProps, never>
19+
[Key in JSXElementKeys]: StyledComponent<
20+
SafeIntrinsicComponent<Key>,
21+
DefaultTheme,
22+
TProps,
23+
'color'
24+
>
1625
}
1726

1827
// @ts-ignore

0 commit comments

Comments
 (0)