File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -14960,12 +14960,10 @@ namespace ts {
14960
14960
}
14961
14961
// If no inferences can be made to K's constraint, infer from a union of the property types
14962
14962
// in the source to the template type X.
14963
- const valueTypes = compact([
14964
- getIndexTypeOfType(source, IndexKind.String),
14965
- getIndexTypeOfType(source, IndexKind.Number),
14966
- ...map(getPropertiesOfType(source), getTypeOfSymbol)
14967
- ]);
14968
- inferFromTypes(getUnionType(valueTypes), getTemplateTypeFromMappedType(target));
14963
+ const indexType = source.symbol && source.symbol.flags & SymbolFlags.Enum && getEnumKind(source.symbol) === EnumKind.Literal ?
14964
+ undefined : getIndexTypeOfType(source, IndexKind.String) || getIndexTypeOfType(source, IndexKind.Number);
14965
+ const sourcePropsType = indexType || getUnionType(map(getPropertiesOfType(source), getTypeOfSymbol));
14966
+ inferFromTypes(sourcePropsType, getTemplateTypeFromMappedType(target));
14969
14967
return true;
14970
14968
}
14971
14969
return false;
You can’t perform that action at this time.
0 commit comments