TypeScript/tests/cases/compiler/definiteAssignmentOfDestructuredVariable.ts
Wesley Wigham d4c36120cf
Make nonnull assertions and binding patterns apparent declared type locations (#20995)
* Use apparent type of original type to handle indexes

* Redo older fix causing new bug by extending getDeclaredOrApparentType instead of getTypeWithFacts

* Rename symbol
2018-01-19 16:06:42 -08:00

16 lines
315 B
TypeScript

// @strictNullChecks: true
// https://github.com/Microsoft/TypeScript/issues/20994
interface Options {
a?: number | object;
b: () => void;
}
class C<T extends Options> {
foo!: { [P in keyof T]: T[P] }
method() {
let { a, b } = this.foo;
!(a && b);
a;
}
}