Skip to content

Commit 3c36339

Browse files
committed
Accept new baselines
1 parent 9d5e8fe commit 3c36339

File tree

4 files changed

+32
-11
lines changed

4 files changed

+32
-11
lines changed

tests/baselines/reference/objectRestNegative.errors.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ tests/cases/conformance/types/rest/objectRestNegative.ts(6,10): error TS2322: Ty
55
tests/cases/conformance/types/rest/objectRestNegative.ts(9,31): error TS2462: A rest element must be last in a destructuring pattern.
66
tests/cases/conformance/types/rest/objectRestNegative.ts(11,30): error TS7008: Member 'x' implicitly has an 'any' type.
77
tests/cases/conformance/types/rest/objectRestNegative.ts(11,33): error TS7008: Member 'y' implicitly has an 'any' type.
8+
tests/cases/conformance/types/rest/objectRestNegative.ts(12,17): error TS2700: Rest types may only be created from object types.
89
tests/cases/conformance/types/rest/objectRestNegative.ts(17,9): error TS2701: The target of an object rest assignment must be a variable or a property access.
910

1011

11-
==== tests/cases/conformance/types/rest/objectRestNegative.ts (6 errors) ====
12+
==== tests/cases/conformance/types/rest/objectRestNegative.ts (7 errors) ====
1213
let o = { a: 1, b: 'no' };
1314
var { ...mustBeLast, a } = o;
1415
~~~~~~~~~~
@@ -33,6 +34,8 @@ tests/cases/conformance/types/rest/objectRestNegative.ts(17,9): error TS2701: Th
3334
~
3435
!!! error TS7008: Member 'y' implicitly has an 'any' type.
3536
let { x, ...rest } = t;
37+
~~~~
38+
!!! error TS2700: Rest types may only be created from object types.
3639
return rest;
3740
}
3841

tests/baselines/reference/objectRestNegative.types

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,18 @@ function stillMustBeLast({ ...mustBeLast, a }: { a: number, b: string }): void {
3636
>b : string
3737
}
3838
function generic<T extends { x, y }>(t: T) {
39-
>generic : <T extends { x: any; y: any; }>(t: T) => { y: any; }
39+
>generic : <T extends { x: any; y: any; }>(t: T) => any
4040
>x : any
4141
>y : any
4242
>t : T
4343

4444
let { x, ...rest } = t;
4545
>x : any
46-
>rest : { y: any; }
46+
>rest : any
4747
>t : T
4848

4949
return rest;
50-
>rest : { y: any; }
50+
>rest : any
5151
}
5252

5353
let rest: { b: string }

tests/baselines/reference/restInvalidArgumentType.errors.txt

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1+
tests/cases/compiler/restInvalidArgumentType.ts(27,13): error TS2700: Rest types may only be created from object types.
2+
tests/cases/compiler/restInvalidArgumentType.ts(29,13): error TS2700: Rest types may only be created from object types.
3+
tests/cases/compiler/restInvalidArgumentType.ts(30,13): error TS2700: Rest types may only be created from object types.
14
tests/cases/compiler/restInvalidArgumentType.ts(31,13): error TS2700: Rest types may only be created from object types.
5+
tests/cases/compiler/restInvalidArgumentType.ts(33,13): error TS2700: Rest types may only be created from object types.
6+
tests/cases/compiler/restInvalidArgumentType.ts(36,13): error TS2700: Rest types may only be created from object types.
27
tests/cases/compiler/restInvalidArgumentType.ts(37,13): error TS2700: Rest types may only be created from object types.
8+
tests/cases/compiler/restInvalidArgumentType.ts(39,13): error TS2700: Rest types may only be created from object types.
39
tests/cases/compiler/restInvalidArgumentType.ts(40,13): error TS2700: Rest types may only be created from object types.
410
tests/cases/compiler/restInvalidArgumentType.ts(42,13): error TS2700: Rest types may only be created from object types.
511
tests/cases/compiler/restInvalidArgumentType.ts(43,13): error TS2700: Rest types may only be created from object types.
@@ -10,7 +16,7 @@ tests/cases/compiler/restInvalidArgumentType.ts(51,13): error TS2700: Rest types
1016
tests/cases/compiler/restInvalidArgumentType.ts(53,13): error TS2700: Rest types may only be created from object types.
1117

1218

13-
==== tests/cases/compiler/restInvalidArgumentType.ts (10 errors) ====
19+
==== tests/cases/compiler/restInvalidArgumentType.ts (16 errors) ====
1420
enum E { v1, v2 };
1521

