Address CR feedback

This commit is contained in:
Anders Hejlsberg 2019-04-16 17:41:33 -07:00
parent 436f6067ac
commit efa16ac11f

View file

@ -14960,8 +14960,8 @@ namespace ts {
}
// If no inferences can be made to K's constraint, infer from a union of the property types
// in the source to the template type X.
const indexType = source.symbol && source.symbol.flags & SymbolFlags.Enum && getEnumKind(source.symbol) === EnumKind.Literal ?
undefined : getIndexTypeOfType(source, IndexKind.String) || getIndexTypeOfType(source, IndexKind.Number);
const indexInfo = getIndexInfoOfType(source, IndexKind.String) || getIndexInfoOfType(source, IndexKind.Number);
const indexType = indexInfo && indexInfo !== enumNumberIndexInfo ? indexInfo.type : undefined;
const sourcePropsType = indexType || getUnionType(map(getPropertiesOfType(source), getTypeOfSymbol));
inferFromTypes(sourcePropsType, getTemplateTypeFromMappedType(target));
return true;