@@ -373,3 +373,87 @@ const f4 = (t: number | (Container<"b"> & { dataB: boolean } & Container<"a">)):
373373>Container : Symbol(Container, Decl(intersectionReduction.ts, 99, 44))
374374>t : Symbol(t, Decl(intersectionReduction.ts, 107, 12))
375375
376+ // Repro from #38549
377+
378+ interface A2 {
379+ >A2 : Symbol(A2, Decl(intersectionReduction.ts, 107, 93))
380+
381+ kind: "A";
382+ >kind : Symbol(A2.kind, Decl(intersectionReduction.ts, 111, 14))
383+
384+ a: number;
385+ >a : Symbol(A2.a, Decl(intersectionReduction.ts, 112, 14))
386+ }
387+
388+ interface B2 {
389+ >B2 : Symbol(B2, Decl(intersectionReduction.ts, 114, 1))
390+
391+ kind: "B";
392+ >kind : Symbol(B2.kind, Decl(intersectionReduction.ts, 116, 14))
393+
394+ b: number;
395+ >b : Symbol(B2.b, Decl(intersectionReduction.ts, 117, 14))
396+ }
397+
398+ declare const shouldBeB: (A2 | B2) & B2;
399+ >shouldBeB : Symbol(shouldBeB, Decl(intersectionReduction.ts, 121, 13))
400+ >A2 : Symbol(A2, Decl(intersectionReduction.ts, 107, 93))
401+ >B2 : Symbol(B2, Decl(intersectionReduction.ts, 114, 1))
402+ >B2 : Symbol(B2, Decl(intersectionReduction.ts, 114, 1))
403+
404+ const b: B2 = shouldBeB; // works
405+ >b : Symbol(b, Decl(intersectionReduction.ts, 122, 5))
406+ >B2 : Symbol(B2, Decl(intersectionReduction.ts, 114, 1))
407+ >shouldBeB : Symbol(shouldBeB, Decl(intersectionReduction.ts, 121, 13))
408+
409+ function inGeneric<T extends A2 | B2>(alsoShouldBeB: T & B2) {
410+ >inGeneric : Symbol(inGeneric, Decl(intersectionReduction.ts, 122, 24))
411+ >T : Symbol(T, Decl(intersectionReduction.ts, 124, 19))
412+ >A2 : Symbol(A2, Decl(intersectionReduction.ts, 107, 93))
413+ >B2 : Symbol(B2, Decl(intersectionReduction.ts, 114, 1))
414+ >alsoShouldBeB : Symbol(alsoShouldBeB, Decl(intersectionReduction.ts, 124, 38))
415+ >T : Symbol(T, Decl(intersectionReduction.ts, 124, 19))
416+ >B2 : Symbol(B2, Decl(intersectionReduction.ts, 114, 1))
417+
418+ const b: B2 = alsoShouldBeB;
419+ >b : Symbol(b, Decl(intersectionReduction.ts, 125, 9))
420+ >B2 : Symbol(B2, Decl(intersectionReduction.ts, 114, 1))
421+ >alsoShouldBeB : Symbol(alsoShouldBeB, Decl(intersectionReduction.ts, 124, 38))
422+ }
423+
424+ // Repro from #38542
425+
426+ interface ABI {
427+ >ABI : Symbol(ABI, Decl(intersectionReduction.ts, 126, 1))
428+
429+ kind: 'a' | 'b';
430+ >kind : Symbol(ABI.kind, Decl(intersectionReduction.ts, 130, 15))
431+ }
432+
433+ declare class CA { kind: 'a'; a: string; x: number };
434+ >CA : Symbol(CA, Decl(intersectionReduction.ts, 132, 1))
435+ >kind : Symbol(CA.kind, Decl(intersectionReduction.ts, 134, 18))
436+ >a : Symbol(CA.a, Decl(intersectionReduction.ts, 134, 29))
437+ >x : Symbol(CA.x, Decl(intersectionReduction.ts, 134, 40))
438+
439+ declare class CB { kind: 'b'; b: string; y: number };
440+ >CB : Symbol(CB, Decl(intersectionReduction.ts, 134, 53))
441+ >kind : Symbol(CB.kind, Decl(intersectionReduction.ts, 135, 18))
442+ >b : Symbol(CB.b, Decl(intersectionReduction.ts, 135, 29))
443+ >y : Symbol(CB.y, Decl(intersectionReduction.ts, 135, 40))
444+
445+ function bar<T extends CA | CB>(x: T & CA) {
446+ >bar : Symbol(bar, Decl(intersectionReduction.ts, 135, 53))
447+ >T : Symbol(T, Decl(intersectionReduction.ts, 137, 13))
448+ >CA : Symbol(CA, Decl(intersectionReduction.ts, 132, 1))
449+ >CB : Symbol(CB, Decl(intersectionReduction.ts, 134, 53))
450+ >x : Symbol(x, Decl(intersectionReduction.ts, 137, 32))
451+ >T : Symbol(T, Decl(intersectionReduction.ts, 137, 13))
452+ >CA : Symbol(CA, Decl(intersectionReduction.ts, 132, 1))
453+
454+ let ab: ABI = x;
455+ >ab : Symbol(ab, Decl(intersectionReduction.ts, 138, 7))
456+ >ABI : Symbol(ABI, Decl(intersectionReduction.ts, 126, 1))
457+ >x : Symbol(x, Decl(intersectionReduction.ts, 137, 32))
458+ }
459+
0 commit comments