Skip to content

Commit 81a601b

Browse files
committed
Test:deferred mapped types
1 parent 8616170 commit 81a601b

7 files changed

Lines changed: 97 additions & 8 deletions

tests/baselines/reference/api/tsserverlibrary.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2066,6 +2066,7 @@ declare namespace ts {
20662066
EvolvingArray = 256,
20672067
ObjectLiteralPatternWithComputedProperties = 512,
20682068
ContainsSpread = 1024,
2069+
Deferred = 2048,
20692070
ClassOrInterface = 3,
20702071
}
20712072
interface ObjectType extends Type {

tests/baselines/reference/api/typescript.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2066,6 +2066,7 @@ declare namespace ts {
20662066
EvolvingArray = 256,
20672067
ObjectLiteralPatternWithComputedProperties = 512,
20682068
ContainsSpread = 1024,
2069+
Deferred = 2048,
20692070
ClassOrInterface = 3,
20702071
}
20712072
interface ObjectType extends Type {

tests/baselines/reference/isomorphicMappedTypeInference.types

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,15 +391,15 @@ function f6(s: string) {
391391

392392
});
393393
let v = unboxify(b);
394-
>v : { [x: string]: string | number | boolean; }
395-
>unboxify(b) : { [x: string]: string | number | boolean; }
394+
>v : {}
395+
>unboxify(b) : {}
396396
>unboxify : <T>(obj: Boxified<T>) => T
397397
>b : { [x: string]: Box<number> | Box<string> | Box<boolean>; }
398398

399399
let x: string | number | boolean = v[s];
400400
>x : string | number | boolean
401401
>v[s] : string | number | boolean
402-
>v : { [x: string]: string | number | boolean; }
402+
>v : {}
403403
>s : string
404404
}
405405

tests/baselines/reference/mappedTypeRecursiveInference.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ out.a
88
out.a.a
99
out.a.a.a.a.a.a.a
1010

11+
12+
interface B { [s: string]: B }
13+
declare let b: B;
14+
const oub = foo(b);
15+
oub.b
16+
oub.b.b
17+
oub.b.a.n.a.n.a
18+
1119
let xhr: XMLHttpRequest;
1220
const out2 = foo(xhr);
1321
out2.responseXML
@@ -19,6 +27,10 @@ var out = foo(a);
1927
out.a;
2028
out.a.a;
2129
out.a.a.a.a.a.a.a;
30+
var oub = foo(b);
31+
oub.b;
32+
oub.b.b;
33+
oub.b.a.n.a.n.a;
2234
var xhr;
2335
var out2 = foo(xhr);
2436
out2.responseXML;

tests/baselines/reference/mappedTypeRecursiveInference.symbols

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,26 +59,50 @@ out.a.a.a.a.a.a.a
5959
>a : Symbol(a, Decl(mappedTypeRecursiveInference.ts, 0, 13))
6060
>a : Symbol(a, Decl(mappedTypeRecursiveInference.ts, 0, 13))
6161

