Skip to content

Commit 00c3015

Browse files
committed
Accept new baselines
1 parent 7a47248 commit 00c3015

8 files changed

+36
-81
lines changed

tests/baselines/reference/objectRestNegative.errors.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ 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.
98
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.
109

1110

12-
==== tests/cases/conformance/types/rest/objectRestNegative.ts (7 errors) ====
11+
==== tests/cases/conformance/types/rest/objectRestNegative.ts (6 errors) ====
1312
let o = { a: 1, b: 'no' };
1413
var { ...mustBeLast, a } = o;
1514
~~~~~~~~~~
@@ -34,8 +33,6 @@ tests/cases/conformance/types/rest/objectRestNegative.ts(17,9): error TS2701: Th
3433
~
3534
!!! error TS7008: Member 'y' implicitly has an 'any' type.
3635
let { x, ...rest } = t;
37-
~~~~
38-
!!! error TS2700: Rest types may only be created from object types.
3936
return rest;
4037
}
4138

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) => any
39+
>generic : <T extends { x: any; y: any; }>(t: T) => { y: any; }
4040
>x : any
4141
>y : any
4242
>t : T
4343

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

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

5353
let rest: { b: string }

tests/baselines/reference/objectSpreadNegative.errors.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ tests/cases/conformance/types/spread/objectSpreadNegative.ts(43,1): error TS2349
1616
tests/cases/conformance/types/spread/objectSpreadNegative.ts(47,12): error TS2339: Property 'b' does not exist on type '{}'.
1717
tests/cases/conformance/types/spread/objectSpreadNegative.ts(53,9): error TS2339: Property 'm' does not exist on type '{ p: number; }'.
1818
tests/cases/conformance/types/spread/objectSpreadNegative.ts(58,11): error TS2339: Property 'a' does not exist on type '{}'.
19-
tests/cases/conformance/types/spread/objectSpreadNegative.ts(62,14): error TS2698: Spread types may only be created from object types.
20-
tests/cases/conformance/types/spread/objectSpreadNegative.ts(65,14): error TS2698: Spread types may only be created from object types.
2119

2220

23-
==== tests/cases/conformance/types/spread/objectSpreadNegative.ts (17 errors) ====
21+
==== tests/cases/conformance/types/spread/objectSpreadNegative.ts (15 errors) ====
2422
let o = { a: 1, b: 'no' }
2523

2624
/// private propagates
@@ -116,13 +114,9 @@ tests/cases/conformance/types/spread/objectSpreadNegative.ts(65,14): error TS269
116114
// generics
117115
function f<T, U>(t: T, u: U) {
118116
return { ...t, ...u, id: 'id' };
119-
~~~~
120-
!!! error TS2698: Spread types may only be created from object types.
121117
}
122118
function override<U>(initial: U, override: U): U {
123119
return { ...initial, ...override };
124-
~~~~~~~~~~
125-
!!! error TS2698: Spread types may only be created from object types.
126120
}
127121
let exclusive: { id: string, a: number, b: string, c: string, d: boolean } =
128122
f({ a: 1, b: 'yes' }, { c: 'no', d: false })

tests/baselines/reference/objectSpreadNegative.types

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,12 @@ spreadObj.a; // error 'a' is not in {}
228228

