Skip to content

Commit 6785472

Browse files
committed
Accept new baselines
1 parent 68eb7b9 commit 6785472

File tree

4 files changed

+190
-136
lines changed

4 files changed

+190
-136
lines changed

tests/baselines/reference/keyofAndIndexedAccess2.errors.txt

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,22 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(19,5): error TS232
1212
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(26,7): error TS2339: Property 'x' does not exist on type 'T'.
1313
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(27,5): error TS2322: Type '1' is not assignable to type 'T[keyof T]'.
1414
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(31,5): error TS2322: Type '{ [key: string]: number; }' is not assignable to type '{ [P in K]: number; }'.
15-
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(45,3): error TS7017: Element implicitly has an 'any' type because type 'Item' has no index signature.
16-
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(46,3): error TS2322: Type '123' is not assignable to type 'string & number'.
15+
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(38,5): error TS2322: Type '{ [x: string]: number; }' is not assignable to type '{ [P in K]: number; }'.
16+
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(50,3): error TS7017: Element implicitly has an 'any' type because type 'Item' has no index signature.
17+
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(51,3): error TS2322: Type '123' is not assignable to type 'string & number'.
1718
Type '123' is not assignable to type 'string'.
18-
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(47,3): error TS2322: Type '123' is not assignable to type 'T[keyof T]'.
19-
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(48,3): error TS2322: Type '123' is not assignable to type 'T[K]'.
20-
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(60,7): error TS2339: Property 'foo' does not exist on type 'T'.
21-
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(61,3): error TS2536: Type 'string' cannot be used to index type 'T'.
22-
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(62,3): error TS2322: Type '123' is not assignable to type 'T[keyof T]'.
23-
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(63,3): error TS2322: Type '123' is not assignable to type 'T[K]'.
24-
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(103,5): error TS2322: Type '123' is not assignable to type 'Type[K]'.
19+
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(52,3): error TS2322: Type '123' is not assignable to type 'T[keyof T]'.
20+
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(53,3): error TS2322: Type '123' is not assignable to type 'T[K]'.
21+
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(65,7): error TS2339: Property 'foo' does not exist on type 'T'.
22+
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(66,3): error TS2536: Type 'string' cannot be used to index type 'T'.
23+
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(67,3): error TS2322: Type '123' is not assignable to type 'T[keyof T]'.
24+
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(68,3): error TS2322: Type '123' is not assignable to type 'T[K]'.
25+
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(108,5): error TS2322: Type '123' is not assignable to type 'Type[K]'.
2526
Type '123' is not assignable to type '123 & "some string"'.
2627
Type '123' is not assignable to type '"some string"'.
2728

2829

29-
==== tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts (22 errors) ====
30+
==== tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts (23 errors) ====
3031
function f1(obj: { a: number, b: 0 | 1, c: string }, k0: 'a', k1: 'a' | 'b', k2: 'a' | 'b' | 'c') {
3132
obj[k0] = 1;
3233
obj[k0] = 2;
@@ -90,6 +91,13 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(103,5): error TS23
9091
a[k] = 1;
9192
}
9293

94+
function f3b<K extends string>(a: { [P in K]: number }, b: { [P in string]: number }, k: K) {
95+
a = b; // Error, index signature doesn't imply properties are present
96+
~
97+
!!! error TS2322: Type '{ [x: string]: number; }' is not assignable to type '{ [P in K]: number; }'.
98+
b = a;
99+
}
100+
93101
function f4<K extends string>(a: { [key: string]: number }[K], b: number) {
94102
a = b;
95103
b = a;

tests/baselines/reference/keyofAndIndexedAccess2.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ function f3<K extends string>(a: { [P in K]: number }, b: { [key: string]: numbe
3535
a[k] = 1;
3636
}
3737

38+
function f3b<K extends string>(a: { [P in K]: number }, b: { [P in string]: number }, k: K) {
39+
a = b; // Error, index signature doesn't imply properties are present
40+
b = a;
41+
}
42+
3843
function f4<K extends string>(a: { [key: string]: number }[K], b: number) {
3944
a = b;
4045
b = a;
@@ -139,6 +144,10 @@ function f3(a, b, k) {
139144
a[k];
140145
a[k] = 1;
141146
}
147+
function f3b(a, b, k) {
148+
a = b; // Error, index signature doesn't imply properties are present
149+
b = a;
150+
}
142151
function f4(a, b) {
143152
a = b;
144153
b = a;

0 commit comments

Comments
 (0)