Closed
Description
TypeScript Version: 3.9.2
Search Terms: Generic union intersection
Code
interface A {
kind: "A";
a: number;
}
interface B {
kind: "B";
b: number;
}
declare const shouldBeB: (A | B) & B;
const b: B = shouldBeB; // works
function inGeneric<T extends A | B>(alsoShouldBeB: T & B) {
const b: B = alsoShouldBeB;
// ~ TS2739: Type 'T & B' is missing the following properties from type 'B': kind, b
}
Expected behavior:
No errors (were no errors on 3.8)
Actual behavior:
TS2739: Type 'T & B' is missing the following properties from type 'B': kind, b
Playground Link: link
Related Issues:
It seems to be related to #36696