229229
// generics
230230
function f<T, U>(t: T, u: U) {
231-
>f : <T, U>(t: T, u: U) => any
231+
>f : <T, U>(t: T, u: U) => T & U & { id: string; }
232232
>t : T
233233
>u : U
234234

235235
return { ...t, ...u, id: 'id' };
236-
>{ ...t, ...u, id: 'id' } : any
236+
>{ ...t, ...u, id: 'id' } : T & U & { id: string; }
237237
>t : T
238238
>u : U
239239
>id : string
@@ -245,7 +245,7 @@ function override<U>(initial: U, override: U): U {
245245
>override : U
246246

247247
return { ...initial, ...override };
248-
>{ ...initial, ...override } : any
248+
>{ ...initial, ...override } : U
249249
>initial : U
250250
>override : U
251251
}
@@ -258,8 +258,8 @@ let exclusive: { id: string, a: number, b: string, c: string, d: boolean } =
258258
>d : boolean
259259

260260
f({ a: 1, b: 'yes' }, { c: 'no', d: false })
261-
>f({ a: 1, b: 'yes' }, { c: 'no', d: false }) : any
262-
>f : <T, U>(t: T, u: U) => any
261+
>f({ a: 1, b: 'yes' }, { c: 'no', d: false }) : { a: number; b: string; } & { c: string; d: boolean; } & { id: string; }
262+
>f : <T, U>(t: T, u: U) => T & U & { id: string; }
263263
>{ a: 1, b: 'yes' } : { a: number; b: string; }
264264
>a : number
265265
>1 : 1
@@ -278,8 +278,8 @@ let overlap: { id: string, a: number, b: string } =
278278
>b : string
279279

280280
f({ a: 1 }, { a: 2, b: 'extra' })
281-
>f({ a: 1 }, { a: 2, b: 'extra' }) : any
282-
>f : <T, U>(t: T, u: U) => any
281+
>f({ a: 1 }, { a: 2, b: 'extra' }) : { a: number; } & { a: number; b: string; } & { id: string; }
282+
>f : <T, U>(t: T, u: U) => T & U & { id: string; }
283283
>{ a: 1 } : { a: number; }
284284
>a : number
285285
>1 : 1
@@ -295,8 +295,8 @@ let overlapConflict: { id:string, a: string } =
295295
>a : string
296296

297297
f({ a: 1 }, { a: 'mismatch' })
298-
>f({ a: 1 }, { a: 'mismatch' }) : any
299-
>f : <T, U>(t: T, u: U) => any
298+
>f({ a: 1 }, { a: 'mismatch' }) : { a: number; } & { a: string; } & { id: string; }
299+
>f : <T, U>(t: T, u: U) => T & U & { id: string; }
300300
>{ a: 1 } : { a: number; }
301301
>a : number
302302
>1 : 1
@@ -312,8 +312,8 @@ let overwriteId: { id: string, a: number, c: number, d: string } =
312312
>d : string
313313

314314
f({ a: 1, id: true }, { c: 1, d: 'no' })
315-
>f({ a: 1, id: true }, { c: 1, d: 'no' }) : any
316-
>f : <T, U>(t: T, u: U) => any
315+
>f({ a: 1, id: true }, { c: 1, d: 'no' }) : { a: number; id: boolean; } & { c: number; d: string; } & { id: string; }
316+
>f : <T, U>(t: T, u: U) => T & U & { id: string; }
317317
>{ a: 1, id: true } : { a: number; id: true; }
318318
>a : number
319319
>1 : 1

tests/baselines/reference/restInvalidArgumentType.errors.txt

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
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.
41
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.
72
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.
93
tests/cases/compiler/restInvalidArgumentType.ts(40,13): error TS2700: Rest types may only be created from object types.
104
tests/cases/compiler/restInvalidArgumentType.ts(42,13): error TS2700: Rest types may only be created from object types.
115
tests/cases/compiler/restInvalidArgumentType.ts(43,13): error TS2700: Rest types may only be created from object types.
@@ -16,7 +10,7 @@ tests/cases/compiler/restInvalidArgumentType.ts(51,13): error TS2700: Rest types
1610
tests/cases/compiler/restInvalidArgumentType.ts(53,13): error TS2700: Rest types may only be created from object types.
1711

1812

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

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

4640
var {...r1} = p1; // Error, generic type paramterre
47-
~~
48-
!!! error TS2700: Rest types may only be created from object types.
4941
var {...r2} = p2; // OK
5042
var {...r3} = t; // Error, generic type paramter
51-
~~
52-
!!! error TS2700: Rest types may only be created from object types.
5343
var {...r4} = i; // Error, index access
54-
~~
55-
!!! error TS2700: Rest types may only be created from object types.
5644
var {...r5} = k; // Error, index
5745
~~
5846
!!! error TS2700: Rest types may only be created from object types.
5947

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

6551
var {...r8} = union_generic; // Error, union with generic type parameter
66-
~~
67-
!!! error TS2700: Rest types may only be created from object types.
6852
var {...r9} = union_primitive; // Error, union with generic type parameter
6953
~~
7054
!!! error TS2700: Rest types may only be created from object types.
7155

7256
var {...r10} = intersection_generic; // Error, intersection with generic type parameter
73-
~~~
74-
!!! error TS2700: Rest types may only be created from object types.
7557
var {...r11} = intersection_primitive; // Error, intersection with generic type parameter
7658
~~~
7759
!!! 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 : any
70+
>r1 : { b: string; }
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 : any
78+
>r3 : { b: string; }
7979
>t : T
8080

8181
var {...r4} = i; // Error, index access
82-
>r4 : any
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; }
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 : any
90+
>r6 : { b: T["b"]; }
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 : any
98+
>r8 : { b: string; } | { a: number; }
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 : any
106+
>r10 : { b: string; a: number; }
107107
>intersection_generic : T & { a: number; }
108108

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

