Closed
Description
Currently if we want to retrieve a value nested inside a nullable property using destructuring, we have to split a single destructuring statement into two even if we know that the nullable property would always be non-null in under that branch.
For example:
interface Foo {
bar?: {
bia: number;
pia?: number;
};
}
let foo: Foo = ...;
// Currently we have to write something like this:
let {bar} = foo;
let {bia, pia} = bar!;
// But ideally we should be able to write something like:
let {
bar!: {
bia,
pia,
},
} = foo;
// Or even:
let {
bar!: {
bia,
pia!, // <--
},
} = foo;