Skip to content

Commit 394f776

Browse files
Accept (possibly non-ideal?) baselines
1 parent 9cbde46 commit 394f776

9 files changed

+71
-38
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
tests/cases/conformance/types/conditional/conditionalTypesExcessProperties.ts(8,5): error TS2322: Type '{ test: string; arg: A; }' is not assignable to type 'Something<A>'.
2-
Type '{ test: string; arg: A; }' is not assignable to type 'A extends object ? { arg: A; } : { arg?: undefined; }'.
3-
tests/cases/conformance/types/conditional/conditionalTypesExcessProperties.ts(9,5): error TS2322: Type '{ test: string; arg: A; arr: A; }' is not assignable to type 'Something<A>'.
4-
Type '{ test: string; arg: A; arr: A; }' is not assignable to type 'A extends object ? { arg: A; } : { arg?: undefined; }'.
1+
tests/cases/conformance/types/conditional/conditionalTypesExcessProperties.ts(8,5): error TS2322: Type '{ test: string; arg: object; }' is not assignable to type 'Something<A>'.
2+
Type '{ test: string; arg: object; }' is not assignable to type 'A extends object ? { arg: A; } : { arg?: undefined; }'.
3+
tests/cases/conformance/types/conditional/conditionalTypesExcessProperties.ts(9,5): error TS2322: Type '{ test: string; arg: object; arr: A; }' is not assignable to type 'Something<A>'.
4+
Type '{ test: string; arg: object; arr: A; }' is not assignable to type 'A extends object ? { arg: A; } : { arg?: undefined; }'.
55

66