tests/baselines/reference/spreadInvalidArgumentType.errors.txt

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
tests/cases/compiler/spreadInvalidArgumentType.ts(30,16): error TS2698: Spread types may only be created from object types.
2-
tests/cases/compiler/spreadInvalidArgumentType.ts(32,16): error TS2698: Spread types may only be created from object types.
3-
tests/cases/compiler/spreadInvalidArgumentType.ts(33,16): error TS2698: Spread types may only be created from object types.
41
tests/cases/compiler/spreadInvalidArgumentType.ts(34,16): error TS2698: Spread types may only be created from object types.
5-
tests/cases/compiler/spreadInvalidArgumentType.ts(35,16): error TS2698: Spread types may only be created from object types.
6-
tests/cases/compiler/spreadInvalidArgumentType.ts(38,16): error TS2698: Spread types may only be created from object types.
72
tests/cases/compiler/spreadInvalidArgumentType.ts(39,16): error TS2698: Spread types may only be created from object types.
8-
tests/cases/compiler/spreadInvalidArgumentType.ts(41,17): error TS2698: Spread types may only be created from object types.
93
tests/cases/compiler/spreadInvalidArgumentType.ts(42,17): error TS2698: Spread types may only be created from object types.
104
tests/cases/compiler/spreadInvalidArgumentType.ts(44,17): error TS2698: Spread types may only be created from object types.
115
tests/cases/compiler/spreadInvalidArgumentType.ts(45,17): error TS2698: Spread types may only be created from object types.
@@ -16,7 +10,7 @@ tests/cases/compiler/spreadInvalidArgumentType.ts(53,17): error TS2698: Spread t
1610
tests/cases/compiler/spreadInvalidArgumentType.ts(55,17): error TS2698: Spread types may only be created from object types.
1711

1812

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

