mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-11 10:00:13 -06:00
Accepted baselines.
This commit is contained in:
parent
d8d72aabae
commit
315b06dc99
@ -24,7 +24,7 @@ b('foo').charAt(0);
|
||||
>b('foo').charAt : (pos: number) => string
|
||||
>b('foo') : string
|
||||
>b : B
|
||||
>'foo' : string
|
||||
>'foo' : "foo"
|
||||
>charAt : (pos: number) => string
|
||||
>0 : number
|
||||
|
||||
@ -94,25 +94,25 @@ var x1: string[] = c('B2');
|
||||
>x1 : string[]
|
||||
>c('B2') : string[]
|
||||
>c : C
|
||||
>'B2' : string
|
||||
>'B2' : "B2"
|
||||
|
||||
var x2: number = c('B1');
|
||||
>x2 : number
|
||||
>c('B1') : number
|
||||
>c : C
|
||||
>'B1' : string
|
||||
>'B1' : "B1"
|
||||
|
||||
var x3: boolean = c('A2');
|
||||
>x3 : boolean
|
||||
>c('A2') : boolean
|
||||
>c : C
|
||||
>'A2' : string
|
||||
>'A2' : "A2"
|
||||
|
||||
var x4: string = c('A1');
|
||||
>x4 : string
|
||||
>c('A1') : string
|
||||
>c : C
|
||||
>'A1' : string
|
||||
>'A1' : "A1"
|
||||
|
||||
var x5: void = c('A0');
|
||||
>x5 : void
|
||||
@ -124,19 +124,19 @@ var x6: number[] = c('C1');
|
||||
>x6 : number[]
|
||||
>c('C1') : number[]
|
||||
>c : C
|
||||
>'C1' : string
|
||||
>'C1' : "C1"
|
||||
|
||||
var x7: boolean[] = c('C2');
|
||||
>x7 : boolean[]
|
||||
>c('C2') : boolean[]
|
||||
>c : C
|
||||
>'C2' : string
|
||||
>'C2' : "C2"
|
||||
|
||||
var x8: string = c('C');
|
||||
>x8 : string
|
||||
>c('C') : string
|
||||
>c : C
|
||||
>'C' : string
|
||||
>'C' : "C"
|
||||
|
||||
var x9: void = c('generic');
|
||||
>x9 : void
|
||||
|
||||
@ -24,7 +24,7 @@ var r = f('a');
|
||||
>r : number
|
||||
>f('a') : number
|
||||
>f : Foo
|
||||
>'a' : string
|
||||
>'a' : "a"
|
||||
|
||||
var r2 = f('A');
|
||||
>r2 : any
|
||||
@ -36,7 +36,7 @@ var r3 = new f('a');
|
||||
>r3 : any
|
||||
>new f('a') : any
|
||||
>f : Foo
|
||||
>'a' : string
|
||||
>'a' : "a"
|
||||
|
||||
var r4 = new f('A');
|
||||
>r4 : Object
|
||||
|
||||
@ -1,20 +1,13 @@
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts(6,5): error TS2322: Type '[string, string, string]' is not assignable to type '["I'm", "a", any]'.
|
||||
Types of property '0' are incompatible.
|
||||
Type 'string' is not assignable to type '"I'm"'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts(6,37): error TS2304: Cannot find name 'Dinosaur'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndTuples01.ts (2 errors) ====
|
||||
==== 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 TS2322: Type '[string, string, string]' is not assignable to type '["I'm", "a", any]'.
|
||||
!!! error TS2322: Types of property '0' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"I'm"'.
|
||||
~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'Dinosaur'.
|
||||
|
||||
|
||||
@ -2,12 +2,9 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(18,10)
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(19,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(20,10): error TS2394: Overload signature is not compatible with function implementation.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(22,21): error TS2304: Cannot find name 'is'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(25,5): error TS2322: Type '{ kind: string; a: number; }' is not assignable to type 'A'.
|
||||
Types of property 'kind' are incompatible.
|
||||
Type 'string' is not assignable to type '"A"'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts (5 errors) ====
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts (4 errors) ====
|
||||
|
||||
type Kind = "A" | "B"
|
||||
|
||||
@ -41,10 +38,6 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTags01.ts(25,5):
|
||||
}
|
||||
|
||||
let x: A = {
|
||||
~
|
||||
!!! error TS2322: Type '{ kind: string; a: number; }' is not assignable to type 'A'.
|
||||
!!! error TS2322: Types of property 'kind' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"A"'.
|
||||
kind: "A",
|
||||
a: 100,
|
||||
}
|
||||
|
||||
@ -1,17 +1,7 @@
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(5,7): error TS1155: 'const' declarations must be initialized
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(7,1): error TS2322: Type 'string' is not assignable to type '""'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(8,1): error TS2322: Type 'string' is not assignable to type '"foo"'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(9,1): error TS2322: Type 'string' is not assignable to type '"bar"'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(11,5): error TS2322: Type 'string' is not assignable to type '""'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(12,5): error TS2322: Type 'string' is not assignable to type '"foo"'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(13,5): error TS2322: Type 'string' is not assignable to type '"bar"'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(14,7): error TS2322: Type 'string' is not assignable to type '"baz"'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(16,1): error TS2322: Type 'string' is not assignable to type '""'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(17,1): error TS2322: Type 'string' is not assignable to type '"foo"'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts(18,1): error TS2322: Type 'string' is not assignable to type '"bar"'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts (11 errors) ====
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarations01.ts (1 errors) ====
|
||||
|
||||
let a: "";
|
||||
var b: "foo";
|
||||
@ -21,34 +11,14 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesInVariableDeclarat
|
||||
!!! error TS1155: 'const' declarations must be initialized
|
||||
|
||||
a = "";
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '""'.
|
||||
b = "foo";
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"foo"'.
|
||||
c = "bar";
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"bar"'.
|
||||
|
||||
let e: "" = "";
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '""'.
|
||||
var f: "foo" = "foo";
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"foo"'.
|
||||
let g: "bar" = "bar";
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"bar"'.
|
||||
const h: "baz" = "baz";
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"baz"'.
|
||||
|
||||
e = "";
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '""'.
|
||||
f = "foo";
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"foo"'.
|
||||
g = "bar";
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"bar"'.
|
||||
g = "bar";
|
||||
@ -1,10 +1,7 @@
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(11,10): error TS2354: No best common type exists among return expressions.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(32,7): error TS2322: Type 'string' is not assignable to type '"string"'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(33,7): error TS2322: Type 'string' is not assignable to type '"number"'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(34,7): error TS2322: Type 'string' is not assignable to type '"boolean"'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts (4 errors) ====
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts (1 errors) ====
|
||||
|
||||
type PrimitiveName = 'string' | 'number' | 'boolean';
|
||||
|
||||
@ -39,14 +36,8 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads01.ts(34,
|
||||
}
|
||||
|
||||
const string: "string" = "string"
|
||||
~~~~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"string"'.
|
||||
const number: "number" = "number"
|
||||
~~~~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"number"'.
|
||||
const boolean: "boolean" = "boolean"
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"boolean"'.
|
||||
|
||||
const stringOrNumber = string || number;
|
||||
const stringOrBoolean = string || boolean;
|
||||
|
||||
@ -1,10 +1,7 @@
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(9,10): error TS2354: No best common type exists among return expressions.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(30,7): error TS2322: Type 'string' is not assignable to type '"string"'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(31,7): error TS2322: Type 'string' is not assignable to type '"number"'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(32,7): error TS2322: Type 'string' is not assignable to type '"boolean"'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts (4 errors) ====
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts (1 errors) ====
|
||||
|
||||
function getFalsyPrimitive(x: "string"): string;
|
||||
function getFalsyPrimitive(x: "number"): number;
|
||||
@ -37,14 +34,8 @@ tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloads02.ts(32,
|
||||
}
|
||||
|
||||
const string: "string" = "string"
|
||||
~~~~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"string"'.
|
||||
const number: "number" = "number"
|
||||
~~~~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"number"'.
|
||||
const boolean: "boolean" = "boolean"
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"boolean"'.
|
||||
|
||||
const stringOrNumber = string || number;
|
||||
const stringOrBoolean = string || boolean;
|
||||
|
||||
@ -49,5 +49,5 @@ c[Symbol.iterator]("hello");
|
||||
>Symbol.iterator : symbol
|
||||
>Symbol : SymbolConstructor
|
||||
>iterator : symbol
|
||||
>"hello" : string
|
||||
>"hello" : "hello"
|
||||
|
||||
|
||||
@ -14,9 +14,9 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0
|
||||
Type 'string' is not assignable to type '"World"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(48,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'.
|
||||
Type 'string' is not assignable to type '"World"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(55,34): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(57,43): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(58,34): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(55,43): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(57,52): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(58,43): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(61,5): error TS2322: Type 'string' is not assignable to type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(63,5): error TS2322: Type 'string' is not assignable to type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(75,5): error TS2322: Type '"Hello" | "World"' is not assignable to type '"Hello"'.
|
||||
@ -25,7 +25,7 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0
|
||||
Type '"World"' is not assignable to type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(87,43): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(88,43): error TS2345: Argument of type 'string' is not assignable to parameter of type '"World"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(89,43): error TS2345: Argument of type 'string' is not assignable to parameter of type '"World"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(89,52): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(93,5): error TS2322: Type 'string' is not assignable to type '"Hello" | "World"'.
|
||||
Type 'string' is not assignable to type '"World"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(97,5): error TS2322: Type 'string' is not assignable to type '"Hello" | "World"'.
|
||||
@ -119,14 +119,14 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0
|
||||
// as "Hello" (or "Hello" | "Hello").
|
||||
export let a = fun1<"Hello">("Hello", "Hello");
|
||||
export let b = fun1<"Hello">("Hello", "World");
|
||||
~~~~~~~
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
export let c = fun2<"Hello", "Hello">("Hello", "Hello");
|
||||
export let d = fun2<"Hello", "Hello">("Hello", "World");
|
||||
~~~~~~~
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
export let e = fun3<"Hello">("Hello", "World");
|
||||
~~~~~~~
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
|
||||
// Assignment from the returned value should cause an error.
|
||||
@ -173,8 +173,8 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"World"'.
|
||||
export let d = fun2<"World", "Hello">("World", "World");
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"World"'.
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
export let e = fun3<"Hello" | "World">("Hello", "World");
|
||||
|
||||
// Assignment from the returned value should cause an error.
|
||||
|
||||
@ -125,7 +125,7 @@ var r1: Derived1 = c.foo('hi');
|
||||
>c.foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; }
|
||||
>c : C
|
||||
>foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; }
|
||||
>'hi' : string
|
||||
>'hi' : "hi"
|
||||
|
||||
var r2: Derived2 = c.foo('bye');
|
||||
>r2 : Derived2
|
||||
@ -134,7 +134,7 @@ var r2: Derived2 = c.foo('bye');
|
||||
>c.foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; }
|
||||
>c : C
|
||||
>foo : { (x: "hi"): Derived1; (x: "bye"): Derived2; (x: string): Base; }
|
||||
>'bye' : string
|
||||
>'bye' : "bye"
|
||||
|
||||
var r3: Base = c.foo('hm');
|
||||
>r3 : Base
|
||||
|
||||
@ -100,14 +100,14 @@ var r1 = new C('hi');
|
||||
>r1 : C
|
||||
>new C('hi') : C
|
||||
>C : typeof C
|
||||
>'hi' : string
|
||||
>'hi' : "hi"
|
||||
|
||||
var r2: Derived2 = new i('bye');
|
||||
>r2 : Derived2
|
||||
>Derived2 : Derived2
|
||||
>new i('bye') : Derived2
|
||||
>i : I
|
||||
>'bye' : string
|
||||
>'bye' : "bye"
|
||||
|
||||
var r3: Base = new a('hm');
|
||||
>r3 : Base
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user