Support partial reverse mapped inferences with tuple types (#41106)

* Support partial reverse mapped inferences with tuple types

* Add tests

* Accept new baselines
This commit is contained in:
Anders Hejlsberg
2020-10-22 11:27:41 -07:00
committed by GitHub
parent 97083ea6a2
commit d1f87d18b1
6 changed files with 304 additions and 1 deletions

View File

@@ -19709,7 +19709,8 @@ namespace ts {
// arrow function, but is considered partially inferable because property 'a' has an inferable type.
function isPartiallyInferableType(type: Type): boolean {
return !(getObjectFlags(type) & ObjectFlags.NonInferrableType) ||
isObjectLiteralType(type) && some(getPropertiesOfType(type), prop => isPartiallyInferableType(getTypeOfSymbol(prop)));
isObjectLiteralType(type) && some(getPropertiesOfType(type), prop => isPartiallyInferableType(getTypeOfSymbol(prop))) ||
isTupleType(type) && some(getTypeArguments(type), isPartiallyInferableType);
}
function createReverseMappedType(source: Type, target: MappedType, constraint: IndexType) {