File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
tests/cases/conformance/types/typeRelationships/typeInference Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -54,3 +54,37 @@ let y1 = foo1(sx); // string
54
54
55
55
let x2 = foo2 ( sa ) ; // unknown
56
56
let y2 = foo2 ( sx ) ; // { extra: number }
57
+
58
+ // Repro from #33490
59
+
60
+ declare class Component < P > { props : P }
61
+
62
+ export type ComponentClass < P > = new ( props : P ) => Component < P > ;
63
+ export type FunctionComponent < P > = ( props : P ) => null ;
64
+
65
+ export type ComponentType < P > = FunctionComponent < P > | ComponentClass < P > ;
66
+
67
+ export interface RouteComponentProps { route : string }
68
+
69
+ declare function withRouter <
70
+ P extends RouteComponentProps ,
71
+ C extends ComponentType < P >
72
+ > (
73
+ component : C & ComponentType < P >
74
+ ) : ComponentClass < Omit < P , keyof RouteComponentProps > > ;
75
+
76
+ interface Props extends RouteComponentProps { username : string }
77
+
78
+ declare const MyComponent : ComponentType < Props > ;
79
+
80
+ withRouter ( MyComponent ) ;
81
+
82
+ // Repro from #33490
83
+
84
+ type AB < T > = { a : T } | { b : T } ;
85
+
86
+ // T & AB<U> normalizes to T & { a: U } | T & { b: U } below
87
+ declare function foo < T , U > ( obj : T & AB < U > ) : [ T , U ] ;
88
+ declare let ab : AB < string > ;
89
+
90
+ let z = foo ( ab ) ; // [AB<string>, string]
You can’t perform that action at this time.
0 commit comments