2216
function f<T extends { b: string }>(p1: T, p2: T[]) {
@@ -47,33 +41,21 @@ tests/cases/compiler/spreadInvalidArgumentType.ts(55,17): error TS2698: Spread t
4741
var e: E;
4842

4943
var o1 = { ...p1 }; // Error, generic type paramterre
50-
~~~~~
51-
!!! error TS2698: Spread types may only be created from object types.
5244
var o2 = { ...p2 }; // OK
5345
var o3 = { ...t }; // Error, generic type paramter
54-
~~~~
55-
!!! error TS2698: Spread types may only be created from object types.
5646
var o4 = { ...i }; // Error, index access
57-
~~~~
58-
!!! error TS2698: Spread types may only be created from object types.
5947
var o5 = { ...k }; // Error, index
6048
~~~~
6149
!!! error TS2698: Spread types may only be created from object types.
6250
var o6 = { ...mapped_generic }; // Error, generic mapped object type
63-
~~~~~~~~~~~~~~~~~
64-
!!! error TS2698: Spread types may only be created from object types.
6551
var o7 = { ...mapped }; // OK, non-generic mapped type
6652

6753
var o8 = { ...union_generic }; // Error, union with generic type parameter
68-
~~~~~~~~~~~~~~~~
69-
!!! error TS2698: Spread types may only be created from object types.
7054
var o9 = { ...union_primitive }; // Error, union with generic type parameter
7155
~~~~~~~~~~~~~~~~~~
7256
!!! error TS2698: Spread types may only be created from object types.
7357

7458
var o10 = { ...intersection_generic }; // Error, intersection with generic type parameter
75-
~~~~~~~~~~~~~~~~~~~~~~~
76-
!!! error TS2698: Spread types may only be created from object types.
7759
var o11 = { ...intersection_primitive }; // Error, intersection with generic type parameter
7860
~~~~~~~~~~~~~~~~~~~~~~~~~
7961
!!! error TS2698: Spread types may only be created from object types.

tests/baselines/reference/spreadInvalidArgumentType.types

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ function f<T extends { b: string }>(p1: T, p2: T[]) {
6868
>e : E
6969

7070
var o1 = { ...p1 }; // Error, generic type paramterre
71-
>o1 : any
72-
>{ ...p1 } : any
71+
>o1 : T
72+
>{ ...p1 } : T
7373
>p1 : T
7474

7575
var o2 = { ...p2 }; // OK
@@ -78,13 +78,13 @@ function f<T extends { b: string }>(p1: T, p2: T[]) {
7878
>p2 : T[]
7979

8080
var o3 = { ...t }; // Error, generic type paramter
81-
>o3 : any
82-
>{ ...t } : any
81+
>o3 : T
82+
>{ ...t } : T
8383
>t : T
8484

8585
var o4 = { ...i }; // Error, index access
86-
>o4 : any
87-
>{ ...i } : any
86+
>o4 : T["b"]
87+
>{ ...i } : T["b"]
8888
>i : T["b"]
8989

9090
var o5 = { ...k }; // Error, index
@@ -93,8 +93,8 @@ function f<T extends { b: string }>(p1: T, p2: T[]) {
9393
>k : keyof T
9494

9595
var o6 = { ...mapped_generic }; // Error, generic mapped object type
96-
>o6 : any
97-
>{ ...mapped_generic } : any
96+
>o6 : { [P in keyof T]: T[P]; }
97+
>{ ...mapped_generic } : { [P in keyof T]: T[P]; }
9898
>mapped_generic : { [P in keyof T]: T[P]; }
9999

100100
var o7 = { ...mapped }; // OK, non-generic mapped type
@@ -103,8 +103,8 @@ function f<T extends { b: string }>(p1: T, p2: T[]) {
103103
>mapped : { b: T["b"]; }
104104

105105
var o8 = { ...union_generic }; // Error, union with generic type parameter
106-
>o8 : any
107-
>{ ...union_generic } : any
106+
>o8 : T | { a: number; }
107+
>{ ...union_generic } : T | { a: number; }
108108
>union_generic : T | { a: number; }
109109

110110
var o9 = { ...union_primitive }; // Error, union with generic type parameter
@@ -113,8 +113,8 @@ function f<T extends { b: string }>(p1: T, p2: T[]) {
113113
>union_primitive : number | { a: number; }
114114

115115
var o10 = { ...intersection_generic }; // Error, intersection with generic type parameter
116-
>o10 : any
117-
>{ ...intersection_generic } : any
116+
>o10 : T & { a: number; }
117+
>{ ...intersection_generic } : T & { a: number; }
118118
>intersection_generic : T & { a: number; }
119119

120120
var o11 = { ...intersection_primitive }; // Error, intersection with generic type parameter

0 commit comments

Comments
 (0)