-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Description
TypeScript Version: 2.6.0-dev.20171018
Code
interface X { x: string }
interface Y { y: number }
interface Z { z?: boolean }
type XY = X & Y;
const xy: XY = {x: 'x', y: 10};
const z1: Z = xy;
// (1) compiles without any errors
const z2: Z = xy as Pick<XY, keyof XY>;
// (2) produces error: Type 'Pick<X & Y, "x" | "y">' has no properties in common with type 'Z'.
Expected behavior:
(1) should produce an error similar to (2) because there are no common properties for XY
and Z
types.
Actual behavior:
(1) compiles without any errors.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScript