-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript Version: nightly (2.0.0-dev.201xxxxx)
Code
enum E {
A,
B
}
let n: number = 0;
let y: E = n;
let z: E|boolean = n; // ERROR(9,5): : Type 'number' is not assignable to type 'boolean | E'.Expected behavior:
Either disallow assigning number to E, reasonable if one considers E equivalent to 0 | 1. Or allow the assignment of number to E | boolean.
Actual behavior:
let z: E|boolean = n; // ERROR(9,5): : Type 'number' is not assignable to type 'boolean | E'.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue