Closed
Description
TypeScript Version: 2.8.1
Search Terms: Type checking, Intersection type, Interface, Optional properties
Code
// Following does not emit any errors (unexpected)
interface Base0 {
k0: number;
}
type A = Base0
& { k1?: { file: File, str: string } };
interface B extends Base0 {
k1?: number;
}
declare const a: A;
const b: B = a;
// However, following emits an error (as expected)
type C =
& { k1?: { file: File, str: string } };
interface D {
k1?: number;
}
declare const c: C;
const d: D = c;
Expected behavior: Emits errors for const b: B = a
and const d: D = c
Actual behavior: Emits an error only for const d: D = c
Related Issues: