Skip to content

Commit 5a85fca

Browse files
committed
Properly check mapped type constituents / Fix generic mapped type display
1 parent 6f90b31 commit 5a85fca

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/compiler/checker.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2558,10 +2558,8 @@ namespace ts {
25582558
}
25592559

25602560
function createTypeNodeFromObjectType(type: ObjectType): TypeNode {
2561-
if (type.objectFlags & ObjectFlags.Mapped) {
2562-
if (getConstraintTypeFromMappedType(<MappedType>type).flags & (TypeFlags.TypeParameter | TypeFlags.Index)) {
2563-
return createMappedTypeNodeFromType(<MappedType>type);
2564-
}
2561+
if (isGenericMappedType(type)) {
2562+
return createMappedTypeNodeFromType(<MappedType>type);
25652563
}
25662564

25672565
const resolved = resolveStructuredTypeMembers(type);
@@ -3464,11 +3462,9 @@ namespace ts {
34643462
}
34653463

34663464
function writeLiteralType(type: ObjectType, flags: TypeFormatFlags) {
3467-
if (type.objectFlags & ObjectFlags.Mapped) {
3468-
if (getConstraintTypeFromMappedType(<MappedType>type).flags & (TypeFlags.TypeParameter | TypeFlags.Index)) {
3469-
writeMappedType(<MappedType>type);
3470-
return;
3471-
}
3465+
if (isGenericMappedType(type)) {
3466+
writeMappedType(<MappedType>type);
3467+
return;
34723468
}
34733469

34743470
const resolved = resolveStructuredTypeMembers(type);
@@ -18641,6 +18637,8 @@ namespace ts {
1864118637
}
1864218638

1864318639
function checkIndexedAccessType(node: IndexedAccessTypeNode) {
18640+
checkSourceElement(node.objectType);
18641+
checkSourceElement(node.indexType);
1864418642
checkIndexedAccessIndexType(getTypeFromIndexedAccessTypeNode(node), node);
1864518643
}
1864618644

0 commit comments

Comments
 (0)