(source, target, constraint)
| 68215 | isTupleType(type) && ts.some(getTypeArguments(type), isPartiallyInferableType); |
| 68216 | } |
| 68217 | function createReverseMappedType(source, target, constraint) { |
| 68218 | // We consider a source type reverse mappable if it has a string index signature or if |
| 68219 | // it has one or more properties and is of a partially inferable type. |
| 68220 | if (!(getIndexInfoOfType(source, stringType) || getPropertiesOfType(source).length !== 0 && isPartiallyInferableType(source))) { |
| 68221 | return undefined; |
| 68222 | } |
| 68223 | // For arrays and tuples we infer new arrays and tuples where the reverse mapping has been |
| 68224 | // applied to the element type(s). |
| 68225 | if (isArrayType(source)) { |
| 68226 | return createArrayType(inferReverseMappedType(getTypeArguments(source)[0], target, constraint), isReadonlyArrayType(source)); |
| 68227 | } |
| 68228 | if (isTupleType(source)) { |
| 68229 | var elementTypes = ts.map(getTypeArguments(source), function (t) { return inferReverseMappedType(t, target, constraint); }); |
| 68230 | var elementFlags = getMappedTypeModifiers(target) & 4 /* MappedTypeModifiers.IncludeOptional */ ? |
| 68231 | ts.sameMap(source.target.elementFlags, function (f) { return f & 2 /* ElementFlags.Optional */ ? 1 /* ElementFlags.Required */ : f; }) : |
| 68232 | source.target.elementFlags; |
| 68233 | return createTupleType(elementTypes, elementFlags, source.target.readonly, source.target.labeledElementDeclarations); |
| 68234 | } |
| 68235 | // For all other object types we infer a new object type where the reverse mapping has been |
| 68236 | // applied to the type of each property. |
| 68237 | var reversed = createObjectType(1024 /* ObjectFlags.ReverseMapped */ | 16 /* ObjectFlags.Anonymous */, /*symbol*/ undefined); |
| 68238 | reversed.source = source; |
| 68239 | reversed.mappedType = target; |
| 68240 | reversed.constraintType = constraint; |
| 68241 | return reversed; |
| 68242 | } |
| 68243 | function getTypeOfReverseMappedSymbol(symbol) { |
| 68244 | var links = getSymbolLinks(symbol); |
| 68245 | if (!links.type) { |
no test coverage detected
searching dependent graphs…