TypeScript/tests/cases/compiler/destructuringAssignmentWithExportedName.ts
Wesley Wigham 9c40d276ab
Downlevel destructuring in module transformer if destructured variable has multiple names (#23832)
* Downlevel destructuring in module transformer if destructured variable has multiple names

* Alter indentation
2018-05-02 16:20:47 -07:00

27 lines
652 B
TypeScript

// @target: es2015
// @module: commonjs
export let exportedFoo: any;
let nonexportedFoo: any;
// sanity checks
exportedFoo = null;
nonexportedFoo = null;
if (null as any) {
({ exportedFoo, nonexportedFoo } = null as any);
}
else if (null as any) {
({ foo: exportedFoo, bar: nonexportedFoo } = null as any);
}
else if (null as any) {
({ foo: { bar: exportedFoo, baz: nonexportedFoo } } = null as any);
}
else if (null as any) {
([exportedFoo, nonexportedFoo] = null as any);
}
else {
([[exportedFoo, nonexportedFoo]] = null as any);
}
export { nonexportedFoo };
export { exportedFoo as foo, nonexportedFoo as nfoo };