From 9aa5443bbc2587dba2b2ffeb7860c100659256e1 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 3 Jan 2018 16:10:26 -0800 Subject: [PATCH] Fix printing of deferred mapped types' index signatures --- src/compiler/checker.ts | 2 +- .../isomorphicMappedTypeInference.types | 6 +-- .../mappedTypeRecursiveInference.types | 46 +++++++++---------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 770a31e9435..93f3428ba73 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2860,7 +2860,7 @@ namespace ts { for (const signature of resolvedType.constructSignatures) { typeElements.push(signatureToSignatureDeclarationHelper(signature, SyntaxKind.ConstructSignature, context)); } - if (resolvedType.stringIndexInfo && !(resolvedType.objectFlags & ObjectFlags.Deferred)) { + if (resolvedType.stringIndexInfo) { const indexInfo = resolvedType.objectFlags & ObjectFlags.Deferred ? createIndexInfo(emptyObjectType, resolvedType.stringIndexInfo.isReadonly, resolvedType.stringIndexInfo.declaration) : resolvedType.stringIndexInfo; diff --git a/tests/baselines/reference/isomorphicMappedTypeInference.types b/tests/baselines/reference/isomorphicMappedTypeInference.types index 23306d30313..1a78dff0e78 100644 --- a/tests/baselines/reference/isomorphicMappedTypeInference.types +++ b/tests/baselines/reference/isomorphicMappedTypeInference.types @@ -391,15 +391,15 @@ function f6(s: string) { }); let v = unboxify(b); ->v : {} ->unboxify(b) : {} +>v : { [x: string]: {}; } +>unboxify(b) : { [x: string]: {}; } >unboxify : (obj: Boxified) => T >b : { [x: string]: Box | Box | Box; } let x: string | number | boolean = v[s]; >x : string | number | boolean >v[s] : string | number | boolean ->v : {} +>v : { [x: string]: {}; } >s : string } diff --git a/tests/baselines/reference/mappedTypeRecursiveInference.types b/tests/baselines/reference/mappedTypeRecursiveInference.types index ca2761ac964..c48dda05f31 100644 --- a/tests/baselines/reference/mappedTypeRecursiveInference.types +++ b/tests/baselines/reference/mappedTypeRecursiveInference.types @@ -71,37 +71,37 @@ declare let b: B; >B : B const oub = foo(b); ->oub : {} ->foo(b) : {} +>oub : { [x: string]: {}; } +>foo(b) : { [x: string]: {}; } >foo : (deep: Deep) => T >b : B oub.b ->oub.b : {} ->oub : {} ->b : {} +>oub.b : { [x: string]: {}; } +>oub : { [x: string]: {}; } +>b : { [x: string]: {}; } oub.b.b ->oub.b.b : {} ->oub.b : {} ->oub : {} ->b : {} ->b : {} +>oub.b.b : { [x: string]: {}; } +>oub.b : { [x: string]: {}; } +>oub : { [x: string]: {}; } +>b : { [x: string]: {}; } +>b : { [x: string]: {}; } oub.b.a.n.a.n.a ->oub.b.a.n.a.n.a : {} ->oub.b.a.n.a.n : {} ->oub.b.a.n.a : {} ->oub.b.a.n : {} ->oub.b.a : {} ->oub.b : {} ->oub : {} ->b : {} ->a : {} ->n : {} ->a : {} ->n : {} ->a : {} +>oub.b.a.n.a.n.a : { [x: string]: {}; } +>oub.b.a.n.a.n : { [x: string]: {}; } +>oub.b.a.n.a : { [x: string]: {}; } +>oub.b.a.n : { [x: string]: {}; } +>oub.b.a : { [x: string]: {}; } +>oub.b : { [x: string]: {}; } +>oub : { [x: string]: {}; } +>b : { [x: string]: {}; } +>a : { [x: string]: {}; } +>n : { [x: string]: {}; } +>a : { [x: string]: {}; } +>n : { [x: string]: {}; } +>a : { [x: string]: {}; } let xhr: XMLHttpRequest; >xhr : XMLHttpRequest