mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Accept new baselines
This commit is contained in:
1 parent
15a66676cc
commit
7d1c2fcf70
192 files changed
+1351
-1351
No files matched your search
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,6): error TS2461: Type 'number | string' is not an array type.
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,6): error TS2461: Type 'string | number' is not an array type.
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,7): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,14): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
@@ -8,7 +8,7 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,14): error
|
||||
var tuple: [number, string] = [2, "3"];
|
||||
for ([a = 1, b = ""] of tuple) {
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2461: Type 'number | string' is not an array type.
|
||||
!!! error TS2461: Type 'string | number' is not an array type.
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
~
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck11.ts(3,6): error TS2322: Type 'number | string' is not assignable to type 'string'.
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck11.ts(3,6): error TS2322: Type 'string | number' is not assignable to type 'string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
@@ -7,5 +7,5 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck11.ts(3,6)
|
||||
var v: string;
|
||||
for (v of union) { }
|
||||
~
|
||||
!!! error TS2322: Type 'number | string' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'string | number' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
@@ -3,6 +3,6 @@ var union: string | number[];
|
||||
>union : string | number[]
|
||||
|
||||
for (var v of union) { }
|
||||
>v : number | string
|
||||
>v : string | number
|
||||
>union : string | number[]
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck9.ts(2,15): error TS2461: Type 'string[] | number | symbol' is not an array type.
|
||||
tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck9.ts(2,15): error TS2461: Type 'number | symbol | string[]' is not an array type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck9.ts (1 errors) ====
|
||||
var union: string | string[] | number | symbol;
|
||||
for (let v of union) { }
|
||||
~~~~~
|
||||
!!! error TS2461: Type 'string[] | number | symbol' is not an array type.
|
||||
!!! error TS2461: Type 'number | symbol | string[]' is not an array type.
|
||||
@@ -6,14 +6,14 @@ enum Color { R, G, B }
|
||||
>B : Color
|
||||
|
||||
function f1(x: Color | string) {
|
||||
>f1 : (x: Color | string) => void
|
||||
>x : Color | string
|
||||
>f1 : (x: string | Color) => void
|
||||
>x : string | Color
|
||||
>Color : Color
|
||||
|
||||
if (typeof x === "number") {
|
||||
>typeof x === "number" : boolean
|
||||
>typeof x : string
|
||||
>x : Color | string
|
||||
>x : string | Color
|
||||
>"number" : "number"
|
||||
|
||||
var y = x;
|
||||
@@ -35,14 +35,14 @@ function f1(x: Color | string) {
|
||||
}
|
||||
|
||||
function f2(x: Color | string | string[]) {
|
||||
>f2 : (x: Color | string | string[]) => void
|
||||
>x : Color | string | string[]
|
||||
>f2 : (x: string | Color | string[]) => void
|
||||
>x : string | Color | string[]
|
||||
>Color : Color
|
||||
|
||||
if (typeof x === "object") {
|
||||
>typeof x === "object" : boolean
|
||||
>typeof x : string
|
||||
>x : Color | string | string[]
|
||||
>x : string | Color | string[]
|
||||
>"object" : "object"
|
||||
|
||||
var y = x;
|
||||
@@ -55,7 +55,7 @@ function f2(x: Color | string | string[]) {
|
||||
if (typeof x === "number") {
|
||||
>typeof x === "number" : boolean
|
||||
>typeof x : string
|
||||
>x : string[] | Color | string
|
||||
>x : string | Color | string[]
|
||||
>"number" : "number"
|
||||
|
||||
var z = x;
|
||||
@@ -68,16 +68,16 @@ function f2(x: Color | string | string[]) {
|
||||
}
|
||||
else {
|
||||
var w = x;
|
||||
>w : string[] | string
|
||||
>x : string[] | string
|
||||
>w : string | string[]
|
||||
>x : string | string[]
|
||||
|
||||
var w: string | string[];
|
||||
>w : string[] | string
|
||||
>w : string | string[]
|
||||
}
|
||||
if (typeof x === "string") {
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>x : Color | string[] | string
|
||||
>x : string | Color | string[]
|
||||
>"string" : "string"
|
||||
|
||||
var a = x;
|
||||
|
||||
@@ -34,7 +34,7 @@ var d2: IHasVisualizationModel = i || moduleA;
|
||||
var d2: IHasVisualizationModel = moduleA || i;
|
||||
>d2 : IHasVisualizationModel
|
||||
>IHasVisualizationModel : IHasVisualizationModel
|
||||
>moduleA || i : typeof moduleA
|
||||
>moduleA || i : IHasVisualizationModel
|
||||
>moduleA : typeof moduleA
|
||||
>i : IHasVisualizationModel
|
||||
|
||||
|
||||
@@ -366,22 +366,22 @@ module EmptyTypes {
|
||||
>base2 : typeof base2
|
||||
|
||||
var b1 = [baseObj, base2Obj, ifaceObj];
|
||||
>b1 : base[]
|
||||
>[baseObj, base2Obj, ifaceObj] : base[]
|
||||
>b1 : iface[]
|
||||
>[baseObj, base2Obj, ifaceObj] : iface[]
|
||||
>baseObj : base
|
||||
>base2Obj : base2
|
||||
>ifaceObj : iface
|
||||
|
||||
var b2 = [base2Obj, baseObj, ifaceObj];
|
||||
>b2 : base2[]
|
||||
>[base2Obj, baseObj, ifaceObj] : base2[]
|
||||
>b2 : iface[]
|
||||
>[base2Obj, baseObj, ifaceObj] : iface[]
|
||||
>base2Obj : base2
|
||||
>baseObj : base
|
||||
>ifaceObj : iface
|
||||
|
||||
var b3 = [baseObj, ifaceObj, base2Obj];
|
||||
>b3 : base[]
|
||||
>[baseObj, ifaceObj, base2Obj] : base[]
|
||||
>b3 : iface[]
|
||||
>[baseObj, ifaceObj, base2Obj] : iface[]
|
||||
>baseObj : base
|
||||
>ifaceObj : iface
|
||||
>base2Obj : base2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/compiler/arrayLiteralComments.ts ===
|
||||
var testArrayWithFunc = [
|
||||
>testArrayWithFunc : ((() => void) | string | number | { a: number; } | number[])[]
|
||||
>[ // Function comment function() { let x = 1; }, // String comment '1', // Numeric comment 2, // Object comment { a: 1 }, // Array comment [1, 2, 3]] : ((() => void) | string | number | { a: number; } | number[])[]
|
||||
>testArrayWithFunc : (string | number | (() => void) | number[] | { a: number; })[]
|
||||
>[ // Function comment function() { let x = 1; }, // String comment '1', // Numeric comment 2, // Object comment { a: 1 }, // Array comment [1, 2, 3]] : (string | number | (() => void) | number[] | { a: number; })[]
|
||||
|
||||
// Function comment
|
||||
function() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/expressions/contextualTyping/arrayLiteralExpressionContextualTyping.ts(8,5): error TS2322: Type '[number, number, number, string]' is not assignable to type '[number, number, number]'.
|
||||
Types of property 'pop' are incompatible.
|
||||
Type '() => number | string' is not assignable to type '() => number'.
|
||||
Type 'number | string' is not assignable to type 'number'.
|
||||
Type '() => string | number' is not assignable to type '() => number'.
|
||||
Type 'string | number' is not assignable to type 'number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/contextualTyping/arrayLiteralExpressionContextualTyping.ts(14,5): error TS2322: Type 'number[]' is not assignable to type '[number, number, number]'.
|
||||
Property '0' is missing in type 'number[]'.
|
||||
@@ -19,8 +19,8 @@ tests/cases/conformance/expressions/contextualTyping/arrayLiteralExpressionConte
|
||||
~~~~
|
||||
!!! error TS2322: Type '[number, number, number, string]' is not assignable to type '[number, number, number]'.
|
||||
!!! error TS2322: Types of property 'pop' are incompatible.
|
||||
!!! error TS2322: Type '() => number | string' is not assignable to type '() => number'.
|
||||
!!! error TS2322: Type 'number | string' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type '() => string | number' is not assignable to type '() => number'.
|
||||
!!! error TS2322: Type 'string | number' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
// In a contextually typed array literal expression containing one or more spread elements,
|
||||
|
||||
@@ -23,8 +23,8 @@ var as = [a, b]; // { x: number; y?: number };[]
|
||||
>b : { x: number; z?: number; }
|
||||
|
||||
var bs = [b, a]; // { x: number; z?: number };[]
|
||||
>bs : ({ x: number; z?: number; } | { x: number; y?: number; })[]
|
||||
>[b, a] : ({ x: number; z?: number; } | { x: number; y?: number; })[]
|
||||
>bs : ({ x: number; y?: number; } | { x: number; z?: number; })[]
|
||||
>[b, a] : ({ x: number; y?: number; } | { x: number; z?: number; })[]
|
||||
>b : { x: number; z?: number; }
|
||||
>a : { x: number; y?: number; }
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ var a1 = ["hello", "world"]
|
||||
>"world" : string
|
||||
|
||||
var a2 = [, , , ...a0, "hello"];
|
||||
>a2 : (number | string)[]
|
||||
>[, , , ...a0, "hello"] : (number | string)[]
|
||||
>a2 : (string | number)[]
|
||||
>[, , , ...a0, "hello"] : (string | number)[]
|
||||
> : undefined
|
||||
> : undefined
|
||||
> : undefined
|
||||
@@ -151,8 +151,8 @@ interface myArray2 extends Array<Number|String> { }
|
||||
>String : String
|
||||
|
||||
var d0 = [1, true, ...temp,]; // has type (string|number|boolean)[]
|
||||
>d0 : (number | boolean | string)[]
|
||||
>[1, true, ...temp,] : (number | boolean | string)[]
|
||||
>d0 : (string | number | boolean)[]
|
||||
>[1, true, ...temp,] : (string | number | boolean)[]
|
||||
>1 : number
|
||||
>true : boolean
|
||||
>...temp : string
|
||||
@@ -214,8 +214,8 @@ var d8: number[][] = [[...temp1]]
|
||||
>temp1 : number[]
|
||||
|
||||
var d9 = [[...temp1], ...["hello"]];
|
||||
>d9 : (number[] | string)[]
|
||||
>[[...temp1], ...["hello"]] : (number[] | string)[]
|
||||
>d9 : (string | number[])[]
|
||||
>[[...temp1], ...["hello"]] : (string | number[])[]
|
||||
>[...temp1] : number[]
|
||||
>...temp1 : number
|
||||
>temp1 : number[]
|
||||
|
||||
@@ -24,8 +24,8 @@ var a1 = ["hello", "world"]
|
||||
>"world" : string
|
||||
|
||||
var a2 = [, , , ...a0, "hello"];
|
||||
>a2 : (number | string)[]
|
||||
>[, , , ...a0, "hello"] : (number | string)[]
|
||||
>a2 : (string | number)[]
|
||||
>[, , , ...a0, "hello"] : (string | number)[]
|
||||
> : undefined
|
||||
> : undefined
|
||||
> : undefined
|
||||
@@ -140,8 +140,8 @@ interface myArray2 extends Array<Number|String> { }
|
||||
>String : String
|
||||
|
||||
var d0 = [1, true, ...temp, ]; // has type (string|number|boolean)[]
|
||||
>d0 : (number | boolean | string)[]
|
||||
>[1, true, ...temp, ] : (number | boolean | string)[]
|
||||
>d0 : (string | number | boolean)[]
|
||||
>[1, true, ...temp, ] : (string | number | boolean)[]
|
||||
>1 : number
|
||||
>true : boolean
|
||||
>...temp : string
|
||||
@@ -176,10 +176,10 @@ var d4: myArray2 = [...temp, ...temp1];
|
||||
>temp1 : number[]
|
||||
|
||||
var d5 = [...a2];
|
||||
>d5 : (number | string)[]
|
||||
>[...a2] : (number | string)[]
|
||||
>...a2 : number | string
|
||||
>a2 : (number | string)[]
|
||||
>d5 : (string | number)[]
|
||||
>[...a2] : (string | number)[]
|
||||
>...a2 : string | number
|
||||
>a2 : (string | number)[]
|
||||
|
||||
var d6 = [...a3];
|
||||
>d6 : number[]
|
||||
@@ -201,8 +201,8 @@ var d8: number[][] = [[...temp1]]
|
||||
>temp1 : number[]
|
||||
|
||||
var d9 = [[...temp1], ...["hello"]];
|
||||
>d9 : (number[] | string)[]
|
||||
>[[...temp1], ...["hello"]] : (number[] | string)[]
|
||||
>d9 : (string | number[])[]
|
||||
>[[...temp1], ...["hello"]] : (string | number[])[]
|
||||
>[...temp1] : number[]
|
||||
>...temp1 : number
|
||||
>temp1 : number[]
|
||||
|
||||
@@ -5,19 +5,19 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(11,5): error
|
||||
Type 'string' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(17,5): error TS2322: Type '[number, number, string, boolean]' is not assignable to type '[number, number]'.
|
||||
Types of property 'pop' are incompatible.
|
||||
Type '() => number | string | boolean' is not assignable to type '() => number'.
|
||||
Type 'number | string | boolean' is not assignable to type 'number'.
|
||||
Type '() => string | number | boolean' is not assignable to type '() => number'.
|
||||
Type 'string | number | boolean' is not assignable to type 'number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(32,5): error TS2322: Type '(number[] | string[])[]' is not assignable to type 'tup'.
|
||||
Property '0' is missing in type '(number[] | string[])[]'.
|
||||
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(33,5): error TS2322: Type 'number[]' is not assignable to type '[number, number, number]'.
|
||||
Property '0' is missing in type 'number[]'.
|
||||
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error TS2322: Type '(number | string)[]' is not assignable to type 'myArray'.
|
||||
tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error TS2322: Type '(string | number)[]' is not assignable to type 'myArray'.
|
||||
Types of property 'push' are incompatible.
|
||||
Type '(...items: (number | string)[]) => number' is not assignable to type '(...items: Number[]) => number'.
|
||||
Type '(...items: (string | number)[]) => number' is not assignable to type '(...items: Number[]) => number'.
|
||||
Types of parameters 'items' and 'items' are incompatible.
|
||||
Type 'Number' is not assignable to type 'number | string'.
|
||||
Type 'Number' is not assignable to type 'string'.
|
||||
Type 'Number' is not assignable to type 'string | number'.
|
||||
Type 'Number' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts (6 errors) ====
|
||||
@@ -48,8 +48,8 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type '[number, number, string, boolean]' is not assignable to type '[number, number]'.
|
||||
!!! error TS2322: Types of property 'pop' are incompatible.
|
||||
!!! error TS2322: Type '() => number | string | boolean' is not assignable to type '() => number'.
|
||||
!!! error TS2322: Type 'number | string | boolean' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type '() => string | number | boolean' is not assignable to type '() => number'.
|
||||
!!! error TS2322: Type 'string | number | boolean' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
// The resulting type an array literal expression is determined as follows:
|
||||
@@ -75,10 +75,10 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error
|
||||
!!! error TS2322: Property '0' is missing in type 'number[]'.
|
||||
var c2: myArray = [...temp1, ...temp]; // Error cannot assign (number|string)[] to number[]
|
||||
~~
|
||||
!!! error TS2322: Type '(number | string)[]' is not assignable to type 'myArray'.
|
||||
!!! error TS2322: Type '(string | number)[]' is not assignable to type 'myArray'.
|
||||
!!! error TS2322: Types of property 'push' are incompatible.
|
||||
!!! error TS2322: Type '(...items: (number | string)[]) => number' is not assignable to type '(...items: Number[]) => number'.
|
||||
!!! error TS2322: Type '(...items: (string | number)[]) => number' is not assignable to type '(...items: Number[]) => number'.
|
||||
!!! error TS2322: Types of parameters 'items' and 'items' are incompatible.
|
||||
!!! error TS2322: Type 'Number' is not assignable to type 'number | string'.
|
||||
!!! error TS2322: Type 'Number' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'Number' is not assignable to type 'string | number'.
|
||||
!!! error TS2322: Type 'Number' is not assignable to type 'number'.
|
||||
|
||||
@@ -24,12 +24,12 @@ var z = Date as any as string;
|
||||
|
||||
// Should parse as a union type, not a bitwise 'or' of (32 as number) and 'string'
|
||||
var j = 32 as number|string;
|
||||
>j : number | string
|
||||
>32 as number|string : number | string
|
||||
>j : string | number
|
||||
>32 as number|string : string | number
|
||||
>32 : number
|
||||
|
||||
j = '';
|
||||
>j = '' : string
|
||||
>j : number | string
|
||||
>j : string | number
|
||||
>'' : string
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts(17,1): error TS2322: Type '[number, string]' is not assignable to type 'number[]'.
|
||||
Types of property 'pop' are incompatible.
|
||||
Type '() => number | string' is not assignable to type '() => number'.
|
||||
Type 'number | string' is not assignable to type 'number'.
|
||||
Type '() => string | number' is not assignable to type '() => number'.
|
||||
Type 'string | number' is not assignable to type 'number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatBetweenTupleAndArray.ts(18,1): error TS2322: Type '{}[]' is not assignable to type '[{}]'.
|
||||
Property '0' is missing in type '{}[]'.
|
||||
@@ -28,8 +28,8 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type '[number, string]' is not assignable to type 'number[]'.
|
||||
!!! error TS2322: Types of property 'pop' are incompatible.
|
||||
!!! error TS2322: Type '() => number | string' is not assignable to type '() => number'.
|
||||
!!! error TS2322: Type 'number | string' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type '() => string | number' is not assignable to type '() => number'.
|
||||
!!! error TS2322: Type 'string | number' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
emptyObjTuple = emptyObjArray;
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/async/es6/awaitUnion_es6.ts ===
|
||||
declare let a: number | string;
|
||||
>a : number | string
|
||||
>a : string | number
|
||||
|
||||
declare let b: PromiseLike<number> | PromiseLike<string>;
|
||||
>b : PromiseLike<number> | PromiseLike<string>
|
||||
@@ -8,7 +8,7 @@ declare let b: PromiseLike<number> | PromiseLike<string>;
|
||||
>PromiseLike : PromiseLike<T>
|
||||
|
||||
declare let c: PromiseLike<number | string>;
|
||||
>c : PromiseLike<number | string>
|
||||
>c : PromiseLike<string | number>
|
||||
>PromiseLike : PromiseLike<T>
|
||||
|
||||
declare let d: number | PromiseLike<string>;
|
||||
@@ -16,34 +16,34 @@ declare let d: number | PromiseLike<string>;
|
||||
>PromiseLike : PromiseLike<T>
|
||||
|
||||
declare let e: number | PromiseLike<number | string>;
|
||||
>e : number | PromiseLike<number | string>
|
||||
>e : number | PromiseLike<string | number>
|
||||
>PromiseLike : PromiseLike<T>
|
||||
|
||||
async function f() {
|
||||
>f : () => Promise<void>
|
||||
|
||||
let await_a = await a;
|
||||
>await_a : number | string
|
||||
>await a : number | string
|
||||
>a : number | string
|
||||
>await_a : string | number
|
||||
>await a : string | number
|
||||
>a : string | number
|
||||
|
||||
let await_b = await b;
|
||||
>await_b : number | string
|
||||
>await b : number | string
|
||||
>await_b : string | number
|
||||
>await b : string | number
|
||||
>b : PromiseLike<number> | PromiseLike<string>
|
||||
|
||||
let await_c = await c;
|
||||
>await_c : number | string
|
||||
>await c : number | string
|
||||
>c : PromiseLike<number | string>
|
||||
>await_c : string | number
|
||||
>await c : string | number
|
||||
>c : PromiseLike<string | number>
|
||||
|
||||
let await_d = await d;
|
||||
>await_d : number | string
|
||||
>await d : number | string
|
||||
>await_d : string | number
|
||||
>await d : string | number
|
||||
>d : number | PromiseLike<string>
|
||||
|
||||
let await_e = await e;
|
||||
>await_e : number | string
|
||||
>await e : number | string
|
||||
>e : number | PromiseLike<number | string>
|
||||
>await_e : string | number
|
||||
>await e : string | number
|
||||
>e : number | PromiseLike<string | number>
|
||||
}
|
||||
@@ -60,8 +60,8 @@ var r4 = true ? a : b; // typeof a
|
||||
>b : { x: number; z?: number; }
|
||||
|
||||
var r5 = true ? b : a; // typeof b
|
||||
>r5 : { x: number; z?: number; } | { x: number; y?: number; }
|
||||
>true ? b : a : { x: number; z?: number; } | { x: number; y?: number; }
|
||||
>r5 : { x: number; y?: number; } | { x: number; z?: number; }
|
||||
>true ? b : a : { x: number; y?: number; } | { x: number; z?: number; }
|
||||
>true : boolean
|
||||
>b : { x: number; z?: number; }
|
||||
>a : { x: number; y?: number; }
|
||||
|
||||
@@ -29,8 +29,8 @@ var derived2: Derived2;
|
||||
>Derived2 : Derived2
|
||||
|
||||
var r2 = true ? 1 : '';
|
||||
>r2 : number | string
|
||||
>true ? 1 : '' : number | string
|
||||
>r2 : string | number
|
||||
>true ? 1 : '' : string | number
|
||||
>true : boolean
|
||||
>1 : number
|
||||
>'' : string
|
||||
|
||||
@@ -98,8 +98,8 @@ var e3 = t3[2]; // any
|
||||
>2 : number
|
||||
|
||||
var e4 = t4[3]; // number
|
||||
>e4 : E1 | E2 | number
|
||||
>t4[3] : E1 | E2 | number
|
||||
>e4 : number | E1 | E2
|
||||
>t4[3] : number | E1 | E2
|
||||
>t4 : [E1, E2, number]
|
||||
>3 : number
|
||||
|
||||
@@ -66,8 +66,8 @@ var t5: [C1, F]
|
||||
>F : F
|
||||
|
||||
var e11 = t1[4]; // base
|
||||
>e11 : C | base
|
||||
>t1[4] : C | base
|
||||
>e11 : base | C
|
||||
>t1[4] : base | C
|
||||
>t1 : [C, base]
|
||||
>4 : number
|
||||
|
||||
@@ -90,8 +90,8 @@ var e41 = t4[2]; // base1
|
||||
>2 : number
|
||||
|
||||
var e51 = t5[2]; // {}
|
||||
>e51 : C1 | F
|
||||
>t5[2] : C1 | F
|
||||
>e51 : F | C1
|
||||
>t5[2] : F | C1
|
||||
>t5 : [C1, F]
|
||||
>2 : number
|
||||
|
||||
@@ -163,8 +163,8 @@ xa[1].foo(1, 2, ...a, "abc");
|
||||
>xa : X[]
|
||||
>1 : number
|
||||
>foo : (x: number, y: number, ...z: string[]) => any
|
||||
>...[1, 2, "abc"] : number | string
|
||||
>[1, 2, "abc"] : (number | string)[]
|
||||
>...[1, 2, "abc"] : string | number
|
||||
>[1, 2, "abc"] : (string | number)[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>"abc" : string
|
||||
|
||||
@@ -164,8 +164,8 @@ xa[1].foo(1, 2, ...a, "abc");
|
||||
>xa : X[]
|
||||
>1 : number
|
||||
>foo : (x: number, y: number, ...z: string[]) => any
|
||||
>...[1, 2, "abc"] : number | string
|
||||
>[1, 2, "abc"] : (number | string)[]
|
||||
>...[1, 2, "abc"] : string | number
|
||||
>[1, 2, "abc"] : (string | number)[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>"abc" : string
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts ===
|
||||
var v = {
|
||||
>v : { [x: number]: number | string; }
|
||||
>{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : { [x: number]: number | string; }
|
||||
>v : { [x: number]: string | number; }
|
||||
>{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : { [x: number]: string | number; }
|
||||
|
||||
get [0 + 1]() { return 0 },
|
||||
>0 + 1 : number
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES6.ts ===
|
||||
var v = {
|
||||
>v : { [x: number]: number | string; }
|
||||
>{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : { [x: number]: number | string; }
|
||||
>v : { [x: number]: string | number; }
|
||||
>{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : { [x: number]: string | number; }
|
||||
|
||||
get [0 + 1]() { return 0 },
|
||||
>0 + 1 : number
|
||||
|
||||
@@ -9,8 +9,8 @@ var a: any;
|
||||
>a : any
|
||||
|
||||
var v = {
|
||||
>v : { [x: string]: number | string; [x: number]: number | string; [0]: number; [""]: number; }
|
||||
>{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [<any>true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : { [x: string]: number | string; [x: number]: number | string; [0]: number; [""]: number; }
|
||||
>v : { [x: string]: string | number; [x: number]: string | number; [0]: number; [""]: number; }
|
||||
>{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [<any>true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : { [x: string]: string | number; [x: number]: string | number; [0]: number; [""]: number; }
|
||||
|
||||
[s]: 0,
|
||||
>s : string
|
||||
|
||||
@@ -9,8 +9,8 @@ var a: any;
|
||||
>a : any
|
||||
|
||||
var v = {
|
||||
>v : { [x: string]: number | string; [x: number]: number | string; [0]: number; [""]: number; }
|
||||
>{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [<any>true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : { [x: string]: number | string; [x: number]: number | string; [0]: number; [""]: number; }
|
||||
>v : { [x: string]: string | number; [x: number]: string | number; [0]: number; [""]: number; }
|
||||
>{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [<any>true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : { [x: string]: string | number; [x: number]: string | number; [0]: number; [""]: number; }
|
||||
|
||||
[s]: 0,
|
||||
>s : string
|
||||
|
||||
@@ -17,9 +17,9 @@ declare function foo<T>(obj: I<T>): T
|
||||
>T : T
|
||||
|
||||
foo({
|
||||
>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | (() => void) | boolean | number | number[]
|
||||
>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | number | boolean | (() => void) | number[]
|
||||
>foo : <T>(obj: I<T>) => T
|
||||
>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | (() => void) | boolean | number | number[]; [x: number]: (() => void) | number | number[]; 0: () => void; p: string; }
|
||||
>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | number | boolean | (() => void) | number[]; [x: number]: number | (() => void) | number[]; 0: () => void; p: string; }
|
||||
|
||||
p: "",
|
||||
>p : string
|
||||
|
||||
@@ -17,9 +17,9 @@ declare function foo<T>(obj: I<T>): T
|
||||
>T : T
|
||||
|
||||
foo({
|
||||
>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | (() => void) | boolean | number | number[]
|
||||
>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | number | boolean | (() => void) | number[]
|
||||
>foo : <T>(obj: I<T>) => T
|
||||
>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | (() => void) | boolean | number | number[]; [x: number]: (() => void) | number | number[]; 0: () => void; p: string; }
|
||||
>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | number | boolean | (() => void) | number[]; [x: number]: number | (() => void) | number[]; 0: () => void; p: string; }
|
||||
|
||||
p: "",
|
||||
>p : string
|
||||
|
||||
@@ -33,9 +33,9 @@ declare function g<T>(obj: J<T>): T;
|
||||
>T : T
|
||||
|
||||
foo({
|
||||
>foo({ 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : (() => void) | number | number[]
|
||||
>foo({ 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : number | (() => void) | number[]
|
||||
>foo : <T>(obj: I<T>) => T
|
||||
>{ 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: (() => void) | boolean | number | number[]; [x: number]: (() => void) | number | number[]; 0: () => void; }
|
||||
>{ 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: number | boolean | (() => void) | number[]; [x: number]: number | (() => void) | number[]; 0: () => void; }
|
||||
|
||||
0: () => { },
|
||||
>() => { } : () => void
|
||||
|
||||
@@ -33,9 +33,9 @@ declare function g<T>(obj: J<T>): T;
|
||||
>T : T
|
||||
|
||||
foo({
|
||||
>foo({ 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : (() => void) | number | number[]
|
||||
>foo({ 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : number | (() => void) | number[]
|
||||
>foo : <T>(obj: I<T>) => T
|
||||
>{ 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: (() => void) | boolean | number | number[]; [x: number]: (() => void) | number | number[]; 0: () => void; }
|
||||
>{ 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: number | boolean | (() => void) | number[]; [x: number]: number | (() => void) | number[]; 0: () => void; }
|
||||
|
||||
0: () => { },
|
||||
>() => { } : () => void
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/compiler/conditionalExpression1.ts(1,5): error TS2322: Type 'number | string' is not assignable to type 'boolean'.
|
||||
Type 'number' is not assignable to type 'boolean'.
|
||||
tests/cases/compiler/conditionalExpression1.ts(1,5): error TS2322: Type 'string | number' is not assignable to type 'boolean'.
|
||||
Type 'string' is not assignable to type 'boolean'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/conditionalExpression1.ts (1 errors) ====
|
||||
var x: boolean = (true ? 1 : ""); // should be an error
|
||||
~
|
||||
!!! error TS2322: Type 'number | string' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
|
||||
@@ -218,7 +218,7 @@ var result10: (t: X) => any = true ? (m) => m.propertyX1 : (n) => n.propertyX2;
|
||||
//Expr1 and Expr2 are literals
|
||||
var result11: any = true ? 1 : 'string';
|
||||
>result11 : any
|
||||
>true ? 1 : 'string' : number | string
|
||||
>true ? 1 : 'string' : string | number
|
||||
>true : boolean
|
||||
>1 : number
|
||||
>'string' : string
|
||||
|
||||
@@ -38,9 +38,9 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(160,30): error T
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(160,31): error TS2304: Cannot find name 'Property'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(167,13): error TS2365: Operator '+=' cannot be applied to types 'number' and 'void'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(181,40): error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(182,13): error TS2322: Type 'boolean' is not assignable to type 'true | number'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(184,13): error TS2322: Type 'boolean' is not assignable to type 'true | number'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(192,13): error TS2322: Type 'boolean' is not assignable to type 'true | number'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(182,13): error TS2322: Type 'boolean' is not assignable to type 'number | true'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(184,13): error TS2322: Type 'boolean' is not assignable to type 'number | true'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(192,13): error TS2322: Type 'boolean' is not assignable to type 'number | true'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(206,28): error TS1109: Expression expected.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(214,16): error TS2304: Cannot find name 'bool'.
|
||||
tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(219,10): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
@@ -353,11 +353,11 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(262,1): error TS
|
||||
!!! error TS2447: The '^' operator is not allowed for boolean types. Consider using '!==' instead.
|
||||
b = !b;/*!*/
|
||||
~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'true | number'.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'number | true'.
|
||||
i = ~i;/*~i*/
|
||||
b = i < (i - 1) && (i + 1) > i;/*< && >*/
|
||||
~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'true | number'.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'number | true'.
|
||||
var f = true ? 1 : 0;/*? :*/ // YES :
|
||||
i++;/*++*/
|
||||
i--;/*--*/
|
||||
@@ -367,7 +367,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(262,1): error TS
|
||||
var j = i;
|
||||
b = i == j && i != j && i <= j && i >= j;/*= == && != <= >=*/
|
||||
~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'true | number'.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'number | true'.
|
||||
i += <number>5.0;/*+=*/
|
||||
i -= i;/*-=*/
|
||||
i *= i;/**=*/
|
||||
|
||||
@@ -87,24 +87,24 @@ var a = baz(1, 1, g); // Should be number
|
||||
>g : <T>(x: T, y: T) => T
|
||||
|
||||
var b: number | string;
|
||||
>b : number | string
|
||||
>b : string | number
|
||||
|
||||
var b = foo(g); // Should be number | string
|
||||
>b : number | string
|
||||
>foo(g) : number | string
|
||||
>b : string | number
|
||||
>foo(g) : string | number
|
||||
>foo : <T>(cb: (x: number, y: string) => T) => T
|
||||
>g : <T>(x: T, y: T) => T
|
||||
|
||||
var b = bar(1, "one", g); // Should be number | string
|
||||
>b : number | string
|
||||
>bar(1, "one", g) : number | string
|
||||
>b : string | number
|
||||
>bar(1, "one", g) : string | number
|
||||
>bar : <T, U, V>(x: T, y: U, cb: (x: T, y: U) => V) => V
|
||||
>1 : number
|
||||
>"one" : string
|
||||
>g : <T>(x: T, y: T) => T
|
||||
|
||||
var b = bar("one", 1, g); // Should be number | string
|
||||
>b : number | string
|
||||
>b : string | number
|
||||
>bar("one", 1, g) : string | number
|
||||
>bar : <T, U, V>(x: T, y: U, cb: (x: T, y: U) => V) => V
|
||||
>"one" : string
|
||||
@@ -112,11 +112,11 @@ var b = bar("one", 1, g); // Should be number | string
|
||||
>g : <T>(x: T, y: T) => T
|
||||
|
||||
var b = baz(b, b, g); // Should be number | string
|
||||
>b : number | string
|
||||
>baz(b, b, g) : number | string
|
||||
>b : string | number
|
||||
>baz(b, b, g) : string | number
|
||||
>baz : <T, U>(x: T, y: T, cb: (x: T, y: T) => U) => U
|
||||
>b : number | string
|
||||
>b : number | string
|
||||
>b : string | number
|
||||
>b : string | number
|
||||
>g : <T>(x: T, y: T) => T
|
||||
|
||||
var d: number[] | string[];
|
||||
@@ -138,7 +138,7 @@ var d = bar(1, "one", h); // Should be number[] | string[]
|
||||
|
||||
var d = bar("one", 1, h); // Should be number[] | string[]
|
||||
>d : number[] | string[]
|
||||
>bar("one", 1, h) : string[] | number[]
|
||||
>bar("one", 1, h) : number[] | string[]
|
||||
>bar : <T, U, V>(x: T, y: U, cb: (x: T, y: U) => V) => V
|
||||
>"one" : string
|
||||
>1 : number
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(3,5): error TS2322: Type '[number, string, boolean]' is not assignable to type '[number, string]'.
|
||||
Types of property 'pop' are incompatible.
|
||||
Type '() => number | string | boolean' is not assignable to type '() => number | string'.
|
||||
Type 'number | string | boolean' is not assignable to type 'number | string'.
|
||||
Type 'true' is not assignable to type 'number | string'.
|
||||
Type '() => string | number | boolean' is not assignable to type '() => string | number'.
|
||||
Type 'string | number | boolean' is not assignable to type 'string | number'.
|
||||
Type 'true' is not assignable to type 'string | number'.
|
||||
tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(15,1): error TS2322: Type '[number, string, boolean]' is not assignable to type '[number, string]'.
|
||||
tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(18,1): error TS2322: Type '[{}, number]' is not assignable to type '[{ a: string; }, number]'.
|
||||
Types of property '0' are incompatible.
|
||||
@@ -30,9 +30,9 @@ tests/cases/conformance/types/tuple/contextualTypeWithTuple.ts(25,1): error TS23
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '[number, string, boolean]' is not assignable to type '[number, string]'.
|
||||
!!! error TS2322: Types of property 'pop' are incompatible.
|
||||
!!! error TS2322: Type '() => number | string | boolean' is not assignable to type '() => number | string'.
|
||||
!!! error TS2322: Type 'number | string | boolean' is not assignable to type 'number | string'.
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'number | string'.
|
||||
!!! error TS2322: Type '() => string | number | boolean' is not assignable to type '() => string | number'.
|
||||
!!! error TS2322: Type 'string | number | boolean' is not assignable to type 'string | number'.
|
||||
!!! error TS2322: Type 'true' is not assignable to type 'string | number'.
|
||||
var numStrBoolTuple: [number, string, boolean] = [5, "foo", true];
|
||||
var objNumTuple: [{ a: string }, number] = [{ a: "world" }, 5];
|
||||
var strTupleTuple: [string, [number, {}]] = ["bar", [5, { x: 1, y: 1 }]];
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
tests/cases/compiler/contextualTyping21.ts(1,36): error TS2322: Type '({ id: number; } | number)[]' is not assignable to type '{ id: number; }[]'.
|
||||
Type '{ id: number; } | number' is not assignable to type '{ id: number; }'.
|
||||
tests/cases/compiler/contextualTyping21.ts(1,36): error TS2322: Type '(number | { id: number; })[]' is not assignable to type '{ id: number; }[]'.
|
||||
Type 'number | { id: number; }' is not assignable to type '{ id: number; }'.
|
||||
Type 'number' is not assignable to type '{ id: number; }'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/contextualTyping21.ts (1 errors) ====
|
||||
var foo:{id:number;}[] = [{id:1}]; foo = [{id:1}, 1];
|
||||
~~~
|
||||
!!! error TS2322: Type '({ id: number; } | number)[]' is not assignable to type '{ id: number; }[]'.
|
||||
!!! error TS2322: Type '{ id: number; } | number' is not assignable to type '{ id: number; }'.
|
||||
!!! error TS2322: Type '(number | { id: number; })[]' is not assignable to type '{ id: number; }[]'.
|
||||
!!! error TS2322: Type 'number | { id: number; }' is not assignable to type '{ id: number; }'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type '{ id: number; }'.
|
||||
@@ -1,11 +1,11 @@
|
||||
tests/cases/compiler/contextualTyping30.ts(1,37): error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'.
|
||||
Type 'number | string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/contextualTyping30.ts(1,37): error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'.
|
||||
Type 'string | number' is not assignable to type 'number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/contextualTyping30.ts (1 errors) ====
|
||||
function foo(param:number[]){}; foo([1, "a"]);
|
||||
~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'.
|
||||
!!! error TS2345: Type 'number | string' is not assignable to type 'number'.
|
||||
!!! error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'.
|
||||
!!! error TS2345: Type 'string | number' is not assignable to type 'number'.
|
||||
!!! error TS2345: Type 'string' is not assignable to type 'number'.
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/compiler/contextualTypingOfArrayLiterals1.ts(5,5): error TS2322: Type '(Date | number)[]' is not assignable to type 'I'.
|
||||
tests/cases/compiler/contextualTypingOfArrayLiterals1.ts(5,5): error TS2322: Type '(number | Date)[]' is not assignable to type 'I'.
|
||||
Index signatures are incompatible.
|
||||
Type 'Date | number' is not assignable to type 'Date'.
|
||||
Type 'number | Date' is not assignable to type 'Date'.
|
||||
Type 'number' is not assignable to type 'Date'.
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@ tests/cases/compiler/contextualTypingOfArrayLiterals1.ts(5,5): error TS2322: Typ
|
||||
|
||||
var x3: I = [new Date(), 1];
|
||||
~~
|
||||
!!! error TS2322: Type '(Date | number)[]' is not assignable to type 'I'.
|
||||
!!! error TS2322: Type '(number | Date)[]' is not assignable to type 'I'.
|
||||
!!! error TS2322: Index signatures are incompatible.
|
||||
!!! error TS2322: Type 'Date | number' is not assignable to type 'Date'.
|
||||
!!! error TS2322: Type 'number | Date' is not assignable to type 'Date'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'Date'.
|
||||
var r2 = x3[1];
|
||||
r2.getDate();
|
||||
|
||||
@@ -119,18 +119,18 @@
|
||||
|
||||
((...mixed) => mixed.every(n => !!n))(5,'oops','oh no');
|
||||
>((...mixed) => mixed.every(n => !!n))(5,'oops','oh no') : boolean
|
||||
>((...mixed) => mixed.every(n => !!n)) : (...mixed: (number | string)[]) => boolean
|
||||
>(...mixed) => mixed.every(n => !!n) : (...mixed: (number | string)[]) => boolean
|
||||
>mixed : (number | string)[]
|
||||
>((...mixed) => mixed.every(n => !!n)) : (...mixed: (string | number)[]) => boolean
|
||||
>(...mixed) => mixed.every(n => !!n) : (...mixed: (string | number)[]) => boolean
|
||||
>mixed : (string | number)[]
|
||||
>mixed.every(n => !!n) : boolean
|
||||
>mixed.every : (callbackfn: (value: number | string, index: number, array: (number | string)[]) => boolean, thisArg?: any) => boolean
|
||||
>mixed : (number | string)[]
|
||||
>every : (callbackfn: (value: number | string, index: number, array: (number | string)[]) => boolean, thisArg?: any) => boolean
|
||||
>n => !!n : (n: number | string) => boolean
|
||||
>n : number | string
|
||||
>mixed.every : (callbackfn: (value: string | number, index: number, array: (string | number)[]) => boolean, thisArg?: any) => boolean
|
||||
>mixed : (string | number)[]
|
||||
>every : (callbackfn: (value: string | number, index: number, array: (string | number)[]) => boolean, thisArg?: any) => boolean
|
||||
>n => !!n : (n: string | number) => boolean
|
||||
>n : string | number
|
||||
>!!n : boolean
|
||||
>!n : boolean
|
||||
>n : number | string
|
||||
>n : string | number
|
||||
>5 : number
|
||||
>'oops' : string
|
||||
>'oh no' : string
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
=== tests/cases/conformance/controlFlow/controlFlowAssignmentExpression.ts ===
|
||||
let x: string | boolean | number;
|
||||
>x : string | boolean | number
|
||||
>x : string | number | boolean
|
||||
|
||||
let obj: any;
|
||||
>obj : any
|
||||
|
||||
x = "";
|
||||
>x = "" : string
|
||||
>x : string | boolean | number
|
||||
>x : string | number | boolean
|
||||
>"" : string
|
||||
|
||||
x = x.length;
|
||||
>x = x.length : number
|
||||
>x : string | boolean | number
|
||||
>x : string | number | boolean
|
||||
>x.length : number
|
||||
>x : string
|
||||
>length : number
|
||||
@@ -22,7 +22,7 @@ x; // number
|
||||
|
||||
x = true;
|
||||
>x = true : boolean
|
||||
>x : string | boolean | number
|
||||
>x : string | number | boolean
|
||||
>true : boolean
|
||||
|
||||
(x = "", obj).foo = (x = x.length);
|
||||
@@ -31,13 +31,13 @@ x = true;
|
||||
>(x = "", obj) : any
|
||||
>x = "", obj : any
|
||||
>x = "" : string
|
||||
>x : string | boolean | number
|
||||
>x : string | number | boolean
|
||||
>"" : string
|
||||
>obj : any
|
||||
>foo : any
|
||||
>(x = x.length) : number
|
||||
>x = x.length : number
|
||||
>x : string | boolean | number
|
||||
>x : string | number | boolean
|
||||
>x.length : number
|
||||
>x : string
|
||||
>length : number
|
||||
|
||||
@@ -64,9 +64,9 @@ if (isNodeList(sourceObj)) {
|
||||
>sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 23, 3))
|
||||
|
||||
sourceObj.length;
|
||||
>sourceObj.length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 14, 33), Decl(controlFlowBinaryOrExpression.ts, 10, 27))
|
||||
>sourceObj.length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 10, 27), Decl(controlFlowBinaryOrExpression.ts, 14, 33))
|
||||
>sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 23, 3))
|
||||
>length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 14, 33), Decl(controlFlowBinaryOrExpression.ts, 10, 27))
|
||||
>length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 10, 27), Decl(controlFlowBinaryOrExpression.ts, 14, 33))
|
||||
}
|
||||
|
||||
if (isHTMLCollection(sourceObj)) {
|
||||
@@ -74,9 +74,9 @@ if (isHTMLCollection(sourceObj)) {
|
||||
>sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 23, 3))
|
||||
|
||||
sourceObj.length;
|
||||
>sourceObj.length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 14, 33), Decl(controlFlowBinaryOrExpression.ts, 10, 27))
|
||||
>sourceObj.length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 10, 27), Decl(controlFlowBinaryOrExpression.ts, 14, 33))
|
||||
>sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 23, 3))
|
||||
>length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 14, 33), Decl(controlFlowBinaryOrExpression.ts, 10, 27))
|
||||
>length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 10, 27), Decl(controlFlowBinaryOrExpression.ts, 14, 33))
|
||||
}
|
||||
|
||||
if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) {
|
||||
@@ -86,8 +86,8 @@ if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) {
|
||||
>sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 23, 3))
|
||||
|
||||
sourceObj.length;
|
||||
>sourceObj.length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 14, 33), Decl(controlFlowBinaryOrExpression.ts, 10, 27))
|
||||
>sourceObj.length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 10, 27), Decl(controlFlowBinaryOrExpression.ts, 14, 33))
|
||||
>sourceObj : Symbol(sourceObj, Decl(controlFlowBinaryOrExpression.ts, 23, 3))
|
||||
>length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 14, 33), Decl(controlFlowBinaryOrExpression.ts, 10, 27))
|
||||
>length : Symbol(length, Decl(controlFlowBinaryOrExpression.ts, 10, 27), Decl(controlFlowBinaryOrExpression.ts, 14, 33))
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ x = "";
|
||||
>"" : string
|
||||
|
||||
cond || (x = 0);
|
||||
>cond || (x = 0) : true | number
|
||||
>cond || (x = 0) : number | true
|
||||
>cond : boolean
|
||||
>(x = 0) : number
|
||||
>x = 0 : number
|
||||
@@ -62,36 +62,36 @@ declare function isHTMLCollection(sourceObj: any): sourceObj is HTMLCollection;
|
||||
>HTMLCollection : HTMLCollection
|
||||
|
||||
type EventTargetLike = {a: string} | HTMLCollection | NodeList;
|
||||
>EventTargetLike : { a: string; } | HTMLCollection | NodeList
|
||||
>EventTargetLike : NodeList | HTMLCollection | { a: string; }
|
||||
>a : string
|
||||
>HTMLCollection : HTMLCollection
|
||||
>NodeList : NodeList
|
||||
|
||||
var sourceObj: EventTargetLike = <any>undefined;
|
||||
>sourceObj : { a: string; } | HTMLCollection | NodeList
|
||||
>EventTargetLike : { a: string; } | HTMLCollection | NodeList
|
||||
>sourceObj : NodeList | HTMLCollection | { a: string; }
|
||||
>EventTargetLike : NodeList | HTMLCollection | { a: string; }
|
||||
><any>undefined : any
|
||||
>undefined : undefined
|
||||
|
||||
if (isNodeList(sourceObj)) {
|
||||
>isNodeList(sourceObj) : boolean
|
||||
>isNodeList : (sourceObj: any) => sourceObj is NodeList
|
||||
>sourceObj : { a: string; } | HTMLCollection | NodeList
|
||||
>sourceObj : NodeList | HTMLCollection | { a: string; }
|
||||
|
||||
sourceObj.length;
|
||||
>sourceObj.length : number
|
||||
>sourceObj : HTMLCollection | NodeList
|
||||
>sourceObj : NodeList | HTMLCollection
|
||||
>length : number
|
||||
}
|
||||
|
||||
if (isHTMLCollection(sourceObj)) {
|
||||
>isHTMLCollection(sourceObj) : boolean
|
||||
>isHTMLCollection : (sourceObj: any) => sourceObj is HTMLCollection
|
||||
>sourceObj : HTMLCollection | NodeList | { a: string; }
|
||||
>sourceObj : NodeList | HTMLCollection | { a: string; }
|
||||
|
||||
sourceObj.length;
|
||||
>sourceObj.length : number
|
||||
>sourceObj : HTMLCollection | NodeList
|
||||
>sourceObj : NodeList | HTMLCollection
|
||||
>length : number
|
||||
}
|
||||
|
||||
@@ -99,14 +99,14 @@ if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) {
|
||||
>isNodeList(sourceObj) || isHTMLCollection(sourceObj) : boolean
|
||||
>isNodeList(sourceObj) : boolean
|
||||
>isNodeList : (sourceObj: any) => sourceObj is NodeList
|
||||
>sourceObj : HTMLCollection | NodeList | { a: string; }
|
||||
>sourceObj : NodeList | HTMLCollection | { a: string; }
|
||||
>isHTMLCollection(sourceObj) : boolean
|
||||
>isHTMLCollection : (sourceObj: any) => sourceObj is HTMLCollection
|
||||
>sourceObj : { a: string; }
|
||||
|
||||
sourceObj.length;
|
||||
>sourceObj.length : number
|
||||
>sourceObj : HTMLCollection | NodeList | ({ a: string; } & HTMLCollection)
|
||||
>sourceObj : NodeList | HTMLCollection | ({ a: string; } & HTMLCollection)
|
||||
>length : number
|
||||
}
|
||||
|
||||
@@ -66,6 +66,6 @@ function f(x: string | number | boolean) {
|
||||
>y : string
|
||||
|
||||
z; // number | boolean
|
||||
>z : boolean | number
|
||||
>z : number | boolean
|
||||
}
|
||||
|
||||
@@ -4,76 +4,76 @@ function f() {
|
||||
>f : () => void
|
||||
|
||||
let x: { a?: number | string, b: number | string } = { b: 1 };
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>a : number | string | undefined
|
||||
>b : number | string
|
||||
>x : { a?: string | number | undefined; b: string | number; }
|
||||
>a : string | number | undefined
|
||||
>b : string | number
|
||||
>{ b: 1 } : { b: number; }
|
||||
>b : number
|
||||
>1 : number
|
||||
|
||||
x.a;
|
||||
>x.a : number | string | undefined
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>a : number | string | undefined
|
||||
>x.a : string | number | undefined
|
||||
>x : { a?: string | number | undefined; b: string | number; }
|
||||
>a : string | number | undefined
|
||||
|
||||
x.b;
|
||||
>x.b : number | string
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>b : number | string
|
||||
>x.b : string | number
|
||||
>x : { a?: string | number | undefined; b: string | number; }
|
||||
>b : string | number
|
||||
|
||||
x.a = 1;
|
||||
>x.a = 1 : number
|
||||
>x.a : number | string | undefined
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>a : number | string | undefined
|
||||
>x.a : string | number | undefined
|
||||
>x : { a?: string | number | undefined; b: string | number; }
|
||||
>a : string | number | undefined
|
||||
>1 : number
|
||||
|
||||
x.b = 1;
|
||||
>x.b = 1 : number
|
||||
>x.b : number | string
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>b : number | string
|
||||
>x.b : string | number
|
||||
>x : { a?: string | number | undefined; b: string | number; }
|
||||
>b : string | number
|
||||
>1 : number
|
||||
|
||||
x.a;
|
||||
>x.a : number
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>x : { a?: string | number | undefined; b: string | number; }
|
||||
>a : number
|
||||
|
||||
x.b;
|
||||
>x.b : number
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>x : { a?: string | number | undefined; b: string | number; }
|
||||
>b : number
|
||||
|
||||
delete x.a;
|
||||
>delete x.a : boolean
|
||||
>x.a : number
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>x : { a?: string | number | undefined; b: string | number; }
|
||||
>a : number
|
||||
|
||||
delete x.b;
|
||||
>delete x.b : boolean
|
||||
>x.b : number
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>x : { a?: string | number | undefined; b: string | number; }
|
||||
>b : number
|
||||
|
||||
x.a;
|
||||
>x.a : undefined
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>x : { a?: string | number | undefined; b: string | number; }
|
||||
>a : undefined
|
||||
|
||||
x.b;
|
||||
>x.b : number | string
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>b : number | string
|
||||
>x.b : string | number
|
||||
>x : { a?: string | number | undefined; b: string | number; }
|
||||
>b : string | number
|
||||
|
||||
x;
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>x : { a?: string | number | undefined; b: string | number; }
|
||||
|
||||
delete x; // No effect
|
||||
>delete x : boolean
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>x : { a?: string | number | undefined; b: string | number; }
|
||||
|
||||
x;
|
||||
>x : { a?: number | string | undefined; b: number | string; }
|
||||
>x : { a?: string | number | undefined; b: string | number; }
|
||||
}
|
||||
@@ -131,13 +131,13 @@ function f() {
|
||||
>f : () => void
|
||||
|
||||
let x: string | number | boolean | RegExp | Function;
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>RegExp : RegExp
|
||||
>Function : Function
|
||||
|
||||
x = "";
|
||||
>x = "" : string
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>"" : string
|
||||
|
||||
do {
|
||||
@@ -146,7 +146,7 @@ function f() {
|
||||
|
||||
x = 42;
|
||||
>x = 42 : number
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>42 : number
|
||||
|
||||
break;
|
||||
@@ -156,14 +156,14 @@ function f() {
|
||||
|
||||
x = true;
|
||||
>x = true : boolean
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>true : boolean
|
||||
|
||||
continue;
|
||||
}
|
||||
x = /a/;
|
||||
>x = /a/ : RegExp
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>/a/ : RegExp
|
||||
|
||||
} while (cond)
|
||||
@@ -176,13 +176,13 @@ function g() {
|
||||
>g : () => void
|
||||
|
||||
let x: string | number | boolean | RegExp | Function;
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>RegExp : RegExp
|
||||
>Function : Function
|
||||
|
||||
x = "";
|
||||
>x = "" : string
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>"" : string
|
||||
|
||||
do {
|
||||
@@ -191,7 +191,7 @@ function g() {
|
||||
|
||||
x = 42;
|
||||
>x = 42 : number
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>42 : number
|
||||
|
||||
break;
|
||||
@@ -201,14 +201,14 @@ function g() {
|
||||
|
||||
x = true;
|
||||
>x = true : boolean
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>true : boolean
|
||||
|
||||
continue;
|
||||
}
|
||||
x = /a/;
|
||||
>x = /a/ : RegExp
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>/a/ : RegExp
|
||||
|
||||
} while (true)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=== tests/cases/conformance/controlFlow/controlFlowForInStatement.ts ===
|
||||
let x: string | number | boolean | RegExp | Function;
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>RegExp : RegExp
|
||||
>Function : Function
|
||||
|
||||
@@ -12,7 +12,7 @@ let cond: boolean;
|
||||
|
||||
x = /a/;
|
||||
>x = /a/ : RegExp
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>/a/ : RegExp
|
||||
|
||||
for (let y in obj) {
|
||||
@@ -21,7 +21,7 @@ for (let y in obj) {
|
||||
|
||||
x = y;
|
||||
>x = y : string
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>y : string
|
||||
|
||||
if (cond) {
|
||||
@@ -29,7 +29,7 @@ for (let y in obj) {
|
||||
|
||||
x = 42;
|
||||
>x = 42 : number
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>42 : number
|
||||
|
||||
continue;
|
||||
@@ -39,12 +39,12 @@ for (let y in obj) {
|
||||
|
||||
x = true;
|
||||
>x = true : boolean
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>true : boolean
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
x; // RegExp | string | number | boolean
|
||||
>x : RegExp | number | string | boolean
|
||||
>x : string | number | boolean | RegExp
|
||||
|
||||
@@ -27,6 +27,6 @@ function a() {
|
||||
>toExponential : (fractionDigits?: number) => string
|
||||
}
|
||||
x; // string | boolean
|
||||
>x : boolean | string
|
||||
>x : string | boolean
|
||||
}
|
||||
|
||||
@@ -316,9 +316,9 @@ export class HTMLtoJSX {
|
||||
>'{' + JSON.stringify(whitespace) : string
|
||||
>'{' : string
|
||||
>JSON.stringify(whitespace) : string
|
||||
>JSON.stringify : { (value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; (value: any, replacer?: (number | string)[], space?: string | number): string; }
|
||||
>JSON.stringify : { (value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; (value: any, replacer?: (string | number)[], space?: string | number): string; }
|
||||
>JSON : JSON
|
||||
>stringify : { (value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; (value: any, replacer?: (number | string)[], space?: string | number): string; }
|
||||
>stringify : { (value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; (value: any, replacer?: (string | number)[], space?: string | number): string; }
|
||||
>whitespace : string
|
||||
>'}' : string
|
||||
|
||||
|
||||
@@ -135,13 +135,13 @@ function f() {
|
||||
>f : () => void
|
||||
|
||||
let x: string | number | boolean | RegExp | Function;
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>RegExp : RegExp
|
||||
>Function : Function
|
||||
|
||||
x = "";
|
||||
>x = "" : string
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>"" : string
|
||||
|
||||
while (cond) {
|
||||
@@ -152,7 +152,7 @@ function f() {
|
||||
|
||||
x = 42;
|
||||
>x = 42 : number
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>42 : number
|
||||
|
||||
break;
|
||||
@@ -162,30 +162,30 @@ function f() {
|
||||
|
||||
x = true;
|
||||
>x = true : boolean
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>true : boolean
|
||||
|
||||
continue;
|
||||
}
|
||||
x = /a/;
|
||||
>x = /a/ : RegExp
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>/a/ : RegExp
|
||||
}
|
||||
x; // string | number | boolean | RegExp
|
||||
>x : string | boolean | RegExp | number
|
||||
>x : string | number | boolean | RegExp
|
||||
}
|
||||
function g() {
|
||||
>g : () => void
|
||||
|
||||
let x: string | number | boolean | RegExp | Function;
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>RegExp : RegExp
|
||||
>Function : Function
|
||||
|
||||
x = "";
|
||||
>x = "" : string
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>"" : string
|
||||
|
||||
while (true) {
|
||||
@@ -196,7 +196,7 @@ function g() {
|
||||
|
||||
x = 42;
|
||||
>x = 42 : number
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>42 : number
|
||||
|
||||
break;
|
||||
@@ -206,14 +206,14 @@ function g() {
|
||||
|
||||
x = true;
|
||||
>x = true : boolean
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>true : boolean
|
||||
|
||||
continue;
|
||||
}
|
||||
x = /a/;
|
||||
>x = /a/ : RegExp
|
||||
>x : string | number | boolean | RegExp | Function
|
||||
>x : string | number | boolean | Function | RegExp
|
||||
>/a/ : RegExp
|
||||
}
|
||||
x; // number
|
||||
|
||||
@@ -29,4 +29,4 @@ declare class c {
|
||||
declare var x: (() => c)[];
|
||||
declare var y: (() => c)[];
|
||||
declare var k: (() => c) | string;
|
||||
declare var l: (() => c) | string;
|
||||
declare var l: string | (() => c);
|
||||
@@ -23,9 +23,9 @@ var y = [() => new c()];
|
||||
>c : typeof c
|
||||
|
||||
var k: (() => c) | string = (() => new c()) || "";
|
||||
>k : (() => c) | string
|
||||
>k : string | (() => c)
|
||||
>c : c
|
||||
>(() => new c()) || "" : (() => c) | string
|
||||
>(() => new c()) || "" : string | (() => c)
|
||||
>(() => new c()) : () => c
|
||||
>() => new c() : () => c
|
||||
>new c() : c
|
||||
@@ -33,8 +33,8 @@ var k: (() => c) | string = (() => new c()) || "";
|
||||
>"" : string
|
||||
|
||||
var l = (() => new c()) || "";
|
||||
>l : (() => c) | string
|
||||
>(() => new c()) || "" : (() => c) | string
|
||||
>l : string | (() => c)
|
||||
>(() => new c()) || "" : string | (() => c)
|
||||
>(() => new c()) : () => c
|
||||
>() => new c() : () => c
|
||||
>new c() : c
|
||||
|
||||
@@ -47,7 +47,7 @@ module M {
|
||||
>M : typeof M
|
||||
|
||||
export type W = Window | string;
|
||||
>W : Window | string
|
||||
>W : string | Window
|
||||
>Window : Window
|
||||
|
||||
export module N {
|
||||
@@ -57,7 +57,7 @@ module M {
|
||||
>Window : Window
|
||||
|
||||
export var p: W;
|
||||
>p : Window | string
|
||||
>W : Window | string
|
||||
>p : string | Window
|
||||
>W : string | Window
|
||||
}
|
||||
}
|
||||
@@ -15,4 +15,4 @@ function foo(_a) {
|
||||
|
||||
//// [declarationEmitDestructuring3.d.ts]
|
||||
declare function bar([x, z, ...w]: any[]): void;
|
||||
declare function foo([x, ...y]?: (number | string | boolean)[]): void;
|
||||
declare function foo([x, ...y]?: (string | number | boolean)[]): void;
|
||||
@@ -6,10 +6,10 @@ function bar([x, z, ...w]) { }
|
||||
>w : any[]
|
||||
|
||||
function foo([x, ...y] = [1, "string", true]) { }
|
||||
>foo : ([x, ...y]?: (number | string | boolean)[]) => void
|
||||
>x : number | string | boolean
|
||||
>y : (number | string | boolean)[]
|
||||
>[1, "string", true] : (number | string | boolean)[]
|
||||
>foo : ([x, ...y]?: (string | number | boolean)[]) => void
|
||||
>x : string | number | boolean
|
||||
>y : (string | number | boolean)[]
|
||||
>[1, "string", true] : (string | number | boolean)[]
|
||||
>1 : number
|
||||
>"string" : string
|
||||
>true : boolean
|
||||
|
||||
@@ -23,6 +23,6 @@ var x3 = a[0], y3 = a[1], z3 = a[2]; // emit x3, y3, z3
|
||||
declare var x: number;
|
||||
declare var x1: number, y1: string;
|
||||
declare var z1: number;
|
||||
declare var a: (number | string)[];
|
||||
declare var x2: number | string;
|
||||
declare var x3: number | string, y3: number | string, z3: number | string;
|
||||
declare var a: (string | number)[];
|
||||
declare var x2: string | number;
|
||||
declare var x3: string | number, y3: string | number, z3: string | number;
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/compiler/declarationEmitDestructuringArrayPattern1.ts ===
|
||||
|
||||
var [] = [1, "hello"]; // Dont emit anything
|
||||
>[1, "hello"] : (number | string)[]
|
||||
>[1, "hello"] : (string | number)[]
|
||||
>1 : number
|
||||
>"hello" : string
|
||||
|
||||
@@ -28,18 +28,18 @@ var [, , z1] = [0, 1, 2]; // emit z1: number
|
||||
>2 : number
|
||||
|
||||
var a = [1, "hello"];
|
||||
>a : (number | string)[]
|
||||
>[1, "hello"] : (number | string)[]
|
||||
>a : (string | number)[]
|
||||
>[1, "hello"] : (string | number)[]
|
||||
>1 : number
|
||||
>"hello" : string
|
||||
|
||||
var [x2] = a; // emit x2: number | string
|
||||
>x2 : number | string
|
||||
>a : (number | string)[]
|
||||
>x2 : string | number
|
||||
>a : (string | number)[]
|
||||
|
||||
var [x3, y3, z3] = a; // emit x3, y3, z3
|
||||
>x3 : number | string
|
||||
>y3 : number | string
|
||||
>z3 : number | string
|
||||
>a : (number | string)[]
|
||||
>x3 : string | number
|
||||
>y3 : string | number
|
||||
>z3 : string | number
|
||||
>a : (string | number)[]
|
||||
|
||||
@@ -25,7 +25,7 @@ declare var x11: number, y11: string;
|
||||
declare var a11: any, b11: any, c11: any;
|
||||
declare var a2: number, b2: string, x12: number, c2: boolean;
|
||||
declare var x13: number, y13: string;
|
||||
declare var a3: (number | string)[], b3: {
|
||||
declare var a3: (string | number)[], b3: {
|
||||
x: number;
|
||||
y: string;
|
||||
};
|
||||
@@ -25,7 +25,7 @@ declare var a5: number[];
|
||||
declare var x14: number, a6: number[];
|
||||
declare var x15: number, y15: number, a7: number[];
|
||||
declare var x16: number, y16: number, z16: number, a8: number[];
|
||||
declare var a9: (number | string | boolean)[];
|
||||
declare var x17: number | string | boolean, a10: (number | string | boolean)[];
|
||||
declare var x18: number | string | boolean, y18: number | string | boolean, a12: (number | string | boolean)[];
|
||||
declare var x19: number | string | boolean, y19: number | string | boolean, z19: number | string | boolean, a13: (number | string | boolean)[];
|
||||
declare var a9: (string | number | boolean)[];
|
||||
declare var x17: string | number | boolean, a10: (string | number | boolean)[];
|
||||
declare var x18: string | number | boolean, y18: string | number | boolean, a12: (string | number | boolean)[];
|
||||
declare var x19: string | number | boolean, y19: string | number | boolean, z19: string | number | boolean, a13: (string | number | boolean)[];
|
||||
@@ -34,35 +34,35 @@ var [x16, y16, z16, ...a8] = [1, 2, 3];
|
||||
>3 : number
|
||||
|
||||
var [...a9] = [1, "hello", true];
|
||||
>a9 : (number | string | boolean)[]
|
||||
>[1, "hello", true] : (number | string | boolean)[]
|
||||
>a9 : (string | number | boolean)[]
|
||||
>[1, "hello", true] : (string | number | boolean)[]
|
||||
>1 : number
|
||||
>"hello" : string
|
||||
>true : boolean
|
||||
|
||||
var [x17, ...a10] = [1, "hello", true];
|
||||
>x17 : number | string | boolean
|
||||
>a10 : (number | string | boolean)[]
|
||||
>[1, "hello", true] : (number | string | boolean)[]
|
||||
>x17 : string | number | boolean
|
||||
>a10 : (string | number | boolean)[]
|
||||
>[1, "hello", true] : (string | number | boolean)[]
|
||||
>1 : number
|
||||
>"hello" : string
|
||||
>true : boolean
|
||||
|
||||
var [x18, y18, ...a12] = [1, "hello", true];
|
||||
>x18 : number | string | boolean
|
||||
>y18 : number | string | boolean
|
||||
>a12 : (number | string | boolean)[]
|
||||
>[1, "hello", true] : (number | string | boolean)[]
|
||||
>x18 : string | number | boolean
|
||||
>y18 : string | number | boolean
|
||||
>a12 : (string | number | boolean)[]
|
||||
>[1, "hello", true] : (string | number | boolean)[]
|
||||
>1 : number
|
||||
>"hello" : string
|
||||
>true : boolean
|
||||
|
||||
var [x19, y19, z19, ...a13] = [1, "hello", true];
|
||||
>x19 : number | string | boolean
|
||||
>y19 : number | string | boolean
|
||||
>z19 : number | string | boolean
|
||||
>a13 : (number | string | boolean)[]
|
||||
>[1, "hello", true] : (number | string | boolean)[]
|
||||
>x19 : string | number | boolean
|
||||
>y19 : string | number | boolean
|
||||
>z19 : string | number | boolean
|
||||
>a13 : (string | number | boolean)[]
|
||||
>[1, "hello", true] : (string | number | boolean)[]
|
||||
>1 : number
|
||||
>"hello" : string
|
||||
>true : boolean
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsAmd/a.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
|
||||
@decorator
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
|
||||
export default class Foo {}
|
||||
>Foo : Foo
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsAmd/b.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
|
||||
@decorator
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
|
||||
export default class {}
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsCommonjs/a.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
|
||||
@decorator
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
|
||||
export default class Foo {}
|
||||
>Foo : Foo
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsCommonjs/b.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
|
||||
@decorator
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
|
||||
export default class {}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsSystem/a.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
|
||||
@decorator
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
|
||||
export default class Foo {}
|
||||
>Foo : Foo
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsSystem/b.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
|
||||
@decorator
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
|
||||
export default class {}
|
||||
@@ -1,21 +1,21 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsUmd/a.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
|
||||
@decorator
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
|
||||
export default class Foo {}
|
||||
>Foo : Foo
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsUmd/b.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
|
||||
@decorator
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
|
||||
export default class {}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
=== tests/cases/compiler/decoratorMetadataPromise.ts ===
|
||||
|
||||
declare const decorator: MethodDecorator;
|
||||
>decorator : <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void
|
||||
>MethodDecorator : <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void
|
||||
>decorator : <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => void | TypedPropertyDescriptor<T>
|
||||
>MethodDecorator : <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => void | TypedPropertyDescriptor<T>
|
||||
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
@decorator
|
||||
>decorator : <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void
|
||||
>decorator : <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => void | TypedPropertyDescriptor<T>
|
||||
|
||||
async foo() {}
|
||||
>foo : () => Promise<void>
|
||||
|
||||
@decorator
|
||||
>decorator : <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void
|
||||
>decorator : <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => void | TypedPropertyDescriptor<T>
|
||||
|
||||
async bar(): Promise<number> { return 0; }
|
||||
>bar : () => Promise<number>
|
||||
@@ -22,7 +22,7 @@ class A {
|
||||
>0 : number
|
||||
|
||||
@decorator
|
||||
>decorator : <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void
|
||||
>decorator : <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => void | TypedPropertyDescriptor<T>
|
||||
|
||||
baz(n: Promise<number>): Promise<number> { return n; }
|
||||
>baz : (n: Promise<number>) => Promise<number>
|
||||
|
||||
@@ -40,7 +40,7 @@ interface QueryMetadataFactory {
|
||||
>QueryMetadataFactory : QueryMetadataFactory
|
||||
|
||||
(selector: Type | string, {descendants, read}?: {
|
||||
>selector : Type | string
|
||||
>selector : string | Type
|
||||
>Type : Type
|
||||
>descendants : boolean | undefined
|
||||
>read : any
|
||||
@@ -55,7 +55,7 @@ interface QueryMetadataFactory {
|
||||
>ParameterDecorator : (target: Object, propertyKey: string | symbol, parameterIndex: number) => void
|
||||
|
||||
new (selector: Type | string, {descendants, read}?: {
|
||||
>selector : Type | string
|
||||
>selector : string | Type
|
||||
>Type : Type
|
||||
>descendants : boolean | undefined
|
||||
>read : any
|
||||
|
||||
@@ -4,8 +4,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(7,29): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(8,4): error TS2345: Argument of type '[number, number, string[][], string]' is not assignable to parameter of type '[number, number, string[][]]'.
|
||||
Types of property 'pop' are incompatible.
|
||||
Type '() => number | string[][] | string' is not assignable to type '() => number | string[][]'.
|
||||
Type 'number | string[][] | string' is not assignable to type 'number | string[][]'.
|
||||
Type '() => string | number | string[][]' is not assignable to type '() => number | string[][]'.
|
||||
Type 'string | number | string[][]' is not assignable to type 'number | string[][]'.
|
||||
Type 'string' is not assignable to type 'number | string[][]'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(16,8): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(16,16): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
||||
@@ -25,9 +25,9 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(37,4): error TS2345: Argument of type '{ z: boolean; }' is not assignable to parameter of type '{ z?: number; }'.
|
||||
Types of property 'z' are incompatible.
|
||||
Type 'boolean' is not assignable to type 'number'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(38,4): error TS2345: Argument of type '{ b: boolean; }' is not assignable to parameter of type '{ b: number | string; }'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(38,4): error TS2345: Argument of type '{ b: boolean; }' is not assignable to parameter of type '{ b: string | number; }'.
|
||||
Types of property 'b' are incompatible.
|
||||
Type 'boolean' is not assignable to type 'number | string'.
|
||||
Type 'boolean' is not assignable to type 'string | number'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(39,4): error TS2345: Argument of type '[number, number, boolean, boolean]' is not assignable to parameter of type '[any, any, [[any]]]'.
|
||||
Types of property '2' are incompatible.
|
||||
Type 'boolean' is not assignable to type '[[any]]'.
|
||||
@@ -70,8 +70,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '[number, number, string[][], string]' is not assignable to parameter of type '[number, number, string[][]]'.
|
||||
!!! error TS2345: Types of property 'pop' are incompatible.
|
||||
!!! error TS2345: Type '() => number | string[][] | string' is not assignable to type '() => number | string[][]'.
|
||||
!!! error TS2345: Type 'number | string[][] | string' is not assignable to type 'number | string[][]'.
|
||||
!!! error TS2345: Type '() => string | number | string[][]' is not assignable to type '() => number | string[][]'.
|
||||
!!! error TS2345: Type 'string | number | string[][]' is not assignable to type 'number | string[][]'.
|
||||
!!! error TS2345: Type 'string' is not assignable to type 'number | string[][]'.
|
||||
|
||||
|
||||
@@ -131,9 +131,9 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration2.ts(
|
||||
!!! error TS2345: Type 'boolean' is not assignable to type 'number'.
|
||||
c3({ b: true }); // Error, implied type is { b: number|string }.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '{ b: boolean; }' is not assignable to parameter of type '{ b: number | string; }'.
|
||||
!!! error TS2345: Argument of type '{ b: boolean; }' is not assignable to parameter of type '{ b: string | number; }'.
|
||||
!!! error TS2345: Types of property 'b' are incompatible.
|
||||
!!! error TS2345: Type 'boolean' is not assignable to type 'number | string'.
|
||||
!!! error TS2345: Type 'boolean' is not assignable to type 'string | number'.
|
||||
c5([1, 2, false, true]); // Error, implied type is [any, any, [[any]]]
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '[number, number, boolean, boolean]' is not assignable to parameter of type '[any, any, [[any]]]'.
|
||||
|
||||
@@ -23,8 +23,8 @@ type stringOrNumArray = Array<String|Number>;
|
||||
>Number : Number
|
||||
|
||||
function a1(...x: (number|string)[]) { }
|
||||
>a1 : (...x: (number | string)[]) => void
|
||||
>x : (number | string)[]
|
||||
>a1 : (...x: (string | number)[]) => void
|
||||
>x : (string | number)[]
|
||||
|
||||
function a2(...a) { }
|
||||
>a2 : (...a: any[]) => void
|
||||
@@ -75,8 +75,8 @@ var array = [1, 2, 3];
|
||||
>3 : number
|
||||
|
||||
var array2 = [true, false, "hello"];
|
||||
>array2 : (boolean | string)[]
|
||||
>[true, false, "hello"] : (boolean | string)[]
|
||||
>array2 : (string | boolean)[]
|
||||
>[true, false, "hello"] : (string | boolean)[]
|
||||
>true : boolean
|
||||
>false : boolean
|
||||
>"hello" : string
|
||||
@@ -90,7 +90,7 @@ a2([...array]);
|
||||
|
||||
a1(...array);
|
||||
>a1(...array) : void
|
||||
>a1 : (...x: (number | string)[]) => void
|
||||
>a1 : (...x: (string | number)[]) => void
|
||||
>...array : number
|
||||
>array : number[]
|
||||
|
||||
@@ -109,7 +109,7 @@ a9([1, 2, [["string"]], false, true]); // Parameter type is [any, any, [[any]]
|
||||
a10([1, 2, [["string"]], false, true]); // Parameter type is any[]
|
||||
>a10([1, 2, [["string"]], false, true]) : void
|
||||
>a10 : ([a, b, [[c]], ...x]: Iterable<any>) => void
|
||||
>[1, 2, [["string"]], false, true] : (number | string[][] | boolean)[]
|
||||
>[1, 2, [["string"]], false, true] : (number | boolean | string[][])[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>[["string"]] : string[][]
|
||||
|
||||
@@ -23,8 +23,8 @@ type stringOrNumArray = Array<String|Number>;
|
||||
>Number : Number
|
||||
|
||||
function a1(...x: (number|string)[]) { }
|
||||
>a1 : (...x: (number | string)[]) => void
|
||||
>x : (number | string)[]
|
||||
>a1 : (...x: (string | number)[]) => void
|
||||
>x : (string | number)[]
|
||||
|
||||
function a2(...a) { }
|
||||
>a2 : (...a: any[]) => void
|
||||
@@ -75,8 +75,8 @@ var array = [1, 2, 3];
|
||||
>3 : number
|
||||
|
||||
var array2 = [true, false, "hello"];
|
||||
>array2 : (boolean | string)[]
|
||||
>[true, false, "hello"] : (boolean | string)[]
|
||||
>array2 : (string | boolean)[]
|
||||
>[true, false, "hello"] : (string | boolean)[]
|
||||
>true : boolean
|
||||
>false : boolean
|
||||
>"hello" : string
|
||||
@@ -90,7 +90,7 @@ a2([...array]);
|
||||
|
||||
a1(...array);
|
||||
>a1(...array) : void
|
||||
>a1 : (...x: (number | string)[]) => void
|
||||
>a1 : (...x: (string | number)[]) => void
|
||||
>...array : number
|
||||
>array : number[]
|
||||
|
||||
@@ -109,7 +109,7 @@ a9([1, 2, [["string"]], false, true]); // Parameter type is [any, any, [[any]]
|
||||
a10([1, 2, [["string"]], false, true]); // Parameter type is any[]
|
||||
>a10([1, 2, [["string"]], false, true]) : void
|
||||
>a10 : ([a, b, [[c]], ...x]: Iterable<any>) => void
|
||||
>[1, 2, [["string"]], false, true] : (number | string[][] | boolean)[]
|
||||
>[1, 2, [["string"]], false, true] : (number | boolean | string[][])[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>[["string"]] : string[][]
|
||||
|
||||
@@ -2,15 +2,15 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(13,13): error TS2370: A rest parameter must be of an array type.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(14,17): error TS1047: A rest parameter cannot be optional.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(15,16): error TS1048: A rest parameter cannot have an initializer.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(20,19): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number | string'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(20,19): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(21,7): error TS2304: Cannot find name 'array2'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(22,4): error TS2345: Argument of type '[number, number, string, boolean, boolean]' is not assignable to parameter of type '[any, any, [[any]]]'.
|
||||
Types of property '2' are incompatible.
|
||||
Type 'string' is not assignable to type '[[any]]'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(23,4): error TS2345: Argument of type '[number, number]' is not assignable to parameter of type '[any, any, [[any]]]'.
|
||||
Property '2' is missing in type '[number, number]'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(24,4): error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'.
|
||||
Type 'number | string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(24,4): error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'.
|
||||
Type 'string | number' is not assignable to type 'number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(29,17): error TS1317: A parameter property cannot be declared using a rest parameter.
|
||||
tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(34,22): error TS2304: Cannot find name 'E1'.
|
||||
@@ -47,7 +47,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(
|
||||
|
||||
a1(1, 2, "hello", true); // Error, parameter type is (number|string)[]
|
||||
~~~~
|
||||
!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'number | string'.
|
||||
!!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'.
|
||||
a1(...array2); // Error parameter type is (number|string)[]
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'array2'.
|
||||
@@ -62,8 +62,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(
|
||||
!!! error TS2345: Property '2' is missing in type '[number, number]'.
|
||||
a6([1, 2, "string"]); // Error, parameter type is number[]
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'.
|
||||
!!! error TS2345: Type 'number | string' is not assignable to type 'number'.
|
||||
!!! error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'.
|
||||
!!! error TS2345: Type 'string | number' is not assignable to type 'number'.
|
||||
!!! error TS2345: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
|
||||
@@ -84,8 +84,8 @@ var [...c1] = [1,2,3];
|
||||
>3 : number
|
||||
|
||||
var [...c2] = [1,2,3, "string"];
|
||||
>c2 : (number | string)[]
|
||||
>[1,2,3, "string"] : (number | string)[]
|
||||
>c2 : (string | number)[]
|
||||
>[1,2,3, "string"] : (string | number)[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
@@ -113,9 +113,9 @@ var temp1 = [true, false, true]
|
||||
>true : boolean
|
||||
|
||||
var [d3, d4] = [1, "string", ...temp1];
|
||||
>d3 : number | string | boolean
|
||||
>d4 : number | string | boolean
|
||||
>[1, "string", ...temp1] : (number | string | boolean)[]
|
||||
>d3 : string | number | boolean
|
||||
>d4 : string | number | boolean
|
||||
>[1, "string", ...temp1] : (string | number | boolean)[]
|
||||
>1 : number
|
||||
>"string" : string
|
||||
>...temp1 : boolean
|
||||
|
||||
@@ -84,8 +84,8 @@ var [...c1] = [1,2,3];
|
||||
>3 : number
|
||||
|
||||
var [...c2] = [1,2,3, "string"];
|
||||
>c2 : (number | string)[]
|
||||
>[1,2,3, "string"] : (number | string)[]
|
||||
>c2 : (string | number)[]
|
||||
>[1,2,3, "string"] : (string | number)[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
@@ -113,9 +113,9 @@ var temp1 = [true, false, true]
|
||||
>true : boolean
|
||||
|
||||
var [d3, d4] = [1, "string", ...temp1];
|
||||
>d3 : number | string | boolean
|
||||
>d4 : number | string | boolean
|
||||
>[1, "string", ...temp1] : (number | string | boolean)[]
|
||||
>d3 : string | number | boolean
|
||||
>d4 : string | number | boolean
|
||||
>[1, "string", ...temp1] : (string | number | boolean)[]
|
||||
>1 : number
|
||||
>"string" : string
|
||||
>...temp1 : boolean
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
=== tests/cases/compiler/emitDecoratorMetadata_restArgs.ts ===
|
||||
|
||||
declare const MyClassDecorator: ClassDecorator;
|
||||
>MyClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>MyClassDecorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
|
||||
declare const MyMethodDecorator: MethodDecorator;
|
||||
>MyMethodDecorator : <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void
|
||||
>MethodDecorator : <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void
|
||||
>MyMethodDecorator : <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => void | TypedPropertyDescriptor<T>
|
||||
>MethodDecorator : <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => void | TypedPropertyDescriptor<T>
|
||||
|
||||
@MyClassDecorator
|
||||
>MyClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>MyClassDecorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
|
||||
class A {
|
||||
>A : A
|
||||
@@ -18,7 +18,7 @@ class A {
|
||||
>args : any[]
|
||||
|
||||
@MyMethodDecorator
|
||||
>MyMethodDecorator : <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void
|
||||
>MyMethodDecorator : <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => void | TypedPropertyDescriptor<T>
|
||||
|
||||
method(...args) {}
|
||||
>method : (...args: any[]) => void
|
||||
@@ -26,7 +26,7 @@ class A {
|
||||
}
|
||||
|
||||
@MyClassDecorator
|
||||
>MyClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>MyClassDecorator : <TFunction extends Function>(target: TFunction) => void | TFunction
|
||||
|
||||
class B {
|
||||
>B : B
|
||||
@@ -35,7 +35,7 @@ class B {
|
||||
>args : number[]
|
||||
|
||||
@MyMethodDecorator
|
||||
>MyMethodDecorator : <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void
|
||||
>MyMethodDecorator : <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => void | TypedPropertyDescriptor<T>
|
||||
|
||||
method(...args: string[]) {}
|
||||
>method : (...args: string[]) => void
|
||||
|
||||
@@ -45,8 +45,8 @@ namespace N {
|
||||
}
|
||||
|
||||
let broken = [
|
||||
>broken : ({ foo: N.MyEnum; } | { foo: M.MyEnum; })[]
|
||||
>[ N.object1, M.object2] : ({ foo: N.MyEnum; } | { foo: M.MyEnum; })[]
|
||||
>broken : ({ foo: M.MyEnum; } | { foo: N.MyEnum; })[]
|
||||
>[ N.object1, M.object2] : ({ foo: M.MyEnum; } | { foo: N.MyEnum; })[]
|
||||
|
||||
N.object1,
|
||||
>N.object1 : { foo: N.MyEnum; }
|
||||
|
||||
@@ -172,8 +172,8 @@ enum E9 {
|
||||
// (refer to .js to validate)
|
||||
// Enum constant members are propagated
|
||||
var doNotPropagate = [
|
||||
>doNotPropagate : (E8 | E7 | E4 | E3)[]
|
||||
>[ E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z] : (E8 | E7 | E4 | E3)[]
|
||||
>doNotPropagate : (E3 | E4 | E7 | E8)[]
|
||||
>[ E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z] : (E3 | E4 | E7 | E8)[]
|
||||
|
||||
E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z
|
||||
>E8.B : E8
|
||||
@@ -198,8 +198,8 @@ var doNotPropagate = [
|
||||
];
|
||||
// Enum computed members are not propagated
|
||||
var doPropagate = [
|
||||
>doPropagate : (E9 | E6 | E5)[]
|
||||
>[ E9.A, E9.B, E6.B, E6.C, E6.A, E5.A, E5.B, E5.C] : (E9 | E6 | E5)[]
|
||||
>doPropagate : (E5 | E6 | E9)[]
|
||||
>[ E9.A, E9.B, E6.B, E6.C, E6.A, E5.A, E5.B, E5.C] : (E5 | E6 | E9)[]
|
||||
|
||||
E9.A, E9.B, E6.B, E6.C, E6.A, E5.A, E5.B, E5.C
|
||||
>E9.A : E9
|
||||
|
||||
@@ -13,14 +13,14 @@ type YesNo = Choice.Yes | Choice.No;
|
||||
>No : Choice.No
|
||||
|
||||
type NoYes = Choice.No | Choice.Yes;
|
||||
>NoYes : Choice.No | Choice.Yes
|
||||
>NoYes : Choice.Yes | Choice.No
|
||||
>Choice : any
|
||||
>No : Choice.No
|
||||
>Choice : any
|
||||
>Yes : Choice.Yes
|
||||
|
||||
type UnknownYesNo = Choice.Unknown | Choice.Yes | Choice.No;
|
||||
>UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown
|
||||
>Choice : any
|
||||
>Unknown : Choice.Unknown
|
||||
>Choice : any
|
||||
@@ -37,7 +37,7 @@ function f1() {
|
||||
|
||||
var a: NoYes;
|
||||
>a : Choice.Yes | Choice.No
|
||||
>NoYes : Choice.No | Choice.Yes
|
||||
>NoYes : Choice.Yes | Choice.No
|
||||
|
||||
var a: Choice.Yes | Choice.No;
|
||||
>a : Choice.Yes | Choice.No
|
||||
@@ -55,17 +55,17 @@ function f1() {
|
||||
}
|
||||
|
||||
function f2(a: YesNo, b: UnknownYesNo, c: Choice) {
|
||||
>f2 : (a: Choice.Yes | Choice.No, b: Choice.Unknown | Choice.Yes | Choice.No, c: Choice) => void
|
||||
>f2 : (a: Choice.Yes | Choice.No, b: Choice.Yes | Choice.No | Choice.Unknown, c: Choice) => void
|
||||
>a : Choice.Yes | Choice.No
|
||||
>YesNo : Choice.Yes | Choice.No
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown
|
||||
>c : Choice
|
||||
>Choice : Choice
|
||||
|
||||
b = a;
|
||||
>b = a : Choice.Yes | Choice.No
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
>a : Choice.Yes | Choice.No
|
||||
|
||||
c = a;
|
||||
@@ -234,11 +234,11 @@ declare function g(x: Choice): number;
|
||||
>Choice : Choice
|
||||
|
||||
function f5(a: YesNo, b: UnknownYesNo, c: Choice) {
|
||||
>f5 : (a: Choice.Yes | Choice.No, b: Choice.Unknown | Choice.Yes | Choice.No, c: Choice) => void
|
||||
>f5 : (a: Choice.Yes | Choice.No, b: Choice.Yes | Choice.No | Choice.Unknown, c: Choice) => void
|
||||
>a : Choice.Yes | Choice.No
|
||||
>YesNo : Choice.Yes | Choice.No
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown
|
||||
>c : Choice
|
||||
>Choice : Choice
|
||||
|
||||
@@ -268,7 +268,7 @@ function f5(a: YesNo, b: UnknownYesNo, c: Choice) {
|
||||
>z4 : number
|
||||
>g(b) : number
|
||||
>g : { (x: Choice.Yes): string; (x: Choice.No): boolean; (x: Choice): number; }
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
var z5 = g(c);
|
||||
>z5 : number
|
||||
@@ -336,30 +336,30 @@ function f11(x: YesNo) {
|
||||
}
|
||||
|
||||
function f12(x: UnknownYesNo) {
|
||||
>f12 : (x: Choice.Unknown | Choice.Yes | Choice.No) => void
|
||||
>x : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>f12 : (x: Choice.Yes | Choice.No | Choice.Unknown) => void
|
||||
>x : Choice.Yes | Choice.No | Choice.Unknown
|
||||
>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
if (x) {
|
||||
>x : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>x : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
x;
|
||||
>x : Choice.Yes | Choice.No
|
||||
}
|
||||
else {
|
||||
x;
|
||||
>x : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>x : Choice.Yes | Choice.No | Choice.Unknown
|
||||
}
|
||||
}
|
||||
|
||||
function f13(x: UnknownYesNo) {
|
||||
>f13 : (x: Choice.Unknown | Choice.Yes | Choice.No) => void
|
||||
>x : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>f13 : (x: Choice.Yes | Choice.No | Choice.Unknown) => void
|
||||
>x : Choice.Yes | Choice.No | Choice.Unknown
|
||||
>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
if (x === Choice.Yes) {
|
||||
>x === Choice.Yes : boolean
|
||||
>x : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>x : Choice.Yes | Choice.No | Choice.Unknown
|
||||
>Choice.Yes : Choice.Yes
|
||||
>Choice : typeof Choice
|
||||
>Yes : Choice.Yes
|
||||
@@ -369,7 +369,7 @@ function f13(x: UnknownYesNo) {
|
||||
}
|
||||
else {
|
||||
x;
|
||||
>x : Choice.Unknown | Choice.No
|
||||
>x : Choice.No | Choice.Unknown
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,14 +14,14 @@ type YesNo = Choice.Yes | Choice.No;
|
||||
>No : Choice.No
|
||||
|
||||
type NoYes = Choice.No | Choice.Yes;
|
||||
>NoYes : Choice.No | Choice.Yes
|
||||
>NoYes : Choice.Yes | Choice.No
|
||||
>Choice : any
|
||||
>No : Choice.No
|
||||
>Choice : any
|
||||
>Yes : Choice.Yes
|
||||
|
||||
type UnknownYesNo = Choice.Unknown | Choice.Yes | Choice.No;
|
||||
>UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown
|
||||
>Choice : any
|
||||
>Unknown : Choice.Unknown
|
||||
>Choice : any
|
||||
@@ -38,7 +38,7 @@ function f1() {
|
||||
|
||||
var a: NoYes;
|
||||
>a : Choice.Yes | Choice.No
|
||||
>NoYes : Choice.No | Choice.Yes
|
||||
>NoYes : Choice.Yes | Choice.No
|
||||
|
||||
var a: Choice.Yes | Choice.No;
|
||||
>a : Choice.Yes | Choice.No
|
||||
@@ -56,17 +56,17 @@ function f1() {
|
||||
}
|
||||
|
||||
function f2(a: YesNo, b: UnknownYesNo, c: Choice) {
|
||||
>f2 : (a: Choice.Yes | Choice.No, b: Choice.Unknown | Choice.Yes | Choice.No, c: Choice) => void
|
||||
>f2 : (a: Choice.Yes | Choice.No, b: Choice.Yes | Choice.No | Choice.Unknown, c: Choice) => void
|
||||
>a : Choice.Yes | Choice.No
|
||||
>YesNo : Choice.Yes | Choice.No
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown
|
||||
>c : Choice
|
||||
>Choice : Choice
|
||||
|
||||
b = a;
|
||||
>b = a : Choice.Yes | Choice.No
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
>a : Choice.Yes | Choice.No
|
||||
|
||||
c = a;
|
||||
@@ -81,132 +81,132 @@ function f2(a: YesNo, b: UnknownYesNo, c: Choice) {
|
||||
}
|
||||
|
||||
function f3(a: Choice.Yes, b: UnknownYesNo) {
|
||||
>f3 : (a: Choice.Yes, b: Choice.Unknown | Choice.Yes | Choice.No) => void
|
||||
>f3 : (a: Choice.Yes, b: Choice.Yes | Choice.No | Choice.Unknown) => void
|
||||
>a : Choice.Yes
|
||||
>Choice : any
|
||||
>Yes : Choice.Yes
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
var x = a + b;
|
||||
>x : number
|
||||
>a + b : number
|
||||
>a : Choice.Yes
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
var x = a - b;
|
||||
>x : number
|
||||
>a - b : number
|
||||
>a : Choice.Yes
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
var x = a * b;
|
||||
>x : number
|
||||
>a * b : number
|
||||
>a : Choice.Yes
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
var x = a / b;
|
||||
>x : number
|
||||
>a / b : number
|
||||
>a : Choice.Yes
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
var x = a % b;
|
||||
>x : number
|
||||
>a % b : number
|
||||
>a : Choice.Yes
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
var x = a | b;
|
||||
>x : number
|
||||
>a | b : number
|
||||
>a : Choice.Yes
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
var x = a & b;
|
||||
>x : number
|
||||
>a & b : number
|
||||
>a : Choice.Yes
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
var x = a ^ b;
|
||||
>x : number
|
||||
>a ^ b : number
|
||||
>a : Choice.Yes
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
var x = -b;
|
||||
>x : number
|
||||
>-b : number
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
var x = ~b;
|
||||
>x : number
|
||||
>~b : number
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
var y = a == b;
|
||||
>y : boolean
|
||||
>a == b : boolean
|
||||
>a : Choice.Yes
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
var y = a != b;
|
||||
>y : boolean
|
||||
>a != b : boolean
|
||||
>a : Choice.Yes
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
var y = a === b;
|
||||
>y : boolean
|
||||
>a === b : boolean
|
||||
>a : Choice.Yes
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
var y = a !== b;
|
||||
>y : boolean
|
||||
>a !== b : boolean
|
||||
>a : Choice.Yes
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
var y = a > b;
|
||||
>y : boolean
|
||||
>a > b : boolean
|
||||
>a : Choice.Yes
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
var y = a < b;
|
||||
>y : boolean
|
||||
>a < b : boolean
|
||||
>a : Choice.Yes
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
var y = a >= b;
|
||||
>y : boolean
|
||||
>a >= b : boolean
|
||||
>a : Choice.Yes
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
var y = a <= b;
|
||||
>y : boolean
|
||||
>a <= b : boolean
|
||||
>a : Choice.Yes
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
var y = !b;
|
||||
>y : boolean
|
||||
>!b : boolean
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
}
|
||||
|
||||
function f4(a: Choice.Yes, b: UnknownYesNo) {
|
||||
>f4 : (a: Choice.Yes, b: Choice.Unknown | Choice.Yes | Choice.No) => void
|
||||
>f4 : (a: Choice.Yes, b: Choice.Yes | Choice.No | Choice.Unknown) => void
|
||||
>a : Choice.Yes
|
||||
>Choice : any
|
||||
>Yes : Choice.Yes
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
a++;
|
||||
>a++ : number
|
||||
@@ -214,7 +214,7 @@ function f4(a: Choice.Yes, b: UnknownYesNo) {
|
||||
|
||||
b++;
|
||||
>b++ : number
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
}
|
||||
|
||||
declare function g(x: Choice.Yes): string;
|
||||
@@ -235,11 +235,11 @@ declare function g(x: Choice): number;
|
||||
>Choice : Choice
|
||||
|
||||
function f5(a: YesNo, b: UnknownYesNo, c: Choice) {
|
||||
>f5 : (a: Choice.Yes | Choice.No, b: Choice.Unknown | Choice.Yes | Choice.No, c: Choice) => void
|
||||
>f5 : (a: Choice.Yes | Choice.No, b: Choice.Yes | Choice.No | Choice.Unknown, c: Choice) => void
|
||||
>a : Choice.Yes | Choice.No
|
||||
>YesNo : Choice.Yes | Choice.No
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown
|
||||
>c : Choice
|
||||
>Choice : Choice
|
||||
|
||||
@@ -269,7 +269,7 @@ function f5(a: YesNo, b: UnknownYesNo, c: Choice) {
|
||||
>z4 : number
|
||||
>g(b) : number
|
||||
>g : { (x: Choice.Yes): string; (x: Choice.No): boolean; (x: Choice): number; }
|
||||
>b : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>b : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
var z5 = g(c);
|
||||
>z5 : number
|
||||
@@ -337,12 +337,12 @@ function f11(x: YesNo) {
|
||||
}
|
||||
|
||||
function f12(x: UnknownYesNo) {
|
||||
>f12 : (x: Choice.Unknown | Choice.Yes | Choice.No) => void
|
||||
>x : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>f12 : (x: Choice.Yes | Choice.No | Choice.Unknown) => void
|
||||
>x : Choice.Yes | Choice.No | Choice.Unknown
|
||||
>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
if (x) {
|
||||
>x : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>x : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
x;
|
||||
>x : Choice.Yes | Choice.No
|
||||
@@ -354,13 +354,13 @@ function f12(x: UnknownYesNo) {
|
||||
}
|
||||
|
||||
function f13(x: UnknownYesNo) {
|
||||
>f13 : (x: Choice.Unknown | Choice.Yes | Choice.No) => void
|
||||
>x : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>UnknownYesNo : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>f13 : (x: Choice.Yes | Choice.No | Choice.Unknown) => void
|
||||
>x : Choice.Yes | Choice.No | Choice.Unknown
|
||||
>UnknownYesNo : Choice.Yes | Choice.No | Choice.Unknown
|
||||
|
||||
if (x === Choice.Yes) {
|
||||
>x === Choice.Yes : boolean
|
||||
>x : Choice.Unknown | Choice.Yes | Choice.No
|
||||
>x : Choice.Yes | Choice.No | Choice.Unknown
|
||||
>Choice.Yes : Choice.Yes
|
||||
>Choice : typeof Choice
|
||||
>Yes : Choice.Yes
|
||||
@@ -370,7 +370,7 @@ function f13(x: UnknownYesNo) {
|
||||
}
|
||||
else {
|
||||
x;
|
||||
>x : Choice.Unknown | Choice.No
|
||||
>x : Choice.No | Choice.Unknown
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
tests/cases/conformance/types/literal/enumLiteralTypes3.ts(10,5): error TS2322: Type 'Yes | No' is not assignable to type 'Yes'.
|
||||
Type 'No' is not assignable to type 'Yes'.
|
||||
tests/cases/conformance/types/literal/enumLiteralTypes3.ts(11,5): error TS2322: Type 'Unknown | Yes | No' is not assignable to type 'Yes'.
|
||||
Type 'Unknown' is not assignable to type 'Yes'.
|
||||
tests/cases/conformance/types/literal/enumLiteralTypes3.ts(11,5): error TS2322: Type 'Yes | No | Unknown' is not assignable to type 'Yes'.
|
||||
Type 'No' is not assignable to type 'Yes'.
|
||||
tests/cases/conformance/types/literal/enumLiteralTypes3.ts(12,5): error TS2322: Type 'Choice' is not assignable to type 'Yes'.
|
||||
tests/cases/conformance/types/literal/enumLiteralTypes3.ts(18,5): error TS2322: Type 'Unknown | Yes | No' is not assignable to type 'Yes | No'.
|
||||
tests/cases/conformance/types/literal/enumLiteralTypes3.ts(18,5): error TS2322: Type 'Yes | No | Unknown' is not assignable to type 'Yes | No'.
|
||||
Type 'Unknown' is not assignable to type 'Yes | No'.
|
||||
tests/cases/conformance/types/literal/enumLiteralTypes3.ts(19,5): error TS2322: Type 'Choice' is not assignable to type 'Yes | No'.
|
||||
tests/cases/conformance/types/literal/enumLiteralTypes3.ts(26,5): error TS2322: Type 'Choice' is not assignable to type 'Unknown | Yes | No'.
|
||||
tests/cases/conformance/types/literal/enumLiteralTypes3.ts(26,5): error TS2322: Type 'Choice' is not assignable to type 'Yes | No | Unknown'.
|
||||
tests/cases/conformance/types/literal/enumLiteralTypes3.ts(37,5): error TS2322: Type 'Unknown' is not assignable to type 'Yes'.
|
||||
tests/cases/conformance/types/literal/enumLiteralTypes3.ts(39,5): error TS2322: Type 'No' is not assignable to type 'Yes'.
|
||||
tests/cases/conformance/types/literal/enumLiteralTypes3.ts(40,5): error TS2322: Type 'Unknown' is not assignable to type 'Yes | No'.
|
||||
@@ -34,8 +34,8 @@ tests/cases/conformance/types/literal/enumLiteralTypes3.ts(96,14): error TS2678:
|
||||
!!! error TS2322: Type 'No' is not assignable to type 'Yes'.
|
||||
a = c;
|
||||
~
|
||||
!!! error TS2322: Type 'Unknown | Yes | No' is not assignable to type 'Yes'.
|
||||
!!! error TS2322: Type 'Unknown' is not assignable to type 'Yes'.
|
||||
!!! error TS2322: Type 'Yes | No | Unknown' is not assignable to type 'Yes'.
|
||||
!!! error TS2322: Type 'No' is not assignable to type 'Yes'.
|
||||
a = d;
|
||||
~
|
||||
!!! error TS2322: Type 'Choice' is not assignable to type 'Yes'.
|
||||
@@ -46,7 +46,7 @@ tests/cases/conformance/types/literal/enumLiteralTypes3.ts(96,14): error TS2678:
|
||||
b = b;
|
||||
b = c;
|
||||
~
|
||||
!!! error TS2322: Type 'Unknown | Yes | No' is not assignable to type 'Yes | No'.
|
||||
!!! error TS2322: Type 'Yes | No | Unknown' is not assignable to type 'Yes | No'.
|
||||
!!! error TS2322: Type 'Unknown' is not assignable to type 'Yes | No'.
|
||||
b = d;
|
||||
~
|
||||
@@ -59,7 +59,7 @@ tests/cases/conformance/types/literal/enumLiteralTypes3.ts(96,14): error TS2678:
|
||||
c = c;
|
||||
c = d;
|
||||
~
|
||||
!!! error TS2322: Type 'Choice' is not assignable to type 'Unknown | Yes | No'.
|
||||
!!! error TS2322: Type 'Choice' is not assignable to type 'Yes | No | Unknown'.
|
||||
}
|
||||
|
||||
function f4(a: Yes, b: YesNo, c: UnknownYesNo, d: Choice) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/es6/for-ofStatements/for-of11.ts(2,6): error TS2322: Type 'number | string' is not assignable to type 'string'.
|
||||
tests/cases/conformance/es6/for-ofStatements/for-of11.ts(2,6): error TS2322: Type 'string | number' is not assignable to type 'string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
@@ -6,5 +6,5 @@ tests/cases/conformance/es6/for-ofStatements/for-of11.ts(2,6): error TS2322: Typ
|
||||
var v: string;
|
||||
for (v of [0, ""]) { }
|
||||
~
|
||||
!!! error TS2322: Type 'number | string' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'string | number' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/es6/for-ofStatements/for-of12.ts(2,6): error TS2322: Type 'number | string' is not assignable to type 'string'.
|
||||
tests/cases/conformance/es6/for-ofStatements/for-of12.ts(2,6): error TS2322: Type 'string | number' is not assignable to type 'string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
@@ -6,5 +6,5 @@ tests/cases/conformance/es6/for-ofStatements/for-of12.ts(2,6): error TS2322: Typ
|
||||
var v: string;
|
||||
for (v of [0, ""].values()) { }
|
||||
~
|
||||
!!! error TS2322: Type 'number | string' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'string | number' is not assignable to type 'string'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
@@ -325,7 +325,7 @@ class AnotherClass { private x }
|
||||
var f7: (x: number) => string | number = x => { // should be (x: number) => number | string
|
||||
>f7 : (x: number) => string | number
|
||||
>x : number
|
||||
>x => { // should be (x: number) => number | string if (x < 0) { return x; } return x.toString();} : (x: number) => number | string
|
||||
>x => { // should be (x: number) => number | string if (x < 0) { return x; } return x.toString();} : (x: number) => string | number
|
||||
>x : number
|
||||
|
||||
if (x < 0) { return x; }
|
||||
|
||||
@@ -11,16 +11,16 @@ function foo(bar: { a:string }[]): string;
|
||||
|
||||
function foo([x]: { a:number | string }[]): string | number {
|
||||
>foo : { (bar: { a: number; }[]): number; (bar: { a: string; }[]): string; }
|
||||
>x : { a: number | string; }
|
||||
>a : number | string
|
||||
>x : { a: string | number; }
|
||||
>a : string | number
|
||||
|
||||
if (x) {
|
||||
>x : { a: number | string; }
|
||||
>x : { a: string | number; }
|
||||
|
||||
return x.a;
|
||||
>x.a : number | string
|
||||
>x : { a: number | string; }
|
||||
>a : number | string
|
||||
>x.a : string | number
|
||||
>x : { a: string | number; }
|
||||
>a : string | number
|
||||
}
|
||||
|
||||
return undefined;
|
||||
|
||||
@@ -27,8 +27,8 @@ function foo1(bar: { a:string }[]): Animal;
|
||||
|
||||
function foo1([x]: { a:number | string }[]): Dog {
|
||||
>foo1 : { (bar: { a: number; }[]): Dog; (bar: { a: string; }[]): Animal; }
|
||||
>x : { a: number | string; }
|
||||
>a : number | string
|
||||
>x : { a: string | number; }
|
||||
>a : string | number
|
||||
>Dog : Dog
|
||||
|
||||
return undefined;
|
||||
@@ -36,22 +36,22 @@ function foo1([x]: { a:number | string }[]): Dog {
|
||||
}
|
||||
|
||||
function foo2(bar: { a:number }[]): Cat;
|
||||
>foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Cat | Dog; }
|
||||
>foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Dog | Cat; }
|
||||
>bar : { a: number; }[]
|
||||
>a : number
|
||||
>Cat : Cat
|
||||
|
||||
function foo2(bar: { a:string }[]): Cat | Dog;
|
||||
>foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Cat | Dog; }
|
||||
>foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Dog | Cat; }
|
||||
>bar : { a: string; }[]
|
||||
>a : string
|
||||
>Cat : Cat
|
||||
>Dog : Dog
|
||||
|
||||
function foo2([x]: { a:number | string }[]): Cat {
|
||||
>foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Cat | Dog; }
|
||||
>x : { a: number | string; }
|
||||
>a : number | string
|
||||
>foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Dog | Cat; }
|
||||
>x : { a: string | number; }
|
||||
>a : string | number
|
||||
>Cat : Cat
|
||||
|
||||
return undefined;
|
||||
@@ -78,9 +78,9 @@ var y1 = foo1([{a: 100}]);
|
||||
>100 : number
|
||||
|
||||
var x2 = foo2([{a: "str"}]);
|
||||
>x2 : Cat | Dog
|
||||
>foo2([{a: "str"}]) : Cat | Dog
|
||||
>foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Cat | Dog; }
|
||||
>x2 : Dog | Cat
|
||||
>foo2([{a: "str"}]) : Dog | Cat
|
||||
>foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Dog | Cat; }
|
||||
>[{a: "str"}] : { a: string; }[]
|
||||
>{a: "str"} : { a: string; }
|
||||
>a : string
|
||||
@@ -89,7 +89,7 @@ var x2 = foo2([{a: "str"}]);
|
||||
var y2 = foo2([{a: 100}]);
|
||||
>y2 : Cat
|
||||
>foo2([{a: 100}]) : Cat
|
||||
>foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Cat | Dog; }
|
||||
>foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Dog | Cat; }
|
||||
>[{a: 100}] : { a: number; }[]
|
||||
>{a: 100} : { a: number; }
|
||||
>a : number
|
||||
|
||||
@@ -27,8 +27,8 @@ function foo1(bar: { a:string }[]): Dog;
|
||||
|
||||
function foo1([x]: { a:number | string }[]): Animal {
|
||||
>foo1 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Dog; }
|
||||
>x : { a: number | string; }
|
||||
>a : number | string
|
||||
>x : { a: string | number; }
|
||||
>a : string | number
|
||||
>Animal : Animal
|
||||
|
||||
return undefined;
|
||||
@@ -49,8 +49,8 @@ function foo2(bar: { a:string }[]): Dog;
|
||||
|
||||
function foo2([x]: { a:number | string }[]): Cat | Dog {
|
||||
>foo2 : { (bar: { a: number; }[]): Cat; (bar: { a: string; }[]): Dog; }
|
||||
>x : { a: number | string; }
|
||||
>a : number | string
|
||||
>x : { a: string | number; }
|
||||
>a : string | number
|
||||
>Cat : Cat
|
||||
>Dog : Dog
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ _.all([true, 1, null, 'yes'], _.identity);
|
||||
>_.all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => boolean
|
||||
>_ : Underscore.Static
|
||||
>all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => boolean
|
||||
>[true, 1, null, 'yes'] : (boolean | number | string)[]
|
||||
>[true, 1, null, 'yes'] : (string | number | boolean)[]
|
||||
>true : boolean
|
||||
>1 : number
|
||||
>null : null
|
||||
|
||||
@@ -46,10 +46,10 @@ var r3 = foo<number[]>([]); // number[]
|
||||
>[] : undefined[]
|
||||
|
||||
var r4 = foo([1, '']); // {}[]
|
||||
>r4 : (number | string)[]
|
||||
>foo([1, '']) : (number | string)[]
|
||||
>r4 : (string | number)[]
|
||||
>foo([1, '']) : (string | number)[]
|
||||
>foo : <T>(t: T) => T
|
||||
>[1, ''] : (number | string)[]
|
||||
>[1, ''] : (string | number)[]
|
||||
>1 : number
|
||||
>'' : string
|
||||
|
||||
@@ -57,7 +57,7 @@ var r5 = foo<any[]>([1, '']); // any[]
|
||||
>r5 : any[]
|
||||
>foo<any[]>([1, '']) : any[]
|
||||
>foo : <T>(t: T) => T
|
||||
>[1, ''] : (number | string)[]
|
||||
>[1, ''] : (string | number)[]
|
||||
>1 : number
|
||||
>'' : string
|
||||
|
||||
@@ -66,7 +66,7 @@ var r6 = foo<Object[]>([1, '']); // Object[]
|
||||
>foo<Object[]>([1, '']) : Object[]
|
||||
>foo : <T>(t: T) => T
|
||||
>Object : Object
|
||||
>[1, ''] : (number | string)[]
|
||||
>[1, ''] : (string | number)[]
|
||||
>1 : number
|
||||
>'' : string
|
||||
|
||||
@@ -42,12 +42,12 @@ declare var _: Underscore.Static;
|
||||
>Static : Underscore.Static
|
||||
|
||||
var r = _.all([true, 1, null, 'yes'], _.identity);
|
||||
>r : boolean | number | string
|
||||
>_.all([true, 1, null, 'yes'], _.identity) : boolean | number | string
|
||||
>r : string | number | boolean
|
||||
>_.all([true, 1, null, 'yes'], _.identity) : string | number | boolean
|
||||
>_.all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => T
|
||||
>_ : Underscore.Static
|
||||
>all : <T>(list: T[], iterator?: Underscore.Iterator<T, boolean>, context?: any) => T
|
||||
>[true, 1, null, 'yes'] : (boolean | number | string)[]
|
||||
>[true, 1, null, 'yes'] : (string | number | boolean)[]
|
||||
>true : boolean
|
||||
>1 : number
|
||||
>null : null
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/heterogeneousArrayAndOverloads.ts(9,19): error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'string[]'.
|
||||
Type 'number | string' is not assignable to type 'string'.
|
||||
tests/cases/compiler/heterogeneousArrayAndOverloads.ts(9,19): error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'string[]'.
|
||||
Type 'string | number' is not assignable to type 'string'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ tests/cases/compiler/heterogeneousArrayAndOverloads.ts(9,19): error TS2345: Argu
|
||||
this.test([]);
|
||||
this.test([1, 2, "hi", 5]); // Error
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'string[]'.
|
||||
!!! error TS2345: Type 'number | string' is not assignable to type 'string'.
|
||||
!!! error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'string[]'.
|
||||
!!! error TS2345: Type 'string | number' is not assignable to type 'string'.
|
||||
!!! error TS2345: Type 'number' is not assignable to type 'string'.
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
// type of an array is the best common type of its elements (plus its contextual type if it exists)
|
||||
|
||||
var a = [1, '']; // {}[]
|
||||
>a : (number | string)[]
|
||||
>[1, ''] : (number | string)[]
|
||||
>a : (string | number)[]
|
||||
>[1, ''] : (string | number)[]
|
||||
>1 : number
|
||||
>'' : string
|
||||
|
||||
@@ -14,8 +14,8 @@ var b = [1, null]; // number[]
|
||||
>null : null
|
||||
|
||||
var c = [1, '', null]; // {}[]
|
||||
>c : (number | string)[]
|
||||
>[1, '', null] : (number | string)[]
|
||||
>c : (string | number)[]
|
||||
>[1, '', null] : (string | number)[]
|
||||
>1 : number
|
||||
>'' : string
|
||||
>null : null
|
||||
@@ -296,8 +296,8 @@ function foo<T, U>(t: T, u: U) {
|
||||
>u : U
|
||||
|
||||
var d = [t, 1]; // {}[]
|
||||
>d : (T | number)[]
|
||||
>[t, 1] : (T | number)[]
|
||||
>d : (number | T)[]
|
||||
>[t, 1] : (number | T)[]
|
||||
>t : T
|
||||
>1 : number
|
||||
|
||||
@@ -350,8 +350,8 @@ function foo2<T extends Base, U extends Derived>(t: T, u: U) {
|
||||
>u : U
|
||||
|
||||
var d = [t, 1]; // {}[]
|
||||
>d : (T | number)[]
|
||||
>[t, 1] : (T | number)[]
|
||||
>d : (number | T)[]
|
||||
>[t, 1] : (number | T)[]
|
||||
>t : T
|
||||
>1 : number
|
||||
|
||||
@@ -380,8 +380,8 @@ function foo2<T extends Base, U extends Derived>(t: T, u: U) {
|
||||
>base : Base
|
||||
|
||||
var h = [t, derived]; // Derived[]
|
||||
>h : (T | Derived)[]
|
||||
>[t, derived] : (T | Derived)[]
|
||||
>h : (Derived | T)[]
|
||||
>[t, derived] : (Derived | T)[]
|
||||
>t : T
|
||||
>derived : Derived
|
||||
|
||||
@@ -428,8 +428,8 @@ function foo3<T extends Derived, U extends Derived>(t: T, u: U) {
|
||||
>u : U
|
||||
|
||||
var d = [t, 1]; // {}[]
|
||||
>d : (T | number)[]
|
||||
>[t, 1] : (T | number)[]
|
||||
>d : (number | T)[]
|
||||
>[t, 1] : (number | T)[]
|
||||
>t : T
|
||||
>1 : number
|
||||
|
||||
@@ -506,8 +506,8 @@ function foo4<T extends Base, U extends Base>(t: T, u: U) {
|
||||
>u : U
|
||||
|
||||
var d = [t, 1]; // {}[]
|
||||
>d : (T | number)[]
|
||||
>[t, 1] : (T | number)[]
|
||||
>d : (number | T)[]
|
||||
>[t, 1] : (number | T)[]
|
||||
>t : T
|
||||
>1 : number
|
||||
|
||||
@@ -536,8 +536,8 @@ function foo4<T extends Base, U extends Base>(t: T, u: U) {
|
||||
>base : Base
|
||||
|
||||
var h = [t, derived]; // Derived[]
|
||||
>h : (T | Derived)[]
|
||||
>[t, derived] : (T | Derived)[]
|
||||
>h : (Derived | T)[]
|
||||
>[t, derived] : (Derived | T)[]
|
||||
>t : T
|
||||
>derived : Derived
|
||||
|
||||
@@ -548,8 +548,8 @@ function foo4<T extends Base, U extends Base>(t: T, u: U) {
|
||||
>base : Base
|
||||
|
||||
var j = [u, derived]; // Derived[]
|
||||
>j : (U | Derived)[]
|
||||
>[u, derived] : (U | Derived)[]
|
||||
>j : (Derived | U)[]
|
||||
>[u, derived] : (Derived | U)[]
|
||||
>u : U
|
||||
>derived : Derived
|
||||
|
||||
|
||||
@@ -147,14 +147,14 @@ function f3() {
|
||||
>b : string
|
||||
|
||||
const v1 = getStringIndexValue(o1);
|
||||
>v1 : number | string
|
||||
>getStringIndexValue(o1) : number | string
|
||||
>v1 : string | number
|
||||
>getStringIndexValue(o1) : string | number
|
||||
>getStringIndexValue : <T>(map: { [x: string]: T; }) => T
|
||||
>o1 : { a: number; b: string; }
|
||||
|
||||
const v2 = getStringIndexValue(o2);
|
||||
>v2 : number | string
|
||||
>getStringIndexValue(o2) : number | string
|
||||
>v2 : string | number
|
||||
>getStringIndexValue(o2) : string | number
|
||||
>getStringIndexValue : <T>(map: { [x: string]: T; }) => T
|
||||
>o2 : { a: number; b: string; }
|
||||
}
|
||||
|
||||
@@ -101,20 +101,20 @@ var eleUnion11 = unionTuple1[1]; // string | number
|
||||
>1 : number
|
||||
|
||||
var eleUnion12 = unionTuple1[2]; // string | number
|
||||
>eleUnion12 : number | string
|
||||
>unionTuple1[2] : number | string
|
||||
>eleUnion12 : string | number
|
||||
>unionTuple1[2] : string | number
|
||||
>unionTuple1 : [number, string | number]
|
||||
>2 : number
|
||||
|
||||
var eleUnion13 = unionTuple1[idx0]; // string | number
|
||||
>eleUnion13 : number | string
|
||||
>unionTuple1[idx0] : number | string
|
||||
>eleUnion13 : string | number
|
||||
>unionTuple1[idx0] : string | number
|
||||
>unionTuple1 : [number, string | number]
|
||||
>idx0 : number
|
||||
|
||||
var eleUnion14 = unionTuple1[idx1]; // string | number
|
||||
>eleUnion14 : number | string
|
||||
>unionTuple1[idx1] : number | string
|
||||
>eleUnion14 : string | number
|
||||
>unionTuple1[idx1] : string | number
|
||||
>unionTuple1 : [number, string | number]
|
||||
>idx1 : number
|
||||
|
||||
@@ -143,20 +143,20 @@ var eleUnion21 = unionTuple2[1]; // string | number
|
||||
>1 : number
|
||||
|
||||
var eleUnion22 = unionTuple2[2]; // string | number | boolean
|
||||
>eleUnion22 : boolean | string | number
|
||||
>unionTuple2[2] : boolean | string | number
|
||||
>eleUnion22 : string | number | boolean
|
||||
>unionTuple2[2] : string | number | boolean
|
||||
>unionTuple2 : [boolean, string | number]
|
||||
>2 : number
|
||||
|
||||
var eleUnion23 = unionTuple2[idx0]; // string | number | boolean
|
||||
>eleUnion23 : boolean | string | number
|
||||
>unionTuple2[idx0] : boolean | string | number
|
||||
>eleUnion23 : string | number | boolean
|
||||
>unionTuple2[idx0] : string | number | boolean
|
||||
>unionTuple2 : [boolean, string | number]
|
||||
>idx0 : number
|
||||
|
||||
var eleUnion24 = unionTuple2[idx1]; // string | number | boolean
|
||||
>eleUnion24 : boolean | string | number
|
||||
>unionTuple2[idx1] : boolean | string | number
|
||||
>eleUnion24 : string | number | boolean
|
||||
>unionTuple2[idx1] : string | number | boolean
|
||||
>unionTuple2 : [boolean, string | number]
|
||||
>idx1 : number
|
||||
|
||||
|
||||
@@ -46,14 +46,14 @@ class Giraffe extends Mammal { neck; }
|
||||
>neck : any
|
||||
|
||||
function fn1(x: Array<number>|Array<string>|boolean) {
|
||||
>fn1 : (x: number[] | string[] | boolean) => void
|
||||
>x : number[] | string[] | boolean
|
||||
>fn1 : (x: boolean | number[] | string[]) => void
|
||||
>x : boolean | number[] | string[]
|
||||
>Array : T[]
|
||||
>Array : T[]
|
||||
|
||||
if(x instanceof Array) {
|
||||
>x instanceof Array : boolean
|
||||
>x : number[] | string[] | boolean
|
||||
>x : boolean | number[] | string[]
|
||||
>Array : ArrayConstructor
|
||||
|
||||
// 1.5: y: Array<number>|Array<string>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
=== tests/cases/conformance/es6/spread/iteratorSpreadInCall12.ts ===
|
||||
new Foo(...[...new SymbolIterator, ...[...new StringIterator]]);
|
||||
>new Foo(...[...new SymbolIterator, ...[...new StringIterator]]) : Foo<symbol | string>
|
||||
>new Foo(...[...new SymbolIterator, ...[...new StringIterator]]) : Foo<string | symbol>
|
||||
>Foo : typeof Foo
|
||||
>...[...new SymbolIterator, ...[...new StringIterator]] : symbol | string
|
||||
>[...new SymbolIterator, ...[...new StringIterator]] : (symbol | string)[]
|
||||
>...[...new SymbolIterator, ...[...new StringIterator]] : string | symbol
|
||||
>[...new SymbolIterator, ...[...new StringIterator]] : (string | symbol)[]
|
||||
>...new SymbolIterator : symbol
|
||||
>new SymbolIterator : SymbolIterator
|
||||
>SymbolIterator : typeof SymbolIterator
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/conformance/es6/spread/iteratorSpreadInCall5.ts ===
|
||||
foo(...new SymbolIterator, ...new StringIterator);
|
||||
>foo(...new SymbolIterator, ...new StringIterator) : void
|
||||
>foo : (...s: (symbol | string)[]) => void
|
||||
>foo : (...s: (string | symbol)[]) => void
|
||||
>...new SymbolIterator : symbol
|
||||
>new SymbolIterator : SymbolIterator
|
||||
>SymbolIterator : typeof SymbolIterator
|
||||
@@ -10,8 +10,8 @@ foo(...new SymbolIterator, ...new StringIterator);
|
||||
>StringIterator : typeof StringIterator
|
||||
|
||||
function foo(...s: (symbol | string)[]) { }
|
||||
>foo : (...s: (symbol | string)[]) => void
|
||||
>s : (symbol | string)[]
|
||||
>foo : (...s: (string | symbol)[]) => void
|
||||
>s : (string | symbol)[]
|
||||
|
||||
class SymbolIterator {
|
||||
>SymbolIterator : SymbolIterator
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts(1,28): error TS2345: Argument of type 'string' is not assignable to parameter of type 'symbol | number'.
|
||||
tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts(1,28): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number | symbol'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts (1 errors) ====
|
||||
foo(...new SymbolIterator, ...new StringIterator);
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'symbol | number'.
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number | symbol'.
|
||||
|
||||
function foo(...s: (symbol | number)[]) { }
|
||||
class SymbolIterator {
|
||||
|
||||
@@ -6,27 +6,27 @@ var value = null;
|
||||
|
||||
JSON.stringify(value, undefined, 2);
|
||||
>JSON.stringify(value, undefined, 2) : string
|
||||
>JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; }
|
||||
>JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; }
|
||||
>JSON : JSON
|
||||
>stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; }
|
||||
>stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; }
|
||||
>value : null
|
||||
>undefined : undefined
|
||||
>2 : number
|
||||
|
||||
JSON.stringify(value, null, 2);
|
||||
>JSON.stringify(value, null, 2) : string
|
||||
>JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; }
|
||||
>JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; }
|
||||
>JSON : JSON
|
||||
>stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; }
|
||||
>stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; }
|
||||
>value : null
|
||||
>null : null
|
||||
>2 : number
|
||||
|
||||
JSON.stringify(value, ["a", 1], 2);
|
||||
>JSON.stringify(value, ["a", 1], 2) : string
|
||||
>JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; }
|
||||
>JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; }
|
||||
>JSON : JSON
|
||||
>stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; }
|
||||
>stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; }
|
||||
>value : null
|
||||
>["a", 1] : (string | number)[]
|
||||
>"a" : string
|
||||
@@ -35,9 +35,9 @@ JSON.stringify(value, ["a", 1], 2);
|
||||
|
||||
JSON.stringify(value, (k) => undefined, 2);
|
||||
>JSON.stringify(value, (k) => undefined, 2) : string
|
||||
>JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; }
|
||||
>JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; }
|
||||
>JSON : JSON
|
||||
>stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; }
|
||||
>stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; }
|
||||
>value : null
|
||||
>(k) => undefined : (k: string) => undefined
|
||||
>k : string
|
||||
@@ -46,9 +46,9 @@ JSON.stringify(value, (k) => undefined, 2);
|
||||
|
||||
JSON.stringify(value, undefined, 2);
|
||||
>JSON.stringify(value, undefined, 2) : string
|
||||
>JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; }
|
||||
>JSON.stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; }
|
||||
>JSON : JSON
|
||||
>stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (number | string)[] | null | undefined, space?: string | number | undefined): string; }
|
||||
>stringify : { (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string; }
|
||||
>value : null
|
||||
>undefined : undefined
|
||||
>2 : number
|
||||
|
||||
@@ -79,34 +79,34 @@ function f2(x: 0 | 1 | 2) {
|
||||
}
|
||||
|
||||
type Falsy = false | 0 | "" | null | undefined;
|
||||
>Falsy : false | 0 | "" | null | undefined
|
||||
>Falsy : false | "" | 0 | null | undefined
|
||||
>false : false
|
||||
>null : null
|
||||
|
||||
function f3(x: Falsy) {
|
||||
>f3 : (x: false | 0 | "" | null | undefined) => void
|
||||
>x : false | 0 | "" | null | undefined
|
||||
>Falsy : false | 0 | "" | null | undefined
|
||||
>f3 : (x: false | "" | 0 | null | undefined) => void
|
||||
>x : false | "" | 0 | null | undefined
|
||||
>Falsy : false | "" | 0 | null | undefined
|
||||
|
||||
if (x) {
|
||||
>x : false | 0 | "" | null | undefined
|
||||
>x : false | "" | 0 | null | undefined
|
||||
|
||||
x;
|
||||
>x : never
|
||||
}
|
||||
else {
|
||||
x;
|
||||
>x : false | 0 | "" | null | undefined
|
||||
>x : false | "" | 0 | null | undefined
|
||||
}
|
||||
}
|
||||
|
||||
function f4(x: 0 | 1 | true | string) {
|
||||
>f4 : (x: 0 | 1 | true | string) => void
|
||||
>x : 0 | 1 | true | string
|
||||
>f4 : (x: string | true | 0 | 1) => void
|
||||
>x : string | true | 0 | 1
|
||||
>true : true
|
||||
|
||||
switch (x) {
|
||||
>x : 0 | 1 | true | string
|
||||
>x : string | true | 0 | 1
|
||||
|
||||
case 0:
|
||||
>0 : 0
|
||||
@@ -148,7 +148,7 @@ function f4(x: 0 | 1 | true | string) {
|
||||
break;
|
||||
default:
|
||||
x;
|
||||
>x : true | string
|
||||
>x : string | true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -86,8 +86,8 @@ const a8 = a && z;
|
||||
>z : string | number | undefined
|
||||
|
||||
const s1 = s && a;
|
||||
>s1 : number[] | ""
|
||||
>s && a : number[] | ""
|
||||
>s1 : "" | number[]
|
||||
>s && a : "" | number[]
|
||||
>s : string
|
||||
>a : number[]
|
||||
|
||||
@@ -134,8 +134,8 @@ const s8 = s && z;
|
||||
>z : string | number | undefined
|
||||
|
||||
const x1 = x && a;
|
||||
>x1 : number[] | 0
|
||||
>x && a : number[] | 0
|
||||
>x1 : 0 | number[]
|
||||
>x && a : 0 | number[]
|
||||
>x : number
|
||||
>a : number[]
|
||||
|
||||
@@ -182,8 +182,8 @@ const x8 = x && z;
|
||||
>z : string | number | undefined
|
||||
|
||||
const b1 = b && a;
|
||||
>b1 : number[] | false
|
||||
>b && a : number[] | false
|
||||
>b1 : false | number[]
|
||||
>b && a : false | number[]
|
||||
>b : boolean
|
||||
>a : number[]
|
||||
|
||||
@@ -206,8 +206,8 @@ const b4 = b && b;
|
||||
>b : true
|
||||
|
||||
const b5 = b && v;
|
||||
>b5 : void | false
|
||||
>b && v : void | false
|
||||
>b5 : false | void
|
||||
>b && v : false | void
|
||||
>b : boolean
|
||||
>v : void
|
||||
|
||||
@@ -374,8 +374,8 @@ const n8 = n && z;
|
||||
>z : string | number | undefined
|
||||
|
||||
const z1 = z && a;
|
||||
>z1 : number[] | "" | 0 | undefined
|
||||
>z && a : number[] | "" | 0 | undefined
|
||||
>z1 : "" | 0 | number[] | undefined
|
||||
>z && a : "" | 0 | number[] | undefined
|
||||
>z : string | number | undefined
|
||||
>a : number[]
|
||||
|
||||
|
||||
@@ -127,20 +127,20 @@ var rb5 = a5 || a2; // void || boolean is void | boolean
|
||||
>a2 : boolean
|
||||
|
||||
var rb6 = a6 || a2; // enum || boolean is E | boolean
|
||||
>rb6 : E | boolean
|
||||
>a6 || a2 : E | boolean
|
||||
>rb6 : boolean | E
|
||||
>a6 || a2 : boolean | E
|
||||
>a6 : E
|
||||
>a2 : boolean
|
||||
|
||||
var rb7 = a7 || a2; // object || boolean is object | boolean
|
||||
>rb7 : { a: string; } | boolean
|
||||
>a7 || a2 : { a: string; } | boolean
|
||||
>rb7 : boolean | { a: string; }
|
||||
>a7 || a2 : boolean | { a: string; }
|
||||
>a7 : { a: string; }
|
||||
>a2 : boolean
|
||||
|
||||
var rb8 = a8 || a2; // array || boolean is array | boolean
|
||||
>rb8 : string[] | boolean
|
||||
>a8 || a2 : string[] | boolean
|
||||
>rb8 : boolean | string[]
|
||||
>a8 || a2 : boolean | string[]
|
||||
>a8 : string[]
|
||||
>a2 : boolean
|
||||
|
||||
@@ -163,8 +163,8 @@ var rc1 = a1 || a3; // any || number is any
|
||||
>a3 : number
|
||||
|
||||
var rc2 = a2 || a3; // boolean || number is boolean | number
|
||||
>rc2 : true | number
|
||||
>a2 || a3 : true | number
|
||||
>rc2 : number | true
|
||||
>a2 || a3 : number | true
|
||||
>a2 : boolean
|
||||
>a3 : number
|
||||
|
||||
@@ -193,14 +193,14 @@ var rc6 = a6 || a3; // enum || number is number
|
||||
>a3 : number
|
||||
|
||||
var rc7 = a7 || a3; // object || number is object | number
|
||||
>rc7 : { a: string; } | number
|
||||
>a7 || a3 : { a: string; } | number
|
||||
>rc7 : number | { a: string; }
|
||||
>a7 || a3 : number | { a: string; }
|
||||
>a7 : { a: string; }
|
||||
>a3 : number
|
||||
|
||||
var rc8 = a8 || a3; // array || number is array | number
|
||||
>rc8 : string[] | number
|
||||
>a8 || a3 : string[] | number
|
||||
>rc8 : number | string[]
|
||||
>a8 || a3 : number | string[]
|
||||
>a8 : string[]
|
||||
>a3 : number
|
||||
|
||||
@@ -223,14 +223,14 @@ var rd1 = a1 || a4; // any || string is any
|
||||
>a4 : string
|
||||
|
||||
var rd2 = a2 || a4; // boolean || string is boolean | string
|
||||
>rd2 : true | string
|
||||
>a2 || a4 : true | string
|
||||
>rd2 : string | true
|
||||
>a2 || a4 : string | true
|
||||
>a2 : boolean
|
||||
>a4 : string
|
||||
|
||||
var rd3 = a3 || a4; // number || string is number | string
|
||||
>rd3 : number | string
|
||||
>a3 || a4 : number | string
|
||||
>rd3 : string | number
|
||||
>a3 || a4 : string | number
|
||||
>a3 : number
|
||||
>a4 : string
|
||||
|
||||
@@ -247,20 +247,20 @@ var rd5 = a5 || a4; // void || string is void | string
|
||||
>a4 : string
|
||||
|
||||
var rd6 = a6 || a4; // enum || string is enum | string
|
||||
>rd6 : E | string
|
||||
>a6 || a4 : E | string
|
||||
>rd6 : string | E
|
||||
>a6 || a4 : string | E
|
||||
>a6 : E
|
||||
>a4 : string
|
||||
|
||||
var rd7 = a7 || a4; // object || string is object | string
|
||||
>rd7 : { a: string; } | string
|
||||
>a7 || a4 : { a: string; } | string
|
||||
>rd7 : string | { a: string; }
|
||||
>a7 || a4 : string | { a: string; }
|
||||
>a7 : { a: string; }
|
||||
>a4 : string
|
||||
|
||||
var rd8 = a8 || a4; // array || string is array | string
|
||||
>rd8 : string[] | string
|
||||
>a8 || a4 : string[] | string
|
||||
>rd8 : string | string[]
|
||||
>a8 || a4 : string | string[]
|
||||
>a8 : string[]
|
||||
>a4 : string
|
||||
|
||||
@@ -307,20 +307,20 @@ var re5 = a5 || a5; // void || void is void
|
||||
>a5 : void
|
||||
|
||||
var re6 = a6 || a5; // enum || void is enum | void
|
||||
>re6 : E | void
|
||||
>a6 || a5 : E | void
|
||||
>re6 : void | E
|
||||
>a6 || a5 : void | E
|
||||
>a6 : E
|
||||
>a5 : void
|
||||
|
||||
var re7 = a7 || a5; // object || void is object | void
|
||||
>re7 : { a: string; } | void
|
||||
>a7 || a5 : { a: string; } | void
|
||||
>re7 : void | { a: string; }
|
||||
>a7 || a5 : void | { a: string; }
|
||||
>a7 : { a: string; }
|
||||
>a5 : void
|
||||
|
||||
var re8 = a8 || a5; // array || void is array | void
|
||||
>re8 : string[] | void
|
||||
>a8 || a5 : string[] | void
|
||||
>re8 : void | string[]
|
||||
>a8 || a5 : void | string[]
|
||||
>a8 : string[]
|
||||
>a5 : void
|
||||
|
||||
@@ -373,14 +373,14 @@ var rg6 = a6 || a6; // enum || enum is E
|
||||
>a6 : E
|
||||
|
||||
var rg7 = a7 || a6; // object || enum is object | enum
|
||||
>rg7 : { a: string; } | E
|
||||
>a7 || a6 : { a: string; } | E
|
||||
>rg7 : E | { a: string; }
|
||||
>a7 || a6 : E | { a: string; }
|
||||
>a7 : { a: string; }
|
||||
>a6 : E
|
||||
|
||||
var rg8 = a8 || a6; // array || enum is array | enum
|
||||
>rg8 : string[] | E
|
||||
>a8 || a6 : string[] | E
|
||||
>rg8 : E | string[]
|
||||
>a8 || a6 : E | string[]
|
||||
>a8 : string[]
|
||||
>a6 : E
|
||||
|
||||
@@ -439,8 +439,8 @@ var rh7 = a7 || a7; // object || object is object
|
||||
>a7 : { a: string; }
|
||||
|
||||
var rh8 = a8 || a7; // array || object is array | object
|
||||
>rh8 : string[] | { a: string; }
|
||||
>a8 || a7 : string[] | { a: string; }
|
||||
>rh8 : { a: string; } | string[]
|
||||
>a8 || a7 : { a: string; } | string[]
|
||||
>a8 : string[]
|
||||
>a7 : { a: string; }
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(10,30): error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'.
|
||||
Type 'number | string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(10,30): error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'.
|
||||
Type 'string | number' is not assignable to type 'number'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(11,11): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
|
||||
@@ -16,8 +16,8 @@ tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(11,11): e
|
||||
var r6 = map<Object, Object>([1, ""], (x) => x.toString());
|
||||
var r7 = map<number, string>([1, ""], (x) => x.toString()); // error
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'.
|
||||
!!! error TS2345: Type 'number | string' is not assignable to type 'number'.
|
||||
!!! error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'.
|
||||
!!! error TS2345: Type 'string | number' is not assignable to type 'number'.
|
||||
!!! error TS2345: Type 'string' is not assignable to type 'number'.
|
||||
var r7b = map<number>([1, ""], (x) => x.toString()); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -22,24 +22,24 @@
|
||||
}
|
||||
|
||||
type FileMatchOrMatch = FileMatch | Match;
|
||||
>FileMatchOrMatch : FileMatch | Match
|
||||
>FileMatchOrMatch : Match | FileMatch
|
||||
>FileMatch : FileMatch
|
||||
>Match : Match
|
||||
|
||||
|
||||
let elementA: FileMatchOrMatch, elementB: FileMatchOrMatch;
|
||||
>elementA : FileMatch | Match
|
||||
>FileMatchOrMatch : FileMatch | Match
|
||||
>elementB : FileMatch | Match
|
||||
>FileMatchOrMatch : FileMatch | Match
|
||||
>elementA : Match | FileMatch
|
||||
>FileMatchOrMatch : Match | FileMatch
|
||||
>elementB : Match | FileMatch
|
||||
>FileMatchOrMatch : Match | FileMatch
|
||||
|
||||
if (elementA instanceof FileMatch && elementB instanceof FileMatch) {
|
||||
>elementA instanceof FileMatch && elementB instanceof FileMatch : boolean
|
||||
>elementA instanceof FileMatch : boolean
|
||||
>elementA : FileMatch | Match
|
||||
>elementA : Match | FileMatch
|
||||
>FileMatch : typeof FileMatch
|
||||
>elementB instanceof FileMatch : boolean
|
||||
>elementB : FileMatch | Match
|
||||
>elementB : Match | FileMatch
|
||||
>FileMatch : typeof FileMatch
|
||||
|
||||
let a = elementA.resource().path;
|
||||
@@ -66,7 +66,7 @@ if (elementA instanceof FileMatch && elementB instanceof FileMatch) {
|
||||
>elementA : Match | FileMatch
|
||||
>Match : typeof Match
|
||||
>elementB instanceof Match : boolean
|
||||
>elementB : FileMatch | Match
|
||||
>elementB : Match | FileMatch
|
||||
>Match : typeof Match
|
||||
|
||||
let a = elementA.range();
|
||||
|
||||
Loaded 100 of 192 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user