TypeScript/tests/baselines/reference/destructionAssignmentError.errors.txt
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

27 lines
1.7 KiB
Plaintext

tests/cases/compiler/destructionAssignmentError.ts(6,3): error TS2695: Left side of comma operator is unused and has no side effects.
tests/cases/compiler/destructionAssignmentError.ts(6,10): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
tests/cases/compiler/destructionAssignmentError.ts(11,3): error TS2695: Left side of comma operator is unused and has no side effects.
tests/cases/compiler/destructionAssignmentError.ts(12,1): error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
==== tests/cases/compiler/destructionAssignmentError.ts (4 errors) ====
declare function fn(): { a: 1, b: 2 }
let a: number;
let b: number;
({ a, b } = fn());
{ a, b } = fn();
~
!!! error TS2695: Left side of comma operator is unused and has no side effects.
~
!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.
({ a, b } =
fn());
{ a, b }
~
!!! error TS2695: Left side of comma operator is unused and has no side effects.
= fn();
~
!!! error TS2809: Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses.