mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
29 lines
579 B
TypeScript
29 lines
579 B
TypeScript
//// [tests/cases/compiler/definiteAssignmentOfDestructuredVariable.ts] ////
|
|
|
|
//// [definiteAssignmentOfDestructuredVariable.ts]
|
|
// 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;
|
|
}
|
|
}
|
|
|
|
//// [definiteAssignmentOfDestructuredVariable.js]
|
|
"use strict";
|
|
class C {
|
|
method() {
|
|
let { a, b } = this.foo;
|
|
!(a && b);
|
|
a;
|
|
}
|
|
}
|