Instantiate original target type in substituteIndexedMappedType (#49205)

This commit is contained in:
Anders Hejlsberg 2022-05-23 11:07:33 -07:00 committed by GitHub
parent 006ae339bf
commit c592ee781d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15798,7 +15798,7 @@ namespace ts {
function substituteIndexedMappedType(objectType: MappedType, index: Type) {
const mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
const templateMapper = combineTypeMappers(objectType.mapper, mapper);
return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper);
return instantiateType(getTemplateTypeFromMappedType(objectType.target as MappedType || objectType), templateMapper);
}
function getIndexedAccessType(objectType: Type, indexType: Type, accessFlags = AccessFlags.None, accessNode?: ElementAccessExpression | IndexedAccessTypeNode | PropertyName | BindingName | SyntheticExpression, aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[]): Type {