77
==== tests/cases/conformance/types/conditional/conditionalTypesExcessProperties.ts (2 errors) ====
@@ -14,11 +14,11 @@ tests/cases/conformance/types/conditional/conditionalTypesExcessProperties.ts(9,
1414
function testFunc2<A extends object>(a: A, sa: Something<A>) {
1515
sa = { test: 'hi', arg: a }; // not excess (but currently still not assignable)
1616
~~
17-
!!! error TS2322: Type '{ test: string; arg: A; }' is not assignable to type 'Something<A>'.
18-
!!! error TS2322: Type '{ test: string; arg: A; }' is not assignable to type 'A extends object ? { arg: A; } : { arg?: undefined; }'.
17+
!!! error TS2322: Type '{ test: string; arg: object; }' is not assignable to type 'Something<A>'.
18+
!!! error TS2322: Type '{ test: string; arg: object; }' is not assignable to type 'A extends object ? { arg: A; } : { arg?: undefined; }'.
1919
sa = { test: 'bye', arg: a, arr: a } // excess
2020
~~
21-
!!! error TS2322: Type '{ test: string; arg: A; arr: A; }' is not assignable to type 'Something<A>'.
22-
!!! error TS2322: Type '{ test: string; arg: A; arr: A; }' is not assignable to type 'A extends object ? { arg: A; } : { arg?: undefined; }'.
21+
!!! error TS2322: Type '{ test: string; arg: object; arr: A; }' is not assignable to type 'Something<A>'.
22+
!!! error TS2322: Type '{ test: string; arg: object; arr: A; }' is not assignable to type 'A extends object ? { arg: A; } : { arg?: undefined; }'.
2323
}
2424

tests/baselines/reference/conditionalTypesExcessProperties.types

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ function testFunc2<A extends object>(a: A, sa: Something<A>) {
1818
>sa : Something<A>
1919

2020
sa = { test: 'hi', arg: a }; // not excess (but currently still not assignable)
21-
>sa = { test: 'hi', arg: a } : { test: string; arg: A; }
21+
>sa = { test: 'hi', arg: a } : { test: string; arg: object; }
2222
>sa : Something<A>
23-
>{ test: 'hi', arg: a } : { test: string; arg: A; }
23+
>{ test: 'hi', arg: a } : { test: string; arg: object; }
2424
>test : string
2525
>'hi' : "hi"
26-
>arg : A
27-
>a : A
26+
>arg : object
27+
>a : object
2828

2929
sa = { test: 'bye', arg: a, arr: a } // excess
30-
>sa = { test: 'bye', arg: a, arr: a } : { test: string; arg: A; arr: A; }
30+
>sa = { test: 'bye', arg: a, arr: a } : { test: string; arg: object; arr: A; }
3131
>sa : Something<A>
32-
>{ test: 'bye', arg: a, arr: a } : { test: string; arg: A; arr: A; }
32+
>{ test: 'bye', arg: a, arr: a } : { test: string; arg: object; arr: A; }
3333
>test : string
3434
>'bye' : "bye"
35-
>arg : A
36-
>a : A
35+
>arg : object
36+
>a : object
3737
>arr : A
3838
>a : A
3939
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
tests/cases/compiler/crashInGetTextOfComputedPropertyName.ts(23,24): error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
2+
3+
4+
==== tests/cases/compiler/crashInGetTextOfComputedPropertyName.ts (1 errors) ====
5+
// https://github.com/Microsoft/TypeScript/issues/29006
6+
export interface A { type: 'a' }
7+
export interface B { type: 'b' }
8+
export type AB = A | B
9+
10+
const itemId = 'some-id'
11+
12+
// --- test on first level ---
13+
const items: { [id: string]: AB } = {}
14+
const { [itemId]: itemOk1 } = items
15+
typeof itemOk1 // pass
16+
17+
// --- test on second level ---
18+
interface ObjWithItems {
19+
items: {[s: string]: AB}
20+
}
21+
const objWithItems: ObjWithItems = { items: {}}
22+
23+
const itemOk2 = objWithItems.items[itemId]
24+
typeof itemOk2 // pass
25+
26+
const {
27+
items: { [itemId]: itemWithTSError } = {} /*happens when default value is provided*/
28+
~~~~~~~~~~~~~~~
29+
!!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value.
30+
} = objWithItems
31+
32+
// in order to re-produce the error, uncomment next line:
33+
typeof itemWithTSError // :(
34+
35+
// will result in:
36+
// Error from compilation: TypeError: Cannot read property 'charCodeAt' of undefined TypeError: Cannot read property 'charCodeAt' of undefined

tests/baselines/reference/esNextWeakRefs_IterableWeakMap.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export class IterableWeakMap<K extends object, V> implements WeakMap<K, V> {
134134
>this.#finalizationGroup : FinalizationRegistry<{ readonly ref: WeakRef<object>; readonly set: Set<WeakRef<object>>; }>
135135
>this : this
136136
>register : (target: object, heldValue: { readonly ref: WeakRef<object>; readonly set: Set<WeakRef<object>>; }, unregisterToken?: object | undefined) => void
137-
>key : K
137+
>key : object
138138
>{ set: this.#refSet, ref, } : { set: Set<WeakRef<K>>; ref: WeakRef<K>; }
139139

140140
set: this.#refSet,

tests/baselines/reference/logicalOrOperatorWithTypeParameters.types

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ function fn3<T extends { a: string; b: string }, U extends { a: string; b: numbe
8686

8787
var r2: {} = t || u;
8888
>r2 : {}
89-
>t || u : T | U
90-
>t : T
91-
>u : U
89+
>t || u : { a: string; b: string; } | { a: string; b: number; }
90+
>t : { a: string; b: string; }
91+
>u : { a: string; b: number; }
9292

9393
var r3 = t || { a: '' };
9494
>r3 : T | { a: string; }

tests/baselines/reference/nonPrimitiveInGeneric.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function bound<T extends object>(t: T) {
4141

4242
var o: object = t; // ok
4343
>o : object
44-
>t : T
44+
>t : object
4545
}
4646

4747
bound({});
@@ -89,7 +89,7 @@ function bound3<T extends {}>(t: T) {
8989

9090
var o: object = t; // ok
9191
>o : object
92-
>t : T
92+
>t : {}
9393
}
9494

9595
interface Proxy<T extends object> {}

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(17,6): error TS2698: Spread 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
~~~~~~~~~~
@@ -38,6 +39,8 @@ tests/cases/conformance/types/rest/objectRestNegative.ts(17,9): error TS2701: Th
3839

3940
let rest: { b: string }
4041
({a, ...rest.b + rest.b} = o);
42+
~~~~~~~~~~~~~~~~~~
43+
!!! error TS2698: Spread types may only be created from object types.
4144
~~~~~~~~~~~~~~~
4245
!!! error TS2701: The target of an object rest assignment must be a variable or a property access.
4346

tests/baselines/reference/unknownType1.errors.txt

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ tests/cases/conformance/types/unknown/unknownType1.ts(111,9): error TS2322: Type
1515
tests/cases/conformance/types/unknown/unknownType1.ts(112,9): error TS2322: Type 'unknown' is not assignable to type 'string[]'.
1616
tests/cases/conformance/types/unknown/unknownType1.ts(113,9): error TS2322: Type 'unknown' is not assignable to type '{}'.
1717
tests/cases/conformance/types/unknown/unknownType1.ts(114,9): error TS2322: Type 'unknown' is not assignable to type '{} | null | undefined'.
18-
tests/cases/conformance/types/unknown/unknownType1.ts(120,9): error TS2322: Type 'T' is not assignable to type 'object'.
19-
Type 'unknown' is not assignable to type 'object'.
18+
tests/cases/conformance/types/unknown/unknownType1.ts(120,9): error TS2322: Type 'unknown' is not assignable to type 'object'.
2019
tests/cases/conformance/types/unknown/unknownType1.ts(128,5): error TS2322: Type 'number[]' is not assignable to type '{ [x: string]: unknown; }'.
2120
Index signature for type 'string' is missing in type 'number[]'.
2221
tests/cases/conformance/types/unknown/unknownType1.ts(129,5): error TS2322: Type 'number' is not assignable to type '{ [x: string]: unknown; }'.
@@ -26,10 +25,8 @@ tests/cases/conformance/types/unknown/unknownType1.ts(150,17): error TS2355: A f
2625
tests/cases/conformance/types/unknown/unknownType1.ts(156,14): error TS2700: Rest types may only be created from object types.
2726
tests/cases/conformance/types/unknown/unknownType1.ts(162,5): error TS2564: Property 'a' has no initializer and is not definitely assigned in the constructor.
2827
tests/cases/conformance/types/unknown/unknownType1.ts(170,9): error TS2322: Type 'T' is not assignable to type '{}'.
29-
tests/cases/conformance/types/unknown/unknownType1.ts(171,9): error TS2322: Type 'U' is not assignable to type '{}'.
30-
Type 'unknown' is not assignable to type '{}'.
31-
tests/cases/conformance/types/unknown/unknownType1.ts(181,5): error TS2322: Type 'T' is not assignable to type '{}'.
32-
Type 'unknown' is not assignable to type '{}'.
28+
tests/cases/conformance/types/unknown/unknownType1.ts(171,9): error TS2322: Type 'unknown' is not assignable to type '{}'.
29+
tests/cases/conformance/types/unknown/unknownType1.ts(181,5): error TS2322: Type 'unknown' is not assignable to type '{}'.
3330

3431

3532
==== tests/cases/conformance/types/unknown/unknownType1.ts (28 errors) ====
@@ -188,8 +185,7 @@ tests/cases/conformance/types/unknown/unknownType1.ts(181,5): error TS2322: Type
188185
function f23<T extends unknown>(x: T) {
189186
let y: object = x; // Error
190187
~
191-
!!! error TS2322: Type 'T' is not assignable to type 'object'.
192-
!!! error TS2322: Type 'unknown' is not assignable to type 'object'.
188+
!!! error TS2322: Type 'unknown' is not assignable to type 'object'.
193189
}
194190

195191
// Anything fresh but primitive assignable to { [x: string]: unknown }
@@ -260,8 +256,7 @@ tests/cases/conformance/types/unknown/unknownType1.ts(181,5): error TS2322: Type
260256
!!! related TS2208 tests/cases/conformance/types/unknown/unknownType1.ts:169:14: This type parameter probably needs an `extends object` constraint.
261257
let y: {} = u;
262258
~
263-
!!! error TS2322: Type 'U' is not assignable to type '{}'.
264-
!!! error TS2322: Type 'unknown' is not assignable to type '{}'.
259+
!!! error TS2322: Type 'unknown' is not assignable to type '{}'.
265260
}
266261

267262
// Repro from #26796
@@ -273,7 +268,6 @@ tests/cases/conformance/types/unknown/unknownType1.ts(181,5): error TS2322: Type
273268
function oops<T extends unknown>(arg: T): {} {
274269
return arg; // Error
275270
~~~~~~~~~~~
276-
!!! error TS2322: Type 'T' is not assignable to type '{}'.
277-
!!! error TS2322: Type 'unknown' is not assignable to type '{}'.
271+
!!! error TS2322: Type 'unknown' is not assignable to type '{}'.
278272
}
279273

tests/baselines/reference/unknownType1.types

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ function f23<T extends unknown>(x: T) {
339339

340340
let y: object = x; // Error
341341
>y : object
342-
>x : T
342+
>x : unknown
343343
}
344344

345345
// Anything fresh but primitive assignable to { [x: string]: unknown }
@@ -473,7 +473,7 @@ function f30<T, U extends unknown>(t: T, u: U) {
473473

474474
let y: {} = u;
475475
>y : {}
476-
>u : U
476+
>u : unknown
477477
}
478478

479479
// Repro from #26796
@@ -496,6 +496,6 @@ function oops<T extends unknown>(arg: T): {} {
496496
>arg : T
497497

498498
return arg; // Error
499-
>arg : T
499+
>arg : unknown
500500
}
501501

0 commit comments

Comments
 (0)