-
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
Given the following TypeScript:
const a: { x?: number; } = { };
let x = 0;
({ x = 1 } = a); // error: Type 'number | undefined' is not assignable to 'number'.However, the destructuring assignment has a default value assigned. This should be treated the same way that strict null checking treats VariableDeclarationList, which does not have this error:
const a: { x?: number; } = { };
let { x = 1 } = a;
let y: number = x; // ok, x has type 'number'TypeScript Version:
nightly
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