Test:XMLHttpRequest inference to PartialDeep<T>

Compilation didn't finish before! Now it does.
This commit is contained in:
Nathan Shively-Sanders 2017-12-11 09:47:04 -08:00
parent 05de0a7da3
commit 6b024f6495
4 changed files with 28 additions and 0 deletions

View file

@ -4,7 +4,12 @@ declare let a: A;
type Deep<T> = { [K in keyof T]: Deep<T[K]> }
declare function foo<T>(deep: Deep<T>): T;
const out = foo(a);
let xhr: XMLHttpRequest;
const out2 = foo(xhr);
//// [mappedTypeRecursiveInference.js]
var out = foo(a);
var xhr;
var out2 = foo(xhr);

View file

@ -30,3 +30,12 @@ const out = foo(a);
>foo : Symbol(foo, Decl(mappedTypeRecursiveInference.ts, 2, 45))
>a : Symbol(a, Decl(mappedTypeRecursiveInference.ts, 1, 11))
let xhr: XMLHttpRequest;
>xhr : Symbol(xhr, Decl(mappedTypeRecursiveInference.ts, 6, 3))
>XMLHttpRequest : Symbol(XMLHttpRequest, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
const out2 = foo(xhr);
>out2 : Symbol(out2, Decl(mappedTypeRecursiveInference.ts, 7, 5))
>foo : Symbol(foo, Decl(mappedTypeRecursiveInference.ts, 2, 45))
>xhr : Symbol(xhr, Decl(mappedTypeRecursiveInference.ts, 6, 3))

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,9 @@
// @lib: es6, dom
interface A { a: A }
declare let a: A;
type Deep<T> = { [K in keyof T]: Deep<T[K]> }
declare function foo<T>(deep: Deep<T>): T;
const out = foo(a);
let xhr: XMLHttpRequest;
const out2 = foo(xhr);