mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-04-17 01:49:41 -05:00
Simplify non-inferrable property check to rely on propagation
This commit is contained in:
@@ -14502,16 +14502,10 @@ namespace ts {
|
||||
}
|
||||
|
||||
function createReverseMappedType(source: Type, target: MappedType, constraint: IndexType) {
|
||||
const properties = getPropertiesOfType(source);
|
||||
if (properties.length === 0 && !getIndexInfoOfType(source, IndexKind.String)) {
|
||||
return undefined;
|
||||
}
|
||||
// If any property contains context sensitive functions that have been skipped, the source type
|
||||
// is incomplete and we can't infer a meaningful input type.
|
||||
for (const prop of properties) {
|
||||
if (getObjectFlags(getTypeOfSymbol(prop)) & ObjectFlags.NonInferrableType) {
|
||||
return undefined;
|
||||
}
|
||||
if (getObjectFlags(source) & ObjectFlags.NonInferrableType || getPropertiesOfType(source).length === 0 && !getIndexInfoOfType(source, IndexKind.String)) {
|
||||
return undefined;
|
||||
}
|
||||
// For arrays and tuples we infer new arrays and tuples where the reverse mapping has been
|
||||
// applied to the element type(s).
|
||||
|
||||
Reference in New Issue
Block a user