Skip to content

Commit c555848

Browse files
committed
Accept new baselines
1 parent 5498a95 commit c555848

11 files changed

+400
-579
lines changed

Diff for: tests/baselines/reference/keyofAndIndexedAccess.js

+14-34
Original file line numberDiff line numberDiff line change
@@ -95,22 +95,18 @@ function f10(shape: Shape) {
9595

9696
function f11(a: Shape[]) {
9797
let len = getProperty(a, "length"); // number
98-
let shape = getProperty(a, 1000); // Shape
99-
setProperty(a, 1000, getProperty(a, 1001));
98+
setProperty(a, "length", len);
10099
}
101100

102101
function f12(t: [Shape, boolean]) {
103102
let len = getProperty(t, "length");
104-
let s1 = getProperty(t, 0); // Shape
105103
let s2 = getProperty(t, "0"); // Shape
106-
let b1 = getProperty(t, 1); // boolean
107104
let b2 = getProperty(t, "1"); // boolean
108-
let x1 = getProperty(t, 2); // Shape | boolean
109105
}
110106

111107
function f13(foo: any, bar: any) {
112108
let x = getProperty(foo, "x"); // any
113-
let y = getProperty(foo, 100); // any
109+
let y = getProperty(foo, "100"); // any
114110
let z = getProperty(foo, bar); // any
115111
}
116112

@@ -181,20 +177,14 @@ function f40(c: C) {
181177
let z: Z = c["z"];
182178
}
183179

184-
function f50<T>(k: keyof T, s: string, n: number) {
180+
function f50<T>(k: keyof T, s: string) {
185181
const x1 = s as keyof T;
186-
const x2 = n as keyof T;
187-
const x3 = k as string;
188-
const x4 = k as number;
189-
const x5 = k as string | number;
182+
const x2 = k as string;
190183
}
191184

192-
function f51<T, K extends keyof T>(k: K, s: string, n: number) {
185+
function f51<T, K extends keyof T>(k: K, s: string) {
193186
const x1 = s as keyof T;
194-
const x2 = n as keyof T;
195-
const x3 = k as string;
196-
const x4 = k as number;
197-
const x5 = k as string | number;
187+
const x2 = k as string;
198188
}
199189

200190
function f52<T>(obj: { [x: string]: boolean }, k: keyof T, s: string, n: number) {
@@ -297,20 +287,16 @@ function f10(shape) {
297287
}
298288
function f11(a) {
299289
var len = getProperty(a, "length"); // number
300-
var shape = getProperty(a, 1000); // Shape
301-
setProperty(a, 1000, getProperty(a, 1001));
290+
setProperty(a, "length", len);
302291
}
303292
function f12(t) {
304293
var len = getProperty(t, "length");
305-
var s1 = getProperty(t, 0); // Shape
306294
var s2 = getProperty(t, "0"); // Shape
307-
var b1 = getProperty(t, 1); // boolean
308295
var b2 = getProperty(t, "1"); // boolean
309-
var x1 = getProperty(t, 2); // Shape | boolean
310296
}
311297
function f13(foo, bar) {
312298
var x = getProperty(foo, "x"); // any
313-
var y = getProperty(foo, 100); // any
299+
var y = getProperty(foo, "100"); // any
314300
var z = getProperty(foo, bar); // any
315301
}
316302
var Component = (function () {
@@ -369,19 +355,13 @@ function f40(c) {
369355
var y = c["y"];
370356
var z = c["z"];
371357
}
372-
function f50(k, s, n) {
358+
function f50(k, s) {
373359
var x1 = s;
374-
var x2 = n;
375-
var x3 = k;
376-
var x4 = k;
377-
var x5 = k;
360+
var x2 = k;
378361
}
379-
function f51(k, s, n) {
362+
function f51(k, s) {
380363
var x1 = s;
381-
var x2 = n;
382-
var x3 = k;
383-
var x4 = k;
384-
var x5 = k;
364+
var x2 = k;
385365
}
386366
function f52(obj, k, s, n) {
387367
var x1 = obj[s];
@@ -528,8 +508,8 @@ declare class C {
528508
private z;
529509
}
530510
declare function f40(c: C): void;
531-
declare function f50<T>(k: keyof T, s: string, n: number): void;
532-
declare function f51<T, K extends keyof T>(k: K, s: string, n: number): void;
511+
declare function f50<T>(k: keyof T, s: string): void;
512+
declare function f51<T, K extends keyof T>(k: K, s: string): void;
533513
declare function f52<T>(obj: {
534514
[x: string]: boolean;
535515
}, k: keyof T, s: string, n: number): void;

Diff for: tests/baselines/reference/keyofAndIndexedAccess.symbols

+288-337
Large diffs are not rendered by default.

Diff for: tests/baselines/reference/keyofAndIndexedAccess.types

+21-86
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ const enum E { A, B, C }
5454
>C : E.C
5555

5656
type K00 = keyof any; // string | number
57-
>K00 : string | number
57+
>K00 : string
5858

5959
type K01 = keyof string; // number | "toString" | "charAt" | ...
60-
>K01 : number | "length" | "toString" | "concat" | "slice" | "indexOf" | "lastIndexOf" | "charAt" | "charCodeAt" | "localeCompare" | "match" | "replace" | "search" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "substr" | "valueOf"
60+
>K01 : "length" | "toString" | "concat" | "slice" | "indexOf" | "lastIndexOf" | "charAt" | "charCodeAt" | "localeCompare" | "match" | "replace" | "search" | "split" | "substring" | "toLowerCase" | "toLocaleLowerCase" | "toUpperCase" | "toLocaleUpperCase" | "trim" | "substr" | "valueOf"
6161

6262
type K02 = keyof number; // "toString" | "toFixed" | "toExponential" | ...
6363
>K02 : "toString" | "toLocaleString" | "valueOf" | "toFixed" | "toExponential" | "toPrecision"
@@ -83,11 +83,11 @@ type K10 = keyof Shape; // "name" | "width" | "height" | "visible"
8383
>Shape : Shape
8484

8585
type K11 = keyof Shape[]; // number | "length" | "toString" | ...
86-
>K11 : number | "length" | "toString" | "toLocaleString" | "push" | "pop" | "concat" | "join" | "reverse" | "shift" | "slice" | "sort" | "splice" | "unshift" | "indexOf" | "lastIndexOf" | "every" | "some" | "forEach" | "map" | "filter" | "reduce" | "reduceRight"
86+
>K11 : "length" | "toString" | "toLocaleString" | "push" | "pop" | "concat" | "join" | "reverse" | "shift" | "slice" | "sort" | "splice" | "unshift" | "indexOf" | "lastIndexOf" | "every" | "some" | "forEach" | "map" | "filter" | "reduce" | "reduceRight"
8787
>Shape : Shape
8888

8989
type K12 = keyof Dictionary<Shape>; // string | number
90-
>K12 : string | number
90+
>K12 : string
9191
>Dictionary : Dictionary<T>
9292
>Shape : Shape
9393

@@ -103,7 +103,7 @@ type K15 = keyof E; // "toString" | "toFixed" | "toExponential" | ...
103103
>E : E
104104

105105
type K16 = keyof [string, number]; // number | "0" | "1" | "length" | "toString" | ...
106-
>K16 : number | "0" | "1" | "length" | "toString" | "toLocaleString" | "push" | "pop" | "concat" | "join" | "reverse" | "shift" | "slice" | "sort" | "splice" | "unshift" | "indexOf" | "lastIndexOf" | "every" | "some" | "forEach" | "map" | "filter" | "reduce" | "reduceRight"
106+
>K16 : "0" | "1" | "length" | "toString" | "toLocaleString" | "push" | "pop" | "concat" | "join" | "reverse" | "shift" | "slice" | "sort" | "splice" | "unshift" | "indexOf" | "lastIndexOf" | "every" | "some" | "forEach" | "map" | "filter" | "reduce" | "reduceRight"
107107

108108
type K17 = keyof (Shape | Item); // "name"
109109
>K17 : "name"
@@ -126,7 +126,7 @@ type K20 = KeyOf<Shape>; // "name" | "width" | "height" | "visible"
126126
>Shape : Shape
127127

128128
type K21 = KeyOf<Dictionary<Shape>>; // string | number
129-
>K21 : string | number
129+
>K21 : string
130130
>KeyOf : keyof T
131131
>Dictionary : Dictionary<T>
132132
>Shape : Shape
@@ -328,22 +328,12 @@ function f11(a: Shape[]) {
328328
>a : Shape[]
329329
>"length" : "length"
330330

331-
let shape = getProperty(a, 1000); // Shape
332-
>shape : Shape
333-
>getProperty(a, 1000) : Shape
334-
>getProperty : <T, K extends keyof T>(obj: T, key: K) => T[K]
335-
>a : Shape[]
336-
>1000 : 1000
337-
338-
setProperty(a, 1000, getProperty(a, 1001));
339-
>setProperty(a, 1000, getProperty(a, 1001)) : void
331+
setProperty(a, "length", len);
332+
>setProperty(a, "length", len) : void
340333
>setProperty : <T, K extends keyof T>(obj: T, key: K, value: T[K]) => void
341334
>a : Shape[]
342-
>1000 : 1000
343-
>getProperty(a, 1001) : Shape
344-
>getProperty : <T, K extends keyof T>(obj: T, key: K) => T[K]
345-
>a : Shape[]
346-
>1001 : 1001
335+
>"length" : "length"
336+
>len : number
347337
}
348338

349339
function f12(t: [Shape, boolean]) {
@@ -358,40 +348,19 @@ function f12(t: [Shape, boolean]) {
358348
>t : [Shape, boolean]
359349
>"length" : "length"
360350

361-
let s1 = getProperty(t, 0); // Shape
362-
>s1 : Shape
363-
>getProperty(t, 0) : Shape
364-
>getProperty : <T, K extends keyof T>(obj: T, key: K) => T[K]
365-
>t : [Shape, boolean]
366-
>0 : 0
367-
368351
let s2 = getProperty(t, "0"); // Shape
369352
>s2 : Shape
370353
>getProperty(t, "0") : Shape
371354
>getProperty : <T, K extends keyof T>(obj: T, key: K) => T[K]
372355
>t : [Shape, boolean]
373356
>"0" : "0"
374357

375-
let b1 = getProperty(t, 1); // boolean
376-
>b1 : boolean
377-
>getProperty(t, 1) : boolean
378-
>getProperty : <T, K extends keyof T>(obj: T, key: K) => T[K]
379-
>t : [Shape, boolean]
380-
>1 : 1
381-
382358
let b2 = getProperty(t, "1"); // boolean
383359
>b2 : boolean
384360
>getProperty(t, "1") : boolean
385361
>getProperty : <T, K extends keyof T>(obj: T, key: K) => T[K]
386362
>t : [Shape, boolean]
387363
>"1" : "1"
388-
389-
let x1 = getProperty(t, 2); // Shape | boolean
390-
>x1 : boolean | Shape
391-
>getProperty(t, 2) : boolean | Shape
392-
>getProperty : <T, K extends keyof T>(obj: T, key: K) => T[K]
393-
>t : [Shape, boolean]
394-
>2 : 2
395364
}
396365

397366
function f13(foo: any, bar: any) {
@@ -406,12 +375,12 @@ function f13(foo: any, bar: any) {
406375
>foo : any
407376
>"x" : "x"
408377

409-
let y = getProperty(foo, 100); // any
378+
let y = getProperty(foo, "100"); // any
410379
>y : any
411-
>getProperty(foo, 100) : any
380+
>getProperty(foo, "100") : any
412381
>getProperty : <T, K extends keyof T>(obj: T, key: K) => T[K]
413382
>foo : any
414-
>100 : 100
383+
>"100" : "100"
415384

416385
let z = getProperty(foo, bar); // any
417386
>z : any
@@ -737,77 +706,43 @@ function f40(c: C) {
737706
>"z" : "z"
738707
}
739708

740-
function f50<T>(k: keyof T, s: string, n: number) {
741-
>f50 : <T>(k: keyof T, s: string, n: number) => void
709+
function f50<T>(k: keyof T, s: string) {
710+
>f50 : <T>(k: keyof T, s: string) => void
742711
>T : T
743712
>k : keyof T
744713
>T : T
745714
>s : string
746-
>n : number
747715

748716
const x1 = s as keyof T;
749717
>x1 : keyof T
750718
>s as keyof T : keyof T
751719
>s : string
752720
>T : T
753721

754-
const x2 = n as keyof T;
755-
>x2 : keyof T
756-
>n as keyof T : keyof T
757-
>n : number
758-
>T : T
759-
760-
const x3 = k as string;
761-
>x3 : string
722+
const x2 = k as string;
723+
>x2 : string
762724
>k as string : string
763-
>k : keyof T
764-
765-
const x4 = k as number;
766-
>x4 : number
767-
>k as number : number
768-
>k : keyof T
769-
770-
const x5 = k as string | number;
771-
>x5 : string | number
772-
>k as string | number : string | number
773725
>k : keyof T
774726
}
775727

776-
function f51<T, K extends keyof T>(k: K, s: string, n: number) {
777-
>f51 : <T, K extends keyof T>(k: K, s: string, n: number) => void
728+
function f51<T, K extends keyof T>(k: K, s: string) {
729+
>f51 : <T, K extends keyof T>(k: K, s: string) => void
778730
>T : T
779731
>K : K
780732
>T : T
781733
>k : K
782734
>K : K
783735
>s : string
784-
>n : number
785736

786737
const x1 = s as keyof T;
787738
>x1 : keyof T
788739
>s as keyof T : keyof T
789740
>s : string
790741
>T : T
791742

792-
const x2 = n as keyof T;
793-
>x2 : keyof T
794-
>n as keyof T : keyof T
795-
>n : number
796-
>T : T
797-
798-
const x3 = k as string;
799-
>x3 : string
743+
const x2 = k as string;
744+
>x2 : string
800745
>k as string : string
801-
>k : K
802-
803-
const x4 = k as number;
804-
>x4 : number
805-
>k as number : number
806-
>k : K
807-
808-
const x5 = k as string | number;
809-
>x5 : string | number
810-
>k as string | number : string | number
811746
>k : K
812747
}
813748

Diff for: tests/baselines/reference/mappedTypeErrors.errors.txt

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(20,20): error TS2313: Type parameter 'P' has a circular constraint.
2-
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(21,20): error TS2322: Type 'Date' is not assignable to type 'string | number'.
3-
Type 'Date' is not assignable to type 'number'.
4-
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(22,19): error TS2344: Type 'Date' does not satisfy the constraint 'string | number'.
5-
Type 'Date' is not assignable to type 'number'.
6-
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(25,24): error TS2344: Type '"foo"' does not satisfy the constraint '"name" | "width" | "height" | "visible"'.
7-
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(26,24): error TS2344: Type '"name" | "foo"' does not satisfy the constraint '"name" | "width" | "height" | "visible"'.
2+
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(21,20): error TS2322: Type 'number' is not assignable to type 'string'.
3+
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(22,20): error TS2322: Type 'Date' is not assignable to type 'string'.
4+
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(23,19): error TS2344: Type 'Date' does not satisfy the constraint 'string'.
5+
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(26,24): error TS2344: Type '"foo"' does not satisfy the constraint '"name" | "width" | "height" | "visible"'.
6+
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(27,24): error TS2344: Type '"name" | "foo"' does not satisfy the constraint '"name" | "width" | "height" | "visible"'.
87
Type '"foo"' is not assignable to type '"name" | "width" | "height" | "visible"'.
9-
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(28,24): error TS2344: Type '"x" | "y"' does not satisfy the constraint '"name" | "width" | "height" | "visible"'.
8+
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(29,24): error TS2344: Type '"x" | "y"' does not satisfy the constraint '"name" | "width" | "height" | "visible"'.
109
Type '"x"' is not assignable to type '"name" | "width" | "height" | "visible"'.
11-
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(30,24): error TS2344: Type 'undefined' does not satisfy the constraint '"name" | "width" | "height" | "visible"'.
12-
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(33,24): error TS2344: Type 'T' does not satisfy the constraint '"name" | "width" | "height" | "visible"'.
10+
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(31,24): error TS2344: Type 'undefined' does not satisfy the constraint '"name" | "width" | "height" | "visible"'.
11+
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(34,24): error TS2344: Type 'T' does not satisfy the constraint '"name" | "width" | "height" | "visible"'.
1312
Type 'T' is not assignable to type '"visible"'.
14-
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(37,24): error TS2344: Type 'T' does not satisfy the constraint '"name" | "width" | "height" | "visible"'.
13+
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(38,24): error TS2344: Type 'T' does not satisfy the constraint '"name" | "width" | "height" | "visible"'.
1514
Type 'string | number' is not assignable to type '"name" | "width" | "height" | "visible"'.
1615
Type 'string' is not assignable to type '"name" | "width" | "height" | "visible"'.
1716
Type 'T' is not assignable to type '"visible"'.
1817
Type 'string | number' is not assignable to type '"visible"'.
1918
Type 'string' is not assignable to type '"visible"'.
20-
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(59,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]?: T[P]; }'.
21-
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(60,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]: T[P]; }'.
22-
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(61,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]?: T[P]; }'.
23-
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(66,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]: T[P][]; }'.
19+
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(60,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]?: T[P]; }'.
20+
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(61,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]: T[P]; }'.
21+
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(62,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]?: T[P]; }'.
22+
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(67,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]: T[P][]; }'.
2423

2524

26-
==== tests/cases/conformance/types/mapped/mappedTypeErrors.ts (13 errors) ====
25+
==== tests/cases/conformance/types/mapped/mappedTypeErrors.ts (14 errors) ====
2726

2827
interface Shape {
2928
name: string;
@@ -46,14 +45,15 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(66,9): error TS2403: Su
4645
type T00 = { [P in P]: string }; // Error
4746
~
4847
!!! error TS2313: Type parameter 'P' has a circular constraint.
49-
type T01 = { [P in Date]: number }; // Error
48+
type T01 = { [P in number]: string }; // Error
49+
~~~~~~
50+
!!! error TS2322: Type 'number' is not assignable to type 'string'.
51+
type T02 = { [P in Date]: number }; // Error
5052
~~~~
51-
!!! error TS2322: Type 'Date' is not assignable to type 'string | number'.
52-
!!! error TS2322: Type 'Date' is not assignable to type 'number'.
53-
type T02 = Record<Date, number>; // Error
53+
!!! error TS2322: Type 'Date' is not assignable to type 'string'.
54+
type T03 = Record<Date, number>; // Error
5455
~~~~
55-
!!! error TS2344: Type 'Date' does not satisfy the constraint 'string | number'.
56-
!!! error TS2344: Type 'Date' is not assignable to type 'number'.
56+
!!! error TS2344: Type 'Date' does not satisfy the constraint 'string'.
5757

5858
type T10 = Pick<Shape, "name">;
5959
type T11 = Pick<Shape, "foo">; // Error

0 commit comments

Comments
 (0)