-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
SuggestionAn idea for TypeScriptAn idea for TypeScriptToo ComplexAn issue which adding support for may be too complex for the value it addsAn issue which adding support for may be too complex for the value it adds
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;
Ky6uk, scottrippey, paramsinghvc, beausmith, laughinghan and 34 more
Metadata
Metadata
Assignees
Labels
SuggestionAn idea for TypeScriptAn idea for TypeScriptToo ComplexAn issue which adding support for may be too complex for the value it addsAn issue which adding support for may be too complex for the value it adds