File: stringLiteralTypesAndTuples01.symbols

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (40 lines) | stat: -rw-r--r-- 1,763 bytes parent folder | download | duplicates (5)
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
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts ===
// Should all be strings.
let [hello, brave, newish, world] = ["Hello", "Brave", "New", "World"];
>hello : Symbol(hello, Decl(stringLiteralTypesAndTuples01.ts, 1, 5))
>brave : Symbol(brave, Decl(stringLiteralTypesAndTuples01.ts, 1, 11))
>newish : Symbol(newish, Decl(stringLiteralTypesAndTuples01.ts, 1, 18))
>world : Symbol(world, Decl(stringLiteralTypesAndTuples01.ts, 1, 26))

type RexOrRaptor = "t-rex" | "raptor"
>RexOrRaptor : Symbol(RexOrRaptor, Decl(stringLiteralTypesAndTuples01.ts, 1, 71))

let [im, a, dinosaur]: ["I'm", "a", RexOrRaptor] = ['I\'m', 'a', 't-rex'];
>im : Symbol(im, Decl(stringLiteralTypesAndTuples01.ts, 4, 5))
>a : Symbol(a, Decl(stringLiteralTypesAndTuples01.ts, 4, 8))
>dinosaur : Symbol(dinosaur, Decl(stringLiteralTypesAndTuples01.ts, 4, 11))
>RexOrRaptor : Symbol(RexOrRaptor, Decl(stringLiteralTypesAndTuples01.ts, 1, 71))

rawr(dinosaur);
>rawr : Symbol(rawr, Decl(stringLiteralTypesAndTuples01.ts, 6, 15))
>dinosaur : Symbol(dinosaur, Decl(stringLiteralTypesAndTuples01.ts, 4, 11))

function rawr(dino: RexOrRaptor) {
>rawr : Symbol(rawr, Decl(stringLiteralTypesAndTuples01.ts, 6, 15))
>dino : Symbol(dino, Decl(stringLiteralTypesAndTuples01.ts, 8, 14))
>RexOrRaptor : Symbol(RexOrRaptor, Decl(stringLiteralTypesAndTuples01.ts, 1, 71))

    if (dino === "t-rex") {
>dino : Symbol(dino, Decl(stringLiteralTypesAndTuples01.ts, 8, 14))

        return "ROAAAAR!";
    }
    if (dino === "raptor") {
>dino : Symbol(dino, Decl(stringLiteralTypesAndTuples01.ts, 8, 14))

        return "yip yip!";
    }

    throw "Unexpected " + dino;
>dino : Symbol(dino, Decl(stringLiteralTypesAndTuples01.ts, 8, 14))
}