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
Given the following TypeScript:
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:TypeScript Version:
nightly