Skip to content

Commit 8d87971

Browse files
committed
Minor fixes
1 parent ece1f19 commit 8d87971

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/compiler/checker.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5744,7 +5744,7 @@ namespace ts {
57445744

57455745
function getIndexedAccessType(objectType: Type, indexType: Type, errorNode?: Node) {
57465746
if (indexType.flags & TypeFlags.TypeParameter) {
5747-
if (!isTypeAssignableTo(getConstraintOfTypeParameter(<TypeParameter>indexType), getIndexType(objectType))) {
5747+
if (!isTypeAssignableTo(getConstraintOfTypeParameter(<TypeParameter>indexType) || emptyObjectType, getIndexType(objectType))) {
57485748
if (errorNode) {
57495749
error(errorNode, Diagnostics.Type_0_is_not_constrained_to_keyof_1, typeToString(indexType), typeToString(objectType));
57505750
}
@@ -11549,9 +11549,8 @@ namespace ts {
1154911549
return objectType;
1155011550
}
1155111551

11552-
if (indexType.flags & TypeFlags.TypeParameter &&
11553-
isTypeAssignableTo(getConstraintOfTypeParameter(<TypeParameter>indexType), getIndexType(objectType))) {
11554-
return getIndexedAccessType(objectType, indexType);
11552+
if (indexType.flags & TypeFlags.TypeParameter) {
11553+
return getIndexedAccessType(objectType, indexType, node.argumentExpression);
1155511554
}
1155611555

1155711556
objectType = getApparentType(objectType);

0 commit comments

Comments
 (0)