62+
63+
interface B { [s: string]: B }
64+
>B : Symbol(B, Decl(mappedTypeRecursiveInference.ts, 7, 17))
65+
>s : Symbol(s, Decl(mappedTypeRecursiveInference.ts, 10, 15))
66+
>B : Symbol(B, Decl(mappedTypeRecursiveInference.ts, 7, 17))
67+
68+
declare let b: B;
69+
>b : Symbol(b, Decl(mappedTypeRecursiveInference.ts, 11, 11))
70+
>B : Symbol(B, Decl(mappedTypeRecursiveInference.ts, 7, 17))
71+
72+
const oub = foo(b);
73+
>oub : Symbol(oub, Decl(mappedTypeRecursiveInference.ts, 12, 5))
74+
>foo : Symbol(foo, Decl(mappedTypeRecursiveInference.ts, 2, 45))
75+
>b : Symbol(b, Decl(mappedTypeRecursiveInference.ts, 11, 11))
76+
77+
oub.b
78+
>oub : Symbol(oub, Decl(mappedTypeRecursiveInference.ts, 12, 5))
79+
80+
oub.b.b
81+
>oub : Symbol(oub, Decl(mappedTypeRecursiveInference.ts, 12, 5))
82+
83+
oub.b.a.n.a.n.a
84+
>oub : Symbol(oub, Decl(mappedTypeRecursiveInference.ts, 12, 5))
85+
6286
let xhr: XMLHttpRequest;
63-
>xhr : Symbol(xhr, Decl(mappedTypeRecursiveInference.ts, 9, 3))
87+
>xhr : Symbol(xhr, Decl(mappedTypeRecursiveInference.ts, 17, 3))
6488
>XMLHttpRequest : Symbol(XMLHttpRequest, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
6589

6690
const out2 = foo(xhr);
67-
>out2 : Symbol(out2, Decl(mappedTypeRecursiveInference.ts, 10, 5))
91+
>out2 : Symbol(out2, Decl(mappedTypeRecursiveInference.ts, 18, 5))
6892
>foo : Symbol(foo, Decl(mappedTypeRecursiveInference.ts, 2, 45))
69-
>xhr : Symbol(xhr, Decl(mappedTypeRecursiveInference.ts, 9, 3))
93+
>xhr : Symbol(xhr, Decl(mappedTypeRecursiveInference.ts, 17, 3))
7094

7195
out2.responseXML
7296
>out2.responseXML : Symbol(responseXML, Decl(lib.dom.d.ts, --, --))
73-
>out2 : Symbol(out2, Decl(mappedTypeRecursiveInference.ts, 10, 5))
97+
>out2 : Symbol(out2, Decl(mappedTypeRecursiveInference.ts, 18, 5))
7498
>responseXML : Symbol(responseXML, Decl(lib.dom.d.ts, --, --))
7599

76100
out2.responseXML.activeElement.className.length
77101
>out2.responseXML.activeElement.className.length : Symbol(length, Decl(lib.es5.d.ts, --, --))
78102
>out2.responseXML.activeElement.className : Symbol(className, Decl(lib.dom.d.ts, --, --))
79103
>out2.responseXML.activeElement : Symbol(activeElement, Decl(lib.dom.d.ts, --, --))
80104
>out2.responseXML : Symbol(responseXML, Decl(lib.dom.d.ts, --, --))
81-
>out2 : Symbol(out2, Decl(mappedTypeRecursiveInference.ts, 10, 5))
105+
>out2 : Symbol(out2, Decl(mappedTypeRecursiveInference.ts, 18, 5))
82106
>responseXML : Symbol(responseXML, Decl(lib.dom.d.ts, --, --))
83107
>activeElement : Symbol(activeElement, Decl(lib.dom.d.ts, --, --))
84108
>className : Symbol(className, Decl(lib.dom.d.ts, --, --))

tests/baselines/reference/mappedTypeRecursiveInference.types

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,49 @@ out.a.a.a.a.a.a.a
6060
>a : { a: {}; }
6161
>a : { a: {}; }
6262

63+
64+
interface B { [s: string]: B }
65+
>B : B
66+
>s : string
67+
>B : B
68+
69+
declare let b: B;
70+
>b : B
71+
>B : B
72+
73+
const oub = foo(b);
74+
>oub : {}
75+
>foo(b) : {}
76+
>foo : <T>(deep: Deep<T>) => T
77+
>b : B
78+
79+
oub.b
80+
>oub.b : {}
81+
>oub : {}
82+
>b : {}
83+
84+
oub.b.b
85+
>oub.b.b : {}
86+
>oub.b : {}
87+
>oub : {}
88+
>b : {}
89+
>b : {}
90+
91+
oub.b.a.n.a.n.a
92+
>oub.b.a.n.a.n.a : {}
93+
>oub.b.a.n.a.n : {}
94+
>oub.b.a.n.a : {}
95+
>oub.b.a.n : {}
96+
>oub.b.a : {}
97+
>oub.b : {}
98+
>oub : {}
99+
>b : {}
100+
>a : {}
101+
>n : {}
102+
>a : {}
103+
>n : {}
104+
>a : {}
105+
63106
let xhr: XMLHttpRequest;
64107
>xhr : XMLHttpRequest
65108
>XMLHttpRequest : XMLHttpRequest

tests/cases/compiler/mappedTypeRecursiveInference.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ out.a
88
out.a.a
99
out.a.a.a.a.a.a.a
1010

11+
12+
interface B { [s: string]: B }
13+
declare let b: B;
14+
const oub = foo(b);
15+
oub.b
16+
oub.b.b
17+
oub.b.a.n.a.n.a
18+
1119
let xhr: XMLHttpRequest;
1220
const out2 = foo(xhr);
1321
out2.responseXML

0 commit comments

Comments
 (0)