File: controlFlowDestructuringVariablesInTryCatch.errors.txt

package info (click to toggle)
node-typescript 5.0.4%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 459,116 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (39 lines) | stat: -rw-r--r-- 1,494 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
tests/cases/compiler/controlFlowDestructuringVariablesInTryCatch.ts(16,1): error TS2454: Variable 'a' is used before being assigned.
tests/cases/compiler/controlFlowDestructuringVariablesInTryCatch.ts(17,1): error TS2454: Variable 'b' is used before being assigned.
tests/cases/compiler/controlFlowDestructuringVariablesInTryCatch.ts(18,1): error TS2454: Variable 'c' is used before being assigned.
tests/cases/compiler/controlFlowDestructuringVariablesInTryCatch.ts(19,1): error TS2454: Variable 'd' is used before being assigned.
tests/cases/compiler/controlFlowDestructuringVariablesInTryCatch.ts(20,1): error TS2454: Variable 'e' is used before being assigned.


==== tests/cases/compiler/controlFlowDestructuringVariablesInTryCatch.ts (5 errors) ====
    declare function f1(): string;
    declare function f2(): [b: string];
    declare function f3(): { c: string };
    
    try {
        var a = f1();
        var [b] = f2();
        var { c } = f3();
    
        var [d = 1] = [];
        var { e = 1 } = { };
    } catch {
        console.error("error");
    }
    
    a;
    ~
!!! error TS2454: Variable 'a' is used before being assigned.
    b;
    ~
!!! error TS2454: Variable 'b' is used before being assigned.
    c;
    ~
!!! error TS2454: Variable 'c' is used before being assigned.
    d;
    ~
!!! error TS2454: Variable 'd' is used before being assigned.
    e;
    ~
!!! error TS2454: Variable 'e' is used before being assigned.