@@ -205,3 +205,107 @@ let y2 = foo2(sx); // { extra: number }
205205>foo2 : Symbol(foo2, Decl(unionAndIntersectionInference3.ts, 42, 57))
206206>sx : Symbol(sx, Decl(unionAndIntersectionInference3.ts, 46, 11))
207207
208+ // Repro from #33490
209+
210+ declare class Component<P> { props: P }
211+ >Component : Symbol(Component, Decl(unionAndIntersectionInference3.ts, 52, 18))
212+ >P : Symbol(P, Decl(unionAndIntersectionInference3.ts, 56, 24))
213+ >props : Symbol(Component.props, Decl(unionAndIntersectionInference3.ts, 56, 28))
214+ >P : Symbol(P, Decl(unionAndIntersectionInference3.ts, 56, 24))
215+
216+ export type ComponentClass<P> = new (props: P) => Component<P>;
217+ >ComponentClass : Symbol(ComponentClass, Decl(unionAndIntersectionInference3.ts, 56, 39))
218+ >P : Symbol(P, Decl(unionAndIntersectionInference3.ts, 58, 27))
219+ >props : Symbol(props, Decl(unionAndIntersectionInference3.ts, 58, 37))
220+ >P : Symbol(P, Decl(unionAndIntersectionInference3.ts, 58, 27))
221+ >Component : Symbol(Component, Decl(unionAndIntersectionInference3.ts, 52, 18))
222+ >P : Symbol(P, Decl(unionAndIntersectionInference3.ts, 58, 27))
223+
224+ export type FunctionComponent<P> = (props: P) => null;
225+ >FunctionComponent : Symbol(FunctionComponent, Decl(unionAndIntersectionInference3.ts, 58, 63))
226+ >P : Symbol(P, Decl(unionAndIntersectionInference3.ts, 59, 30))
227+ >props : Symbol(props, Decl(unionAndIntersectionInference3.ts, 59, 36))
228+ >P : Symbol(P, Decl(unionAndIntersectionInference3.ts, 59, 30))
229+
230+ export type ComponentType<P> = FunctionComponent<P> | ComponentClass<P>;
231+ >ComponentType : Symbol(ComponentType, Decl(unionAndIntersectionInference3.ts, 59, 54))
232+ >P : Symbol(P, Decl(unionAndIntersectionInference3.ts, 61, 26))
233+ >FunctionComponent : Symbol(FunctionComponent, Decl(unionAndIntersectionInference3.ts, 58, 63))
234+ >P : Symbol(P, Decl(unionAndIntersectionInference3.ts, 61, 26))
235+ >ComponentClass : Symbol(ComponentClass, Decl(unionAndIntersectionInference3.ts, 56, 39))
236+ >P : Symbol(P, Decl(unionAndIntersectionInference3.ts, 61, 26))
237+
238+ export interface RouteComponentProps { route: string }
239+ >RouteComponentProps : Symbol(RouteComponentProps, Decl(unionAndIntersectionInference3.ts, 61, 72))
240+ >route : Symbol(RouteComponentProps.route, Decl(unionAndIntersectionInference3.ts, 63, 38))
241+
242+ declare function withRouter<
243+ >withRouter : Symbol(withRouter, Decl(unionAndIntersectionInference3.ts, 63, 54))
244+
245+ P extends RouteComponentProps,
246+ >P : Symbol(P, Decl(unionAndIntersectionInference3.ts, 65, 28))
247+ >RouteComponentProps : Symbol(RouteComponentProps, Decl(unionAndIntersectionInference3.ts, 61, 72))
248+
249+ C extends ComponentType<P>
250+ >C : Symbol(C, Decl(unionAndIntersectionInference3.ts, 66, 32))
251+ >ComponentType : Symbol(ComponentType, Decl(unionAndIntersectionInference3.ts, 59, 54))
252+ >P : Symbol(P, Decl(unionAndIntersectionInference3.ts, 65, 28))
253+
254+ >(
255+ component: C & ComponentType<P>
256+ >component : Symbol(component, Decl(unionAndIntersectionInference3.ts, 68, 2))
257+ >C : Symbol(C, Decl(unionAndIntersectionInference3.ts, 66, 32))
258+ >ComponentType : Symbol(ComponentType, Decl(unionAndIntersectionInference3.ts, 59, 54))
259+ >P : Symbol(P, Decl(unionAndIntersectionInference3.ts, 65, 28))
260+
261+ ): ComponentClass<Omit<P, keyof RouteComponentProps>>;
262+ >ComponentClass : Symbol(ComponentClass, Decl(unionAndIntersectionInference3.ts, 56, 39))
263+ >Omit : Symbol(Omit, Decl(lib.es5.d.ts, --, --))
264+ >P : Symbol(P, Decl(unionAndIntersectionInference3.ts, 65, 28))
265+ >RouteComponentProps : Symbol(RouteComponentProps, Decl(unionAndIntersectionInference3.ts, 61, 72))
266+
267+ interface Props extends RouteComponentProps { username: string }
268+ >Props : Symbol(Props, Decl(unionAndIntersectionInference3.ts, 70, 54))
269+ >RouteComponentProps : Symbol(RouteComponentProps, Decl(unionAndIntersectionInference3.ts, 61, 72))
270+ >username : Symbol(Props.username, Decl(unionAndIntersectionInference3.ts, 72, 45))
271+
272+ declare const MyComponent: ComponentType<Props>;
273+ >MyComponent : Symbol(MyComponent, Decl(unionAndIntersectionInference3.ts, 74, 13))
274+ >ComponentType : Symbol(ComponentType, Decl(unionAndIntersectionInference3.ts, 59, 54))
275+ >Props : Symbol(Props, Decl(unionAndIntersectionInference3.ts, 70, 54))
276+
277+ withRouter(MyComponent);
278+ >withRouter : Symbol(withRouter, Decl(unionAndIntersectionInference3.ts, 63, 54))
279+ >MyComponent : Symbol(MyComponent, Decl(unionAndIntersectionInference3.ts, 74, 13))
280+
281+ // Repro from #33490
282+
283+ type AB<T> = { a: T } | { b: T };
284+ >AB : Symbol(AB, Decl(unionAndIntersectionInference3.ts, 76, 24))
285+ >T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 80, 8))
286+ >a : Symbol(a, Decl(unionAndIntersectionInference3.ts, 80, 14))
287+ >T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 80, 8))
288+ >b : Symbol(b, Decl(unionAndIntersectionInference3.ts, 80, 25))
289+ >T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 80, 8))
290+
291+ // T & AB<U> normalizes to T & { a: U } | T & { b: U } below
292+ declare function foo<T, U>(obj: T & AB<U>): [T, U];
293+ >foo : Symbol(foo, Decl(unionAndIntersectionInference3.ts, 80, 33))
294+ >T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 83, 21))
295+ >U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 83, 23))
296+ >obj : Symbol(obj, Decl(unionAndIntersectionInference3.ts, 83, 27))
297+ >T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 83, 21))
298+ >AB : Symbol(AB, Decl(unionAndIntersectionInference3.ts, 76, 24))
299+ >U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 83, 23))
300+ >T : Symbol(T, Decl(unionAndIntersectionInference3.ts, 83, 21))
301+ >U : Symbol(U, Decl(unionAndIntersectionInference3.ts, 83, 23))
302+
303+ declare let ab: AB<string>;
304+ >ab : Symbol(ab, Decl(unionAndIntersectionInference3.ts, 84, 11))
305+ >AB : Symbol(AB, Decl(unionAndIntersectionInference3.ts, 76, 24))
306+
307+ let z = foo(ab); // [AB<string>, string]
308+ >z : Symbol(z, Decl(unionAndIntersectionInference3.ts, 86, 3))
309+ >foo : Symbol(foo, Decl(unionAndIntersectionInference3.ts, 80, 33))
310+ >ab : Symbol(ab, Decl(unionAndIntersectionInference3.ts, 84, 11))
311+
0 commit comments