TypeScript/tests/baselines/reference/destructionAssignmentError.js
Wenlu Wang 62f3ccd9c0
Error if assignment after block (#41115)
* Error if assignment after block

* Update src/compiler/diagnosticMessages.json

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Fix diags

* Error after block

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-03-31 15:57:25 -07:00

29 lines
367 B
TypeScript

//// [destructionAssignmentError.ts]
declare function fn(): { a: 1, b: 2 }
let a: number;
let b: number;
({ a, b } = fn());
{ a, b } = fn();
({ a, b } =
fn());
{ a, b }
= fn();
//// [destructionAssignmentError.js]
var _a, _b;
var a;
var b;
(_a = fn(), a = _a.a, b = _a.b);
{
a, b;
}
fn();
(_b = fn(), a = _b.a, b = _b.b);
{
a, b;
}
fn();