File: stringLiteralTypeAssertion01.types

package info (click to toggle)
node-typescript 4.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 396,552 kB
  • sloc: javascript: 1,444,377; makefile: 7; sh: 3
file content (94 lines) | stat: -rw-r--r-- 1,174 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypeAssertion01.ts ===
type S = "a" | "b";
>S : S

type T = S[] | S;
>T : T

var s: S;
>s : S

var t: T;
>t : T

var str: string;
>str : string

////////////////

s = <S>t;
>s = <S>t : S
>s : S
><S>t : S
>t : T

s = t as S;
>s = t as S : S
>s : S
>t as S : S
>t : T

s = <S>str;
>s = <S>str : S
>s : S
><S>str : S
>str : string

s = str as S;
>s = str as S : S
>s : S
>str as S : S
>str : string

////////////////

t = <T>s;
>t = <T>s : T
>t : T
><T>s : T
>s : S

t = s as T;
>t = s as T : T
>t : T
>s as T : T
>s : S

t = <T>str;
>t = <T>str : T
>t : T
><T>str : T
>str : string

t = str as T;
>t = str as T : T
>t : T
>str as T : T
>str : string

////////////////

str = <string>s;
>str = <string>s : string
>str : string
><string>s : string
>s : S

str = s as string;
>str = s as string : string
>str : string
>s as string : string
>s : S

str = <string>t;
>str = <string>t : string
>str : string
><string>t : string
>t : T

str = t as string;
>str = t as string : string
>str : string
>t as string : string
>t : T