Skip to content

Commit

Permalink
Accept new baselines
Browse files Browse the repository at this point in the history
  • Loading branch information
ahejlsberg committed Aug 25, 2020
1 parent fa46b60 commit 355706d
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 1 deletion.
21 changes: 20 additions & 1 deletion tests/baselines/reference/variadicTuples1.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@ tests/cases/conformance/types/tuple/variadicTuples1.ts(203,5): error TS2322: Typ
Type '"2"' is not assignable to type 'number | "0" | "length" | "toString" | "toLocaleString" | "pop" | "push" | "concat" | "join" | "reverse" | "shift" | "slice" | "sort" | "splice" | "unshift" | "indexOf" | "lastIndexOf" | "every" | "some" | "forEach" | "map" | "filter" | "reduce" | "reduceRight" | "1"'.
tests/cases/conformance/types/tuple/variadicTuples1.ts(346,14): error TS7019: Rest parameter 'x' implicitly has an 'any[]' type.
tests/cases/conformance/types/tuple/variadicTuples1.ts(354,26): error TS2322: Type 'string' is not assignable to type 'number | undefined'.
tests/cases/conformance/types/tuple/variadicTuples1.ts(393,19): error TS1256: A rest element must be last in a tuple type.
tests/cases/conformance/types/tuple/variadicTuples1.ts(396,20): error TS1256: A rest element must be last in a tuple type.
tests/cases/conformance/types/tuple/variadicTuples1.ts(397,12): error TS1256: A rest element must be last in a tuple type.


==== tests/cases/conformance/types/tuple/variadicTuples1.ts (20 errors) ====
==== tests/cases/conformance/types/tuple/variadicTuples1.ts (23 errors) ====
// Variadics in tuple types

type TV0<T extends unknown[]> = [string, ...T];
Expand Down Expand Up @@ -496,4 +499,20 @@ tests/cases/conformance/types/tuple/variadicTuples1.ts(354,26): error TS2322: Ty

callApi(getUser);
callApi(getOrgUser);

// Repro from #40235

type Numbers = number[];
type Unbounded = [...Numbers, boolean];
~~~~~~~~~~
!!! error TS1256: A rest element must be last in a tuple type.
const data: Unbounded = [false, false];

type U1 = [string, ...Numbers, boolean];
~~~~~~~~~~
!!! error TS1256: A rest element must be last in a tuple type.
type U2 = [...[string, ...Numbers], boolean];
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1256: A rest element must be last in a tuple type.
type U3 = [...[string, number], boolean];

17 changes: 17 additions & 0 deletions tests/baselines/reference/variadicTuples1.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,16 @@ function callApi<T extends unknown[] = [], U = void>(method: (...args: [...T, ob

callApi(getUser);
callApi(getOrgUser);

// Repro from #40235

type Numbers = number[];
type Unbounded = [...Numbers, boolean];
const data: Unbounded = [false, false];

type U1 = [string, ...Numbers, boolean];
type U2 = [...[string, ...Numbers], boolean];
type U3 = [...[string, number], boolean];


//// [variadicTuples1.js]
Expand Down Expand Up @@ -609,6 +619,7 @@ function callApi(method) {
}
callApi(getUser);
callApi(getOrgUser);
var data = [false, false];


//// [variadicTuples1.d.ts]
Expand Down Expand Up @@ -774,3 +785,9 @@ declare function getOrgUser(id: string, orgId: number, options?: {
z?: boolean;
}): void;
declare function callApi<T extends unknown[] = [], U = void>(method: (...args: [...T, object]) => U): (...args_0: T) => U;
declare type Numbers = number[];
declare type Unbounded = [...Numbers, boolean];
declare const data: Unbounded;
declare type U1 = [string, ...Numbers, boolean];
declare type U2 = [...[string, ...Numbers], boolean];
declare type U3 = [...[string, number], boolean];
24 changes: 24 additions & 0 deletions tests/baselines/reference/variadicTuples1.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -1327,3 +1327,27 @@ callApi(getOrgUser);
>callApi : Symbol(callApi, Decl(variadicTuples1.ts, 380, 100))
>getOrgUser : Symbol(getOrgUser, Decl(variadicTuples1.ts, 378, 71))

// Repro from #40235

type Numbers = number[];
>Numbers : Symbol(Numbers, Decl(variadicTuples1.ts, 387, 20))

type Unbounded = [...Numbers, boolean];
>Unbounded : Symbol(Unbounded, Decl(variadicTuples1.ts, 391, 24))
>Numbers : Symbol(Numbers, Decl(variadicTuples1.ts, 387, 20))

const data: Unbounded = [false, false];
>data : Symbol(data, Decl(variadicTuples1.ts, 393, 5))
>Unbounded : Symbol(Unbounded, Decl(variadicTuples1.ts, 391, 24))

type U1 = [string, ...Numbers, boolean];
>U1 : Symbol(U1, Decl(variadicTuples1.ts, 393, 39))
>Numbers : Symbol(Numbers, Decl(variadicTuples1.ts, 387, 20))

type U2 = [...[string, ...Numbers], boolean];
>U2 : Symbol(U2, Decl(variadicTuples1.ts, 395, 40))
>Numbers : Symbol(Numbers, Decl(variadicTuples1.ts, 387, 20))

type U3 = [...[string, number], boolean];
>U3 : Symbol(U3, Decl(variadicTuples1.ts, 396, 45))

23 changes: 23 additions & 0 deletions tests/baselines/reference/variadicTuples1.types
Original file line number Diff line number Diff line change
Expand Up @@ -1383,3 +1383,26 @@ callApi(getOrgUser);
>callApi : <T extends unknown[] = [], U = void>(method: (...args_0: T, args_1: object) => U) => (...args_0: T) => U
>getOrgUser : (id: string, orgId: number, options?: { y?: number | undefined; z?: boolean | undefined; } | undefined) => void

// Repro from #40235

type Numbers = number[];
>Numbers : Numbers

type Unbounded = [...Numbers, boolean];
>Unbounded : (number | boolean)[]

const data: Unbounded = [false, false];
>data : (number | boolean)[]
>[false, false] : false[]
>false : false
>false : false

type U1 = [string, ...Numbers, boolean];
>U1 : [string, ...(number | boolean)[]]

type U2 = [...[string, ...Numbers], boolean];
>U2 : [string, ...(number | boolean)[]]

type U3 = [...[string, number], boolean];
>U3 : [string, number, boolean]

0 comments on commit 355706d

Please sign in to comment.