mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Accepted baselines.
This commit is contained in:
@@ -1,7 +1,3 @@
|
||||
tests/cases/conformance/types/tuple/castingTuple.ts(13,23): error TS2352: Neither type '[number, string]' nor type '[number, string, boolean]' is assignable to the other.
|
||||
Property '2' is missing in type '[number, string]'.
|
||||
tests/cases/conformance/types/tuple/castingTuple.ts(16,21): error TS2352: Neither type '[C, D]' nor type '[C, D, A]' is assignable to the other.
|
||||
Property '2' is missing in type '[C, D]'.
|
||||
tests/cases/conformance/types/tuple/castingTuple.ts(28,10): error TS2352: Neither type '[number, string]' nor type '[number, number]' is assignable to the other.
|
||||
Types of property '1' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
@@ -10,15 +6,10 @@ tests/cases/conformance/types/tuple/castingTuple.ts(29,10): error TS2352: Neithe
|
||||
Type 'C' is not assignable to type 'A'.
|
||||
Property 'a' is missing in type 'C'.
|
||||
tests/cases/conformance/types/tuple/castingTuple.ts(30,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'.
|
||||
tests/cases/conformance/types/tuple/castingTuple.ts(30,14): error TS2352: Neither type '[number, string]' nor type 'number[]' is assignable to the other.
|
||||
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' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/tuple/castingTuple.ts(31,1): error TS2304: Cannot find name 't4'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/tuple/castingTuple.ts (7 errors) ====
|
||||
==== tests/cases/conformance/types/tuple/castingTuple.ts (4 errors) ====
|
||||
interface I { }
|
||||
class A { a = 10; }
|
||||
class C implements I { c };
|
||||
@@ -32,15 +23,9 @@ tests/cases/conformance/types/tuple/castingTuple.ts(31,1): error TS2304: Cannot
|
||||
var numStrTuple: [number, string] = [5, "foo"];
|
||||
var emptyObjTuple = <[{}, {}]>numStrTuple;
|
||||
var numStrBoolTuple = <[number, string, boolean]>numStrTuple;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2352: Neither type '[number, string]' nor type '[number, string, boolean]' is assignable to the other.
|
||||
!!! error TS2352: Property '2' is missing in type '[number, string]'.
|
||||
var classCDTuple: [C, D] = [new C(), new D()];
|
||||
var interfaceIITuple = <[I, I]>classCDTuple;
|
||||
var classCDATuple = <[C, D, A]>classCDTuple;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2352: Neither type '[C, D]' nor type '[C, D, A]' is assignable to the other.
|
||||
!!! error TS2352: Property '2' is missing in type '[C, D]'.
|
||||
var eleFromCDA1 = classCDATuple[2]; // A
|
||||
var eleFromCDA2 = classCDATuple[5]; // C | D | A
|
||||
var t10: [E1, E2] = [E1.one, E2.one];
|
||||
@@ -66,12 +51,6 @@ tests/cases/conformance/types/tuple/castingTuple.ts(31,1): error TS2304: Cannot
|
||||
var array1 = <number[]>numStrTuple;
|
||||
~~~~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'.
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2352: Neither type '[number, string]' nor type 'number[]' is assignable to the other.
|
||||
!!! error TS2352: Types of property 'pop' are incompatible.
|
||||
!!! error TS2352: Type '() => number | string' is not assignable to type '() => number'.
|
||||
!!! error TS2352: Type 'number | string' is not assignable to type 'number'.
|
||||
!!! error TS2352: Type 'string' is not assignable to type 'number'.
|
||||
t4[2] = 10;
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 't4'.
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(13,5): error TS2365: Operator '===' cannot be applied to types 'number | I2' and 'I1'.
|
||||
tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(13,16): error TS2365: Operator '===' cannot be applied to types 'I1' and 'number | I2'.
|
||||
tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(15,10): error TS2365: Operator '!==' cannot be applied to types 'number | I2' and 'I1'.
|
||||
tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(15,21): error TS2365: Operator '!==' cannot be applied to types 'I1' and 'number | I2'.
|
||||
tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(17,10): error TS2365: Operator '==' cannot be applied to types 'number | I2' and 'I1'.
|
||||
tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(17,20): error TS2365: Operator '==' cannot be applied to types 'I1' and 'number | I2'.
|
||||
tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(19,10): error TS2365: Operator '!=' cannot be applied to types 'number | I2' and 'I1'.
|
||||
tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(19,20): error TS2365: Operator '!=' cannot be applied to types 'I1' and 'number | I2'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts (8 errors) ====
|
||||
interface I1 {
|
||||
p1: number
|
||||
}
|
||||
|
||||
interface I2 extends I1 {
|
||||
p2: number;
|
||||
}
|
||||
|
||||
var x = { p1: 10, p2: 20 };
|
||||
var y: number | I2 = x;
|
||||
var z: I1 = x;
|
||||
|
||||
if (y === z || z === y) {
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '===' cannot be applied to types 'number | I2' and 'I1'.
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '===' cannot be applied to types 'I1' and 'number | I2'.
|
||||
}
|
||||
else if (y !== z || z !== y) {
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '!==' cannot be applied to types 'number | I2' and 'I1'.
|
||||
~~~~~~~
|
||||
!!! error TS2365: Operator '!==' cannot be applied to types 'I1' and 'number | I2'.
|
||||
}
|
||||
else if (y == z || z == y) {
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '==' cannot be applied to types 'number | I2' and 'I1'.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '==' cannot be applied to types 'I1' and 'number | I2'.
|
||||
}
|
||||
else if (y != z || z != y) {
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '!=' cannot be applied to types 'number | I2' and 'I1'.
|
||||
~~~~~~
|
||||
!!! error TS2365: Operator '!=' cannot be applied to types 'I1' and 'number | I2'.
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
=== tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts ===
|
||||
interface I1 {
|
||||
>I1 : Symbol(I1, Decl(equalityWithUnionTypes01.ts, 0, 0))
|
||||
|
||||
p1: number
|
||||
>p1 : Symbol(p1, Decl(equalityWithUnionTypes01.ts, 0, 14))
|
||||
}
|
||||
|
||||
interface I2 extends I1 {
|
||||
>I2 : Symbol(I2, Decl(equalityWithUnionTypes01.ts, 2, 1))
|
||||
>I1 : Symbol(I1, Decl(equalityWithUnionTypes01.ts, 0, 0))
|
||||
|
||||
p2: number;
|
||||
>p2 : Symbol(p2, Decl(equalityWithUnionTypes01.ts, 4, 25))
|
||||
}
|
||||
|
||||
var x = { p1: 10, p2: 20 };
|
||||
>x : Symbol(x, Decl(equalityWithUnionTypes01.ts, 8, 3))
|
||||
>p1 : Symbol(p1, Decl(equalityWithUnionTypes01.ts, 8, 9))
|
||||
>p2 : Symbol(p2, Decl(equalityWithUnionTypes01.ts, 8, 17))
|
||||
|
||||
var y: number | I2 = x;
|
||||
>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3))
|
||||
>I2 : Symbol(I2, Decl(equalityWithUnionTypes01.ts, 2, 1))
|
||||
>x : Symbol(x, Decl(equalityWithUnionTypes01.ts, 8, 3))
|
||||
|
||||
var z: I1 = x;
|
||||
>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3))
|
||||
>I1 : Symbol(I1, Decl(equalityWithUnionTypes01.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(equalityWithUnionTypes01.ts, 8, 3))
|
||||
|
||||
if (y === z || z === y) {
|
||||
>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3))
|
||||
>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3))
|
||||
>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3))
|
||||
>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3))
|
||||
}
|
||||
else if (y !== z || z !== y) {
|
||||
>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3))
|
||||
>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3))
|
||||
>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3))
|
||||
>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3))
|
||||
}
|
||||
else if (y == z || z == y) {
|
||||
>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3))
|
||||
>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3))
|
||||
>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3))
|
||||
>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3))
|
||||
}
|
||||
else if (y != z || z != y) {
|
||||
>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3))
|
||||
>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3))
|
||||
>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3))
|
||||
>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3))
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
=== tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts ===
|
||||
interface I1 {
|
||||
>I1 : I1
|
||||
|
||||
p1: number
|
||||
>p1 : number
|
||||
}
|
||||
|
||||
interface I2 extends I1 {
|
||||
>I2 : I2
|
||||
>I1 : I1
|
||||
|
||||
p2: number;
|
||||
>p2 : number
|
||||
}
|
||||
|
||||
var x = { p1: 10, p2: 20 };
|
||||
>x : { p1: number; p2: number; }
|
||||
>{ p1: 10, p2: 20 } : { p1: number; p2: number; }
|
||||
>p1 : number
|
||||
>10 : number
|
||||
>p2 : number
|
||||
>20 : number
|
||||
|
||||
var y: number | I2 = x;
|
||||
>y : number | I2
|
||||
>I2 : I2
|
||||
>x : { p1: number; p2: number; }
|
||||
|
||||
var z: I1 = x;
|
||||
>z : I1
|
||||
>I1 : I1
|
||||
>x : { p1: number; p2: number; }
|
||||
|
||||
if (y === z || z === y) {
|
||||
>y === z || z === y : boolean
|
||||
>y === z : boolean
|
||||
>y : number | I2
|
||||
>z : I1
|
||||
>z === y : boolean
|
||||
>z : I1
|
||||
>y : number | I2
|
||||
}
|
||||
else if (y !== z || z !== y) {
|
||||
>y !== z || z !== y : boolean
|
||||
>y !== z : boolean
|
||||
>y : number | I2
|
||||
>z : I1
|
||||
>z !== y : boolean
|
||||
>z : I1
|
||||
>y : number | I2
|
||||
}
|
||||
else if (y == z || z == y) {
|
||||
>y == z || z == y : boolean
|
||||
>y == z : boolean
|
||||
>y : number | I2
|
||||
>z : I1
|
||||
>z == y : boolean
|
||||
>z : I1
|
||||
>y : number | I2
|
||||
}
|
||||
else if (y != z || z != y) {
|
||||
>y != z || z != y : boolean
|
||||
>y != z : boolean
|
||||
>y : number | I2
|
||||
>z : I1
|
||||
>z != y : boolean
|
||||
>z : I1
|
||||
>y : number | I2
|
||||
}
|
||||
@@ -1,11 +1,8 @@
|
||||
tests/cases/conformance/types/typeRelationships/matchable/switchCaseWithUnionTypes01.ts(19,10): error TS2322: Type 'number | boolean' is not assignable to type 'string | number'.
|
||||
Type 'boolean' is not assignable to type 'string | number'.
|
||||
Type 'boolean' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/typeRelationships/matchable/switchCaseWithUnionTypes01.ts(23,10): error TS2322: Type 'boolean' is not assignable to type 'string | number'.
|
||||
Type 'boolean' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/matchable/switchCaseWithUnionTypes01.ts (2 errors) ====
|
||||
==== tests/cases/conformance/types/typeRelationships/matchable/switchCaseWithUnionTypes01.ts (1 errors) ====
|
||||
|
||||
var strOrNum: string | number;
|
||||
var numOrBool: number | boolean;
|
||||
@@ -25,10 +22,6 @@ tests/cases/conformance/types/typeRelationships/matchable/switchCaseWithUnionTyp
|
||||
|
||||
// Overlap in constituents
|
||||
case numOrBool:
|
||||
~~~~~~~~~
|
||||
!!! error TS2322: Type 'number | boolean' is not assignable to type 'string | number'.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'.
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type 'number'.
|
||||
break;
|
||||
|
||||
// No relation
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
tests/cases/conformance/types/typeRelationships/matchable/typeAssertionsWithUnionTypes01.ts(13,9): error TS2352: Neither type 'I1' nor type 'number | I2' is assignable to the other.
|
||||
Type 'I1' is not assignable to type 'I2'.
|
||||
Property 'p2' is missing in type 'I1'.
|
||||
tests/cases/conformance/types/typeRelationships/matchable/typeAssertionsWithUnionTypes01.ts(14,9): error TS2352: Neither type 'I1' nor type 'number' is assignable to the other.
|
||||
tests/cases/conformance/types/typeRelationships/matchable/typeAssertionsWithUnionTypes01.ts(16,9): error TS2352: Neither type 'number | I2' nor type 'I1' is assignable to the other.
|
||||
Type 'number' is not assignable to type 'I1'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/matchable/typeAssertionsWithUnionTypes01.ts (3 errors) ====
|
||||
==== tests/cases/conformance/types/typeRelationships/matchable/typeAssertionsWithUnionTypes01.ts (1 errors) ====
|
||||
interface I1 {
|
||||
p1: number
|
||||
}
|
||||
@@ -20,16 +15,9 @@ tests/cases/conformance/types/typeRelationships/matchable/typeAssertionsWithUnio
|
||||
var z: I1 = x;
|
||||
|
||||
var a = <number | I2>z;
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2352: Neither type 'I1' nor type 'number | I2' is assignable to the other.
|
||||
!!! error TS2352: Type 'I1' is not assignable to type 'I2'.
|
||||
!!! error TS2352: Property 'p2' is missing in type 'I1'.
|
||||
var b = <number>z;
|
||||
~~~~~~~~~
|
||||
!!! error TS2352: Neither type 'I1' nor type 'number' is assignable to the other.
|
||||
var c = <I2>z;
|
||||
var d = <I1>y;
|
||||
~~~~~
|
||||
!!! error TS2352: Neither type 'number | I2' nor type 'I1' is assignable to the other.
|
||||
!!! error TS2352: Type 'number' is not assignable to type 'I1'.
|
||||
|
||||
Reference in New Issue
Block a user