Even more succinct

This commit is contained in:
Anders Hejlsberg
2019-04-16 18:26:24 -07:00
parent efa16ac11f
commit 3435451dcc

View File

@@ -14960,9 +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 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));
const indexInfo = getIndexInfoOfType(source, IndexKind.String) || getNonEnumNumberIndexInfo(source);
const sourcePropsType = indexInfo && indexInfo.type || getUnionType(map(getPropertiesOfType(source), getTypeOfSymbol));
inferFromTypes(sourcePropsType, getTemplateTypeFromMappedType(target));
return true;
}