mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 03:45:33 -05:00
Update baselines
This commit is contained in:
@@ -40,7 +40,7 @@ tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(32,5): error
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts (19 errors) ====
|
||||
interface StrNum extends Array<string|number> {
|
||||
interface StrNum extends TupleBase<string|number> {
|
||||
0: string;
|
||||
1: number;
|
||||
length: 2;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//// [arityAndOrderCompatibility01.ts]
|
||||
interface StrNum extends Array<string|number> {
|
||||
interface StrNum extends TupleBase<string|number> {
|
||||
0: string;
|
||||
1: number;
|
||||
length: 2;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts ===
|
||||
interface StrNum extends Array<string|number> {
|
||||
interface StrNum extends TupleBase<string|number> {
|
||||
>StrNum : Symbol(StrNum, Decl(arityAndOrderCompatibility01.ts, 0, 0))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>TupleBase : Symbol(TupleBase, Decl(lib.d.ts, --, --))
|
||||
|
||||
0: string;
|
||||
1: number;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
=== tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts ===
|
||||
interface StrNum extends Array<string|number> {
|
||||
interface StrNum extends TupleBase<string|number> {
|
||||
>StrNum : StrNum
|
||||
>Array : T[]
|
||||
>TupleBase : TupleBase<T>
|
||||
|
||||
0: string;
|
||||
1: number;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
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 '() => 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'.
|
||||
Types of property 'concat' are incompatible.
|
||||
Type '{ (...items: ReadonlyArray<string | number>[]): (string | number)[]; (...items: (string | number | ReadonlyArray<string | number>)[]): (string | number)[]; }' is not assignable to type '{ (...items: ReadonlyArray<number>[]): number[]; (...items: (number | ReadonlyArray<number>)[]): 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 '{}[]'.
|
||||
|
||||
@@ -27,10 +28,11 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
numArray = numStrTuple;
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type '[number, string]' is not assignable to type 'number[]'.
|
||||
!!! error TS2322: Types of property 'pop' are incompatible.
|
||||
!!! 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'.
|
||||
!!! error TS2322: Types of property 'concat' are incompatible.
|
||||
!!! error TS2322: Type '{ (...items: ReadonlyArray<string | number>[]): (string | number)[]; (...items: (string | number | ReadonlyArray<string | number>)[]): (string | number)[]; }' is not assignable to type '{ (...items: ReadonlyArray<number>[]): number[]; (...items: (number | ReadonlyArray<number>)[]): 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;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{}[]' is not assignable to type '[{}]'.
|
||||
|
||||
@@ -10,15 +10,17 @@ tests/cases/compiler/tupleTypes.ts(18,1): error TS2322: Type '[number, string, n
|
||||
Type '3' is not assignable to type '2'.
|
||||
tests/cases/compiler/tupleTypes.ts(41,1): error TS2322: Type 'undefined[]' is not assignable to type '[number, string]'.
|
||||
tests/cases/compiler/tupleTypes.ts(47,1): error TS2322: Type '[number, string]' is not assignable to type 'number[]'.
|
||||
Types of property 'pop' are incompatible.
|
||||
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'.
|
||||
Types of property 'concat' are incompatible.
|
||||
Type '{ (...items: ReadonlyArray<string | number>[]): (string | number)[]; (...items: (string | number | ReadonlyArray<string | number>)[]): (string | number)[]; }' is not assignable to type '{ (...items: ReadonlyArray<number>[]): number[]; (...items: (number | ReadonlyArray<number>)[]): 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/compiler/tupleTypes.ts(49,1): error TS2322: Type '[number, {}]' is not assignable to type 'number[]'.
|
||||
Types of property 'pop' are incompatible.
|
||||
Type '() => number | {}' is not assignable to type '() => number'.
|
||||
Type 'number | {}' is not assignable to type 'number'.
|
||||
Type '{}' is not assignable to type 'number'.
|
||||
Types of property 'concat' are incompatible.
|
||||
Type '{ (...items: ReadonlyArray<number | {}>[]): (number | {})[]; (...items: (number | {} | ReadonlyArray<number | {}>)[]): (number | {})[]; }' is not assignable to type '{ (...items: ReadonlyArray<number>[]): number[]; (...items: (number | ReadonlyArray<number>)[]): number[]; }'.
|
||||
Type '(number | {})[]' is not assignable to type 'number[]'.
|
||||
Type 'number | {}' is not assignable to type 'number'.
|
||||
Type '{}' is not assignable to type 'number'.
|
||||
tests/cases/compiler/tupleTypes.ts(50,1): error TS2322: Type '[number, number]' is not assignable to type '[number, string]'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/compiler/tupleTypes.ts(51,1): error TS2322: Type '[number, {}]' is not assignable to type '[number, string]'.
|
||||
@@ -92,18 +94,20 @@ tests/cases/compiler/tupleTypes.ts(51,1): error TS2322: Type '[number, {}]' is n
|
||||
a = a1; // Error
|
||||
~
|
||||
!!! error TS2322: Type '[number, string]' is not assignable to type 'number[]'.
|
||||
!!! error TS2322: Types of property 'pop' are incompatible.
|
||||
!!! 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'.
|
||||
!!! error TS2322: Types of property 'concat' are incompatible.
|
||||
!!! error TS2322: Type '{ (...items: ReadonlyArray<string | number>[]): (string | number)[]; (...items: (string | number | ReadonlyArray<string | number>)[]): (string | number)[]; }' is not assignable to type '{ (...items: ReadonlyArray<number>[]): number[]; (...items: (number | ReadonlyArray<number>)[]): 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'.
|
||||
a = a2;
|
||||
a = a3; // Error
|
||||
~
|
||||
!!! error TS2322: Type '[number, {}]' is not assignable to type 'number[]'.
|
||||
!!! error TS2322: Types of property 'pop' are incompatible.
|
||||
!!! error TS2322: Type '() => number | {}' is not assignable to type '() => number'.
|
||||
!!! error TS2322: Type 'number | {}' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type '{}' is not assignable to type 'number'.
|
||||
!!! error TS2322: Types of property 'concat' are incompatible.
|
||||
!!! error TS2322: Type '{ (...items: ReadonlyArray<number | {}>[]): (number | {})[]; (...items: (number | {} | ReadonlyArray<number | {}>)[]): (number | {})[]; }' is not assignable to type '{ (...items: ReadonlyArray<number>[]): number[]; (...items: (number | ReadonlyArray<number>)[]): number[]; }'.
|
||||
!!! error TS2322: Type '(number | {})[]' is not assignable to type 'number[]'.
|
||||
!!! error TS2322: Type 'number | {}' is not assignable to type 'number'.
|
||||
!!! error TS2322: Type '{}' is not assignable to type 'number'.
|
||||
a1 = a2; // Error
|
||||
~~
|
||||
!!! error TS2322: Type '[number, number]' is not assignable to type '[number, string]'.
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
tests/cases/conformance/types/tuple/typeInferenceWithTupleType.ts(16,9): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'never' has no compatible call signatures.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/tuple/typeInferenceWithTupleType.ts (1 errors) ====
|
||||
function combine<T, U>(x: T, y: U): [T, U] {
|
||||
return [x, y];
|
||||
}
|
||||
|
||||
var combineResult = combine("string", 10);
|
||||
var combineEle1 = combineResult[0]; // string
|
||||
var combineEle2 = combineResult[1]; // number
|
||||
|
||||
function zip<T, U>(array1: T[], array2: U[]): [[T, U]] {
|
||||
if (array1.length != array2.length) {
|
||||
return [[undefined, undefined]];
|
||||
}
|
||||
var length = array1.length;
|
||||
var zipResult: [[T, U]];
|
||||
for (var i = 0; i < length; ++i) {
|
||||
zipResult.push([array1[i], array2[i]]);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'never' has no compatible call signatures.
|
||||
}
|
||||
return zipResult;
|
||||
}
|
||||
|
||||
var zipResult = zip(["foo", "bar"], [5, 6]);
|
||||
var zipResultEle = zipResult[0]; // [string, number]
|
||||
var zipResultEleEle = zipResult[0][0]; // string
|
||||
|
||||
|
||||
@@ -70,9 +70,9 @@ function zip<T, U>(array1: T[], array2: U[]): [[T, U]] {
|
||||
>i : Symbol(i, Decl(typeInferenceWithTupleType.ts, 14, 12))
|
||||
|
||||
zipResult.push([array1[i], array2[i]]);
|
||||
>zipResult.push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
>zipResult.push : Symbol(TupleBase.push, Decl(lib.d.ts, --, --))
|
||||
>zipResult : Symbol(zipResult, Decl(typeInferenceWithTupleType.ts, 13, 7))
|
||||
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
|
||||
>push : Symbol(TupleBase.push, Decl(lib.d.ts, --, --))
|
||||
>array1 : Symbol(array1, Decl(typeInferenceWithTupleType.ts, 8, 19))
|
||||
>i : Symbol(i, Decl(typeInferenceWithTupleType.ts, 14, 12))
|
||||
>array2 : Symbol(array2, Decl(typeInferenceWithTupleType.ts, 8, 31))
|
||||
|
||||
@@ -82,11 +82,11 @@ function zip<T, U>(array1: T[], array2: U[]): [[T, U]] {
|
||||
>i : number
|
||||
|
||||
zipResult.push([array1[i], array2[i]]);
|
||||
>zipResult.push([array1[i], array2[i]]) : number
|
||||
>zipResult.push : (...items: [T, U][]) => number
|
||||
>zipResult.push([array1[i], array2[i]]) : any
|
||||
>zipResult.push : never
|
||||
>zipResult : [[T, U]]
|
||||
>push : (...items: [T, U][]) => number
|
||||
>[array1[i], array2[i]] : [T, U]
|
||||
>push : never
|
||||
>[array1[i], array2[i]] : (T | U)[]
|
||||
>array1[i] : T
|
||||
>array1 : T[]
|
||||
>i : number
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
interface StrNum extends Array<string|number> {
|
||||
interface StrNum extends TupleBase<string|number> {
|
||||
0: string;
|
||||
1: number;
|
||||
length: 2;
|
||||
|
||||
Reference in New Issue
Block a user