@@ -4667,12 +4667,8 @@ namespace ts {
4667
4667
else {
4668
4668
// Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form)
4669
4669
const name = declaration.propertyName || <Identifier>declaration.name;
4670
- const exprType = isComputedPropertyName(name)
4671
- ? checkComputedPropertyName(name)
4672
- : isIdentifier(name)
4673
- ? getLiteralType(unescapeLeadingUnderscores(name.escapedText))
4674
- : checkExpression(name);
4675
- const declaredType = checkIndexedAccessIndexType(getIndexedAccessType(getApparentType(parentType), exprType, name), name);
4670
+ const exprType = getLiteralTypeFromPropertyName(name);
4671
+ const declaredType = checkIndexedAccessIndexType(getIndexedAccessType(parentType, exprType, name), name);
4676
4672
type = getFlowTypeOfReference(declaration, getConstraintForLocation(declaredType, declaration.name));
4677
4673
}
4678
4674
}
@@ -9528,7 +9524,7 @@ namespace ts {
9528
9524
// object type. Note that for a generic T and a non-generic K, we eagerly resolve T[K] if it originates in
9529
9525
// an expression. This is to preserve backwards compatibility. For example, an element access 'this["foo"]'
9530
9526
// has always been resolved eagerly using the constraint type of 'this' at the given location.
9531
- if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind === SyntaxKind.ElementAccessExpression ) && isGenericObjectType(objectType)) {
9527
+ if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind !== SyntaxKind.IndexedAccessType ) && isGenericObjectType(objectType)) {
9532
9528
if (objectType.flags & TypeFlags.AnyOrUnknown) {
9533
9529
return objectType;
9534
9530
}
0 commit comments