File: equalityWithtNullishCoalescingAssignment%28strict%3Dtrue%29.types

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (55 lines) | stat: -rw-r--r-- 1,045 bytes parent folder | download
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
=== tests/cases/conformance/types/typeRelationships/comparable/equalityWithtNullishCoalescingAssignment.ts ===
function f1(a?: boolean): void {
>f1 : (a?: boolean) => void
>a : boolean | undefined

    a ??= true;
>a ??= true : boolean
>a : boolean | undefined
>true : true

    if (a === false) {
>a === false : boolean
>a : boolean
>false : false

        console.log(a);
>console.log(a) : void
>console.log : (...data: any[]) => void
>console : Console
>log : (...data: any[]) => void
>a : false
    }
}
f1(false);
>f1(false) : void
>f1 : (a?: boolean | undefined) => void
>false : false

function f2() {
>f2 : () => void

    let x: 0 | 1 | 2 | 3 = 0 as any;
>x : 0 | 1 | 2 | 3
>0 as any : any
>0 : 0

    x ??= 1;
>x ??= 1 : 0 | 1 | 2 | 3
>x : 0 | 1 | 2 | 3
>1 : 1

    if (x === 0) {
>x === 0 : boolean
>x : 0 | 1 | 2 | 3
>0 : 0

        console.log(x);
>console.log(x) : void
>console.log : (...data: any[]) => void
>console : Console
>log : (...data: any[]) => void
>x : 0
    }
}