(source, target)
| 69060 | applyToReturnTypes(source, target, inferFromTypes); |
| 69061 | } |
| 69062 | function inferFromIndexTypes(source, target) { |
| 69063 | // Inferences across mapped type index signatures are pretty much the same a inferences to homomorphic variables |
| 69064 | var priority = (ts.getObjectFlags(source) & ts.getObjectFlags(target) & 32 /* ObjectFlags.Mapped */) ? 8 /* InferencePriority.HomomorphicMappedType */ : 0; |
| 69065 | var indexInfos = getIndexInfosOfType(target); |
| 69066 | if (isObjectTypeWithInferableIndex(source)) { |
| 69067 | for (var _i = 0, indexInfos_6 = indexInfos; _i < indexInfos_6.length; _i++) { |
| 69068 | var targetInfo = indexInfos_6[_i]; |
| 69069 | var propTypes = []; |
| 69070 | for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) { |
| 69071 | var prop = _b[_a]; |
| 69072 | if (isApplicableIndexType(getLiteralTypeFromProperty(prop, 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */), targetInfo.keyType)) { |
| 69073 | var propType = getTypeOfSymbol(prop); |
| 69074 | propTypes.push(prop.flags & 16777216 /* SymbolFlags.Optional */ ? removeMissingOrUndefinedType(propType) : propType); |
| 69075 | } |
| 69076 | } |
| 69077 | for (var _c = 0, _d = getIndexInfosOfType(source); _c < _d.length; _c++) { |
| 69078 | var info = _d[_c]; |
| 69079 | if (isApplicableIndexType(info.keyType, targetInfo.keyType)) { |
| 69080 | propTypes.push(info.type); |
| 69081 | } |
| 69082 | } |
| 69083 | if (propTypes.length) { |
| 69084 | inferWithPriority(getUnionType(propTypes), targetInfo.type, priority); |
| 69085 | } |
| 69086 | } |
| 69087 | } |
| 69088 | for (var _e = 0, indexInfos_7 = indexInfos; _e < indexInfos_7.length; _e++) { |
| 69089 | var targetInfo = indexInfos_7[_e]; |
| 69090 | var sourceInfo = getApplicableIndexInfo(source, targetInfo.keyType); |
| 69091 | if (sourceInfo) { |
| 69092 | inferWithPriority(sourceInfo.type, targetInfo.type, priority); |
| 69093 | } |
| 69094 | } |
| 69095 | } |
| 69096 | } |
| 69097 | function isTypeOrBaseIdenticalTo(s, t) { |
| 69098 | return exactOptionalPropertyTypes && t === missingType ? s === t : |
no test coverage detected
searching dependent graphs…