Accepted baselines.

This commit is contained in:
Daniel Rosenwasser
2015-10-02 16:34:15 -07:00
parent 4b736da231
commit fd5dec4ff1
4 changed files with 102 additions and 27 deletions
@@ -1,25 +0,0 @@
tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts(6,37): error TS2304: Cannot find name 'Dinosaur'.
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts (1 errors) ====
// Should all be strings.
let [hello, brave, newish, world] = ["Hello", "Brave", "New", "World"];
type RexOrRaptor = "t-rex" | "raptor"
let [im, a, dinosaur]: ["I'm", "a", Dinosaur] = ['I\'m', 'a', 't-rex'];
~~~~~~~~
!!! error TS2304: Cannot find name 'Dinosaur'.
rawr(dinosaur);
function rawr(dino: RexOrRaptor) {
if (dino === "t-rex") {
return "ROAAAAR!";
}
if (dino === "raptor") {
return "yip yip!";
}
throw "Unexpected " + dino;
}
@@ -4,7 +4,7 @@
let [hello, brave, newish, world] = ["Hello", "Brave", "New", "World"];
type RexOrRaptor = "t-rex" | "raptor"
let [im, a, dinosaur]: ["I'm", "a", Dinosaur] = ['I\'m', 'a', 't-rex'];
let [im, a, dinosaur]: ["I'm", "a", RexOrRaptor] = ['I\'m', 'a', 't-rex'];
rawr(dinosaur);
@@ -38,5 +38,5 @@ function rawr(dino) {
//// [stringLiteralTypesAndTuples01.d.ts]
declare let hello: string, brave: string, newish: string, world: string;
declare type RexOrRaptor = "t-rex" | "raptor";
declare let im: "I'm", a: "a", dinosaur: any;
declare let im: "I'm", a: "a", dinosaur: "t-rex" | "raptor";
declare function rawr(dino: RexOrRaptor): string;
@@ -0,0 +1,41 @@
=== 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, 2, 5))
>brave : Symbol(brave, Decl(stringLiteralTypesAndTuples01.ts, 2, 11))
>newish : Symbol(newish, Decl(stringLiteralTypesAndTuples01.ts, 2, 18))
>world : Symbol(world, Decl(stringLiteralTypesAndTuples01.ts, 2, 26))
type RexOrRaptor = "t-rex" | "raptor"
>RexOrRaptor : Symbol(RexOrRaptor, Decl(stringLiteralTypesAndTuples01.ts, 2, 71))
let [im, a, dinosaur]: ["I'm", "a", RexOrRaptor] = ['I\'m', 'a', 't-rex'];
>im : Symbol(im, Decl(stringLiteralTypesAndTuples01.ts, 5, 5))
>a : Symbol(a, Decl(stringLiteralTypesAndTuples01.ts, 5, 8))
>dinosaur : Symbol(dinosaur, Decl(stringLiteralTypesAndTuples01.ts, 5, 11))
>RexOrRaptor : Symbol(RexOrRaptor, Decl(stringLiteralTypesAndTuples01.ts, 2, 71))
rawr(dinosaur);
>rawr : Symbol(rawr, Decl(stringLiteralTypesAndTuples01.ts, 7, 15))
>dinosaur : Symbol(dinosaur, Decl(stringLiteralTypesAndTuples01.ts, 5, 11))
function rawr(dino: RexOrRaptor) {
>rawr : Symbol(rawr, Decl(stringLiteralTypesAndTuples01.ts, 7, 15))
>dino : Symbol(dino, Decl(stringLiteralTypesAndTuples01.ts, 9, 14))
>RexOrRaptor : Symbol(RexOrRaptor, Decl(stringLiteralTypesAndTuples01.ts, 2, 71))
if (dino === "t-rex") {
>dino : Symbol(dino, Decl(stringLiteralTypesAndTuples01.ts, 9, 14))
return "ROAAAAR!";
}
if (dino === "raptor") {
>dino : Symbol(dino, Decl(stringLiteralTypesAndTuples01.ts, 9, 14))
return "yip yip!";
}
throw "Unexpected " + dino;
>dino : Symbol(dino, Decl(stringLiteralTypesAndTuples01.ts, 9, 14))
}
@@ -0,0 +1,59 @@
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts ===
// Should all be strings.
let [hello, brave, newish, world] = ["Hello", "Brave", "New", "World"];
>hello : string
>brave : string
>newish : string
>world : string
>["Hello", "Brave", "New", "World"] : [string, string, string, string]
>"Hello" : string
>"Brave" : string
>"New" : string
>"World" : string
type RexOrRaptor = "t-rex" | "raptor"
>RexOrRaptor : "t-rex" | "raptor"
let [im, a, dinosaur]: ["I'm", "a", RexOrRaptor] = ['I\'m', 'a', 't-rex'];
>im : "I'm"
>a : "a"
>dinosaur : "t-rex" | "raptor"
>RexOrRaptor : "t-rex" | "raptor"
>['I\'m', 'a', 't-rex'] : ["I'm", "a", "t-rex" | "raptor"]
>'I\'m' : "I'm"
>'a' : "a"
>'t-rex' : "t-rex" | "raptor"
rawr(dinosaur);
>rawr(dinosaur) : string
>rawr : (dino: "t-rex" | "raptor") => string
>dinosaur : "t-rex" | "raptor"
function rawr(dino: RexOrRaptor) {
>rawr : (dino: "t-rex" | "raptor") => string
>dino : "t-rex" | "raptor"
>RexOrRaptor : "t-rex" | "raptor"
if (dino === "t-rex") {
>dino === "t-rex" : boolean
>dino : "t-rex" | "raptor"
>"t-rex" : string
return "ROAAAAR!";
>"ROAAAAR!" : string
}
if (dino === "raptor") {
>dino === "raptor" : boolean
>dino : "t-rex" | "raptor"
>"raptor" : string
return "yip yip!";
>"yip yip!" : string
}
throw "Unexpected " + dino;
>"Unexpected " + dino : string
>"Unexpected " : string
>dino : "t-rex" | "raptor"
}