mirror of
https://github.com/chenasraf/DefinitelyTyped.git
synced 2026-05-18 01:49:01 +00:00
StyledComponent: More accurate component constraint (#50046)
This change makes styled-components pass compilation on Typescript 4.2, which correctly propagates type parameter constraints through certain complex conditional types. Old versions of typescript just dropped the constraint by mistake, so this inconsistency was just not checked before. I'm not certain this is the right solution; in particular, it may be a lot slower. I hope not, because I have no idea what the right fix is otherwise!
This commit is contained in:
committed by
GitHub
parent
ba94778eba
commit
5af8fdf215
2
types/styled-components/index.d.ts
vendored
2
types/styled-components/index.d.ts
vendored
@@ -158,7 +158,7 @@ export type AnyStyledComponent =
|
||||
| StyledComponent<any, any, any>;
|
||||
|
||||
export type StyledComponent<
|
||||
C extends string | React.ComponentType<any>,
|
||||
C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,
|
||||
T extends object,
|
||||
O extends object = {},
|
||||
A extends keyof any = never
|
||||
|
||||
Reference in New Issue
Block a user