Skip to content

Commit a34c556

Browse files
committed
Update baselines
1 parent 7d7750d commit a34c556

7 files changed

+17
-161
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29142,7 +29142,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2914229142
if (contextualElementTypes.length > 1) {
2914329143
return createArrayType(getIntersectionType(contextualElementTypes));
2914429144
} else if (contextualElementTypes.length === 1) {
29145-
return createArrayType(contextualElementTypes);
29145+
return createArrayType(contextualElementTypes[0]);
2914629146
}
2914729147
}
2914829148
return createArrayLiteralType(createArrayType(elementTypes.length ?

tests/baselines/reference/APISample_jsdoc.errors.txt

Lines changed: 0 additions & 127 deletions
This file was deleted.

tests/baselines/reference/arrayContextualTyping.errors.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
tests/cases/compiler/arrayContextualTyping.ts(9,9): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
2-
Type 'string' is not assignable to type 'number'.
32
tests/cases/compiler/arrayContextualTyping.ts(14,11): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
4-
Type 'number' is not assignable to type 'string'.
53

64

75
==== tests/cases/compiler/arrayContextualTyping.ts (2 errors) ====
@@ -16,15 +14,13 @@ tests/cases/compiler/arrayContextualTyping.ts(14,11): error TS2345: Argument of
1614
m1.push(""); // Should error
1715
~~
1816
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
19-
!!! error TS2345: Type 'string' is not assignable to type 'number'.
2017

2118
// Works in object fields?
2219
const m2 = { a: [] satisfies string[] };
2320
m2.a.push(""); // Should be OK
2421
m2.a.push(0); // Should error
2522
~
2623
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
27-
!!! error TS2345: Type 'number' is not assignable to type 'string'.
2824

2925
// If the contextual type is a union, keep the array-supertyping parts of the union
3026
const m3 = [] satisfies number[] | ArrayLike<string>;

tests/baselines/reference/arrayContextualTyping.types

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,19 @@ const m3t: number[] | string[] = m3;
6767

6868
// Keep only the array parts
6969
const m4 = [] satisfies MyCustomArray | string[];
70-
>m4 : (number & string)[]
71-
>[] satisfies MyCustomArray | string[] : (number & string)[]
72-
>[] : (number & string)[]
70+
>m4 : never[]
71+
>[] satisfies MyCustomArray | string[] : never[]
72+
>[] : never[]
7373

7474
const m4t: string[] = m4;
7575
>m4t : string[]
76-
>m4 : (number & string)[]
76+
>m4 : never[]
7777

7878
// Should OK
7979
const m5: string[] | number[] = [] satisfies string[] | number[];
8080
>m5 : number[] | string[]
81-
>[] satisfies string[] | number[] : (number & string)[]
82-
>[] : (number & string)[]
81+
>[] satisfies string[] | number[] : never[]
82+
>[] : never[]
8383

8484
// Should OK
8585
type Obj = { a: string[] } | { a: number[] };
@@ -89,10 +89,10 @@ type Obj = { a: string[] } | { a: number[] };
8989

9090
const m6: Obj = { a: [] } satisfies Obj;
9191
>m6 : Obj
92-
>{ a: [] } satisfies Obj : { a: (number & string)[]; }
93-
>{ a: [] } : { a: (number & string)[]; }
94-
>a : (number & string)[]
95-
>[] : (number & string)[]
92+
>{ a: [] } satisfies Obj : { a: never[]; }
93+
>{ a: [] } : { a: never[]; }
94+
>a : never[]
95+
>[] : never[]
9696

9797
// Should all OK
9898
type DiscrObj = { a: string[], kind: "strings" } | { a: number[], kind: "numbers" };

tests/baselines/reference/exportDefaultWithJSDoc1.errors.txt

Lines changed: 0 additions & 18 deletions
This file was deleted.

tests/baselines/reference/mappedTypeGenericIndexedAccess.errors.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ tests/cases/compiler/mappedTypeGenericIndexedAccess.ts(18,13): error TS2322: Typ
22
Type 'Types[T][]' is not assignable to type '{ a1: true; }[] & { a2: true; }[] & { a3: true; }[]'.
33
Type 'Types[T][]' is not assignable to type '{ a1: true; }[]'.
44
Type 'Types[T]' is not assignable to type '{ a1: true; }'.
5+
Type '{ a1: true; } | { a2: true; } | { a3: true; }' is not assignable to type '{ a1: true; }'.
6+
Property 'a1' is missing in type '{ a2: true; }' but required in type '{ a1: true; }'.
57

68

79
==== tests/cases/compiler/mappedTypeGenericIndexedAccess.ts (1 errors) ====
@@ -28,6 +30,9 @@ tests/cases/compiler/mappedTypeGenericIndexedAccess.ts(18,13): error TS2322: Typ
2830
!!! error TS2322: Type 'Types[T][]' is not assignable to type '{ a1: true; }[] & { a2: true; }[] & { a3: true; }[]'.
2931
!!! error TS2322: Type 'Types[T][]' is not assignable to type '{ a1: true; }[]'.
3032
!!! error TS2322: Type 'Types[T]' is not assignable to type '{ a1: true; }'.
33+
!!! error TS2322: Type '{ a1: true; } | { a2: true; } | { a3: true; }' is not assignable to type '{ a1: true; }'.
34+
!!! error TS2322: Property 'a1' is missing in type '{ a2: true; }' but required in type '{ a1: true; }'.
35+
!!! related TS2728 tests/cases/compiler/mappedTypeGenericIndexedAccess.ts:4:14: 'a1' is declared here.
3136
}
3237
this.entries[name]?.push(entry);
3338
}

tests/baselines/reference/unionOfClassCalls.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ switch (tmp.get('t')) {
3838

3939
const arr: number[] | string[] = []; // Works with Array<number | string>
4040
>arr : number[] | string[]
41-
>[] : (number & string)[]
41+
>[] : never[]
4242

4343
const arr1: number[] = [];
4444
>arr1 : number[]

0 commit comments

Comments
 (0)