-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Description
TypeScript Version: 2.7.0-dev.20171118
Code
declare let v1: undefined;
declare let v2: {[key: string]: string};
declare let v3: {[key: string]: string}|undefined;
let map: {[key: string]: string};
map = {...v1}; // FAILS
map = {...v2};
map = {...undefined}; // FAILS
map = {...v3}; // OKExpected behavior:
- Consistency: undefined values are either allowed or disallowed in spread operator, regardless of whether they come explicitly, through a variable of undefined type, or through a variable of a variant type with an undefined branch.
- Ideally, backward compatibility with the previous versions.
Actual behavior:
- Values of "bare" undefined type are forbidden, while values of at least some X|undefined types
are allowed. - No backward compatibility, as the lines commented with "FAILS" are accepted by 2.5.3.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug