File: parseInvalidNullableTypes.types

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 (63 lines) | stat: -rw-r--r-- 1,020 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
56
57
58
59
60
61
62
63
=== tests/cases/compiler/parseInvalidNullableTypes.ts ===
function f1(a: string): a is ?string {
>f1 : (a: string) => a is string | null
>a : string

    return true;
>true : true
}

function f2(a: string?) {}
>f2 : (a: string | null) => void
>a : string | null

function f3(a: number?) {}
>f3 : (a: number | null) => void
>a : number | null

function f4(a: ?string) {}
>f4 : (a: string | null) => void
>a : string | null

function f5(a: ?number) {}
>f5 : (a: number | null) => void
>a : number | null

function f6(a: string): ?string {
>f6 : (a: string) => string | null
>a : string

    return true;
>true : true
}

const a = 1 as any?;
>a : any
>1 as any? : any
>1 : 1

const b: number? = 1;
>b : number | null
>1 : 1

const c = 1 as ?any;
>c : any
>1 as ?any : any
>1 : 1

const d: ?number = 1;
>d : number | null
>1 : 1

let e: unknown?;
>e : unknown

let f: never?;
>f : null

let g: void?;
>g : void | null

let h: undefined?;
>h : null | undefined