1622
function f<T extends { b: string }>(p1: T, p2: T[]) {
@@ -38,22 +44,34 @@ tests/cases/compiler/restInvalidArgumentType.ts(53,13): error TS2700: Rest types
3844
var a: any;
3945

4046
var {...r1} = p1; // Error, generic type paramterre
47+
~~
48+
!!! error TS2700: Rest types may only be created from object types.
4149
var {...r2} = p2; // OK
4250
var {...r3} = t; // Error, generic type paramter
51+
~~
52+
!!! error TS2700: Rest types may only be created from object types.
4353
var {...r4} = i; // Error, index access
54+
~~
55+
!!! error TS2700: Rest types may only be created from object types.
4456
var {...r5} = k; // Error, index
4557
~~
4658
!!! error TS2700: Rest types may only be created from object types.
4759

4860
var {...r6} = mapped_generic; // Error, generic mapped object type
61+
~~
62+
!!! error TS2700: Rest types may only be created from object types.
4963
var {...r7} = mapped; // OK, non-generic mapped type
5064

5165
var {...r8} = union_generic; // Error, union with generic type parameter
66+
~~
67+
!!! error TS2700: Rest types may only be created from object types.
5268
var {...r9} = union_primitive; // Error, union with generic type parameter
5369
~~
5470
!!! error TS2700: Rest types may only be created from object types.
5571

5672
var {...r10} = intersection_generic; // Error, intersection with generic type parameter
73+
~~~
74+
!!! error TS2700: Rest types may only be created from object types.
5775
var {...r11} = intersection_primitive; // Error, intersection with generic type parameter
5876
~~~
5977
!!! error TS2700: Rest types may only be created from object types.

tests/baselines/reference/restInvalidArgumentType.types

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,43 +67,43 @@ function f<T extends { b: string }>(p1: T, p2: T[]) {
6767
>a : any
6868

6969
var {...r1} = p1; // Error, generic type paramterre
70-
>r1 : { b: string; }
70+
>r1 : any
7171
>p1 : T
7272

7373
var {...r2} = p2; // OK
7474
>r2 : { [n: number]: T; length: number; toString(): string; toLocaleString(): string; pop(): T; push(...items: T[]): number; concat(...items: ConcatArray<T>[]): T[]; concat(...items: (T | ConcatArray<T>)[]): T[]; join(separator?: string): string; reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; sort(compareFn?: (a: T, b: T) => number): T[]; splice(start: number, deleteCount?: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; indexOf(searchElement: T, fromIndex?: number): number; lastIndexOf(searchElement: T, fromIndex?: number): number; every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; filter<S extends T>(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; }
7575
>p2 : T[]
7676

7777
var {...r3} = t; // Error, generic type paramter
78-
>r3 : { b: string; }
78+
>r3 : any
7979
>t : T
8080

8181
var {...r4} = i; // Error, index access
82-
>r4 : { readonly [index: number]: string; toString(): string; charAt(pos: number): string; charCodeAt(index: number): number; concat(...strings: string[]): string; indexOf(searchString: string, position?: number): number; lastIndexOf(searchString: string, position?: number): number; localeCompare(that: string): number; localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number; match(regexp: string | RegExp): RegExpMatchArray; replace(searchValue: string | RegExp, replaceValue: string): string; replace(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; search(regexp: string | RegExp): number; slice(start?: number, end?: number): string; split(separator: string | RegExp, limit?: number): string[]; substring(start: number, end?: number): string; toLowerCase(): string; toLocaleLowerCase(): string; toUpperCase(): string; toLocaleUpperCase(): string; trim(): string; length: number; substr(from: number, length?: number): string; valueOf(): string; }
82+
>r4 : any
8383
>i : T["b"]
8484

8585
var {...r5} = k; // Error, index
8686
>r5 : any
8787
>k : keyof T
8888

8989
var {...r6} = mapped_generic; // Error, generic mapped object type
90-
>r6 : { b: T["b"]; }
90+
>r6 : any
9191
>mapped_generic : { [P in keyof T]: T[P]; }
9292

9393
var {...r7} = mapped; // OK, non-generic mapped type
9494
>r7 : { b: T["b"]; }
9595
>mapped : { b: T["b"]; }
9696

9797
var {...r8} = union_generic; // Error, union with generic type parameter
98-
>r8 : { b: string; } | { a: number; }
98+
>r8 : any
9999
>union_generic : T | { a: number; }
100100

101101
var {...r9} = union_primitive; // Error, union with generic type parameter
102102
>r9 : any
103103
>union_primitive : number | { a: number; }
104104

105105
var {...r10} = intersection_generic; // Error, intersection with generic type parameter
106-
>r10 : { b: string; a: number; }
106+
>r10 : any
107107
>intersection_generic : T & { a: number; }
108108

109109
var {...r11} = intersection_primitive; // Error, intersection with generic type parameter

0 commit comments

Comments
 (0)