File: controlFlowNullishCoalesce.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 (19 lines) | stat: -rw-r--r-- 562 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
tests/cases/conformance/controlFlow/controlFlowNullishCoalesce.ts(4,1): error TS2454: Variable 'a' is used before being assigned.


==== tests/cases/conformance/controlFlow/controlFlowNullishCoalesce.ts (1 errors) ====
    // assignments in shortcutting rhs
    let a: number;
    o ?? (a = 1);
    a.toString();
    ~
!!! error TS2454: Variable 'a' is used before being assigned.
    
    // assignment flow
    declare const o: { x: number } | undefined;
    let x: { x: number } | boolean;
    if (x = o ?? true) {
        x;
    }