mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 02:33:53 -06:00
Fix printing of deferred mapped types
A deferred mapped type with a source that has an index signature now
prints {} as the type of the index signature. This avoids an infinite
recursion.
This commit is contained in:
parent
a43adad080
commit
8616170060
@ -2860,8 +2860,11 @@ namespace ts {
|
||||
for (const signature of resolvedType.constructSignatures) {
|
||||
typeElements.push(<ConstructSignatureDeclaration>signatureToSignatureDeclarationHelper(signature, SyntaxKind.ConstructSignature, context));
|
||||
}
|
||||
if (resolvedType.stringIndexInfo) {
|
||||
typeElements.push(indexInfoToIndexSignatureDeclarationHelper(resolvedType.stringIndexInfo, IndexKind.String, context));
|
||||
if (resolvedType.stringIndexInfo && !(resolvedType.objectFlags & ObjectFlags.Deferred)) {
|
||||
const indexInfo = resolvedType.objectFlags & ObjectFlags.Deferred ?
|
||||
createIndexInfo(emptyObjectType, resolvedType.stringIndexInfo.isReadonly, resolvedType.stringIndexInfo.declaration) :
|
||||
resolvedType.stringIndexInfo;
|
||||
typeElements.push(indexInfoToIndexSignatureDeclarationHelper(indexInfo, IndexKind.String, context));
|
||||
}
|
||||
if (resolvedType.numberIndexInfo) {
|
||||
typeElements.push(indexInfoToIndexSignatureDeclarationHelper(resolvedType.numberIndexInfo, IndexKind.Number, context));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user