@typescript-deploys/pr-build 5.0.0-pr-52944-9 → 5.0.0-pr-52947-7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +94 -244
- package/lib/tsserver.js +94 -244
- package/lib/tsserverlibrary.js +94 -244
- package/lib/typescript.js +94 -244
- package/lib/typingsInstaller.js +2 -1
- package/package.json +1 -1
package/lib/tsserver.js
CHANGED
|
@@ -2288,7 +2288,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2288
2288
|
|
|
2289
2289
|
// src/compiler/corePublic.ts
|
|
2290
2290
|
var versionMajorMinor = "5.0";
|
|
2291
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2291
|
+
var version = `${versionMajorMinor}.0-insiders.20230224`;
|
|
2292
2292
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2293
2293
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2294
2294
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6707,6 +6707,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
6707
6707
|
TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
|
|
6708
6708
|
TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
|
|
6709
6709
|
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323363] = "NotPrimitiveUnion";
|
|
6710
|
+
TypeFlags2[TypeFlags2["HasWrapper"] = 402668540] = "HasWrapper";
|
|
6710
6711
|
return TypeFlags2;
|
|
6711
6712
|
})(TypeFlags || {});
|
|
6712
6713
|
var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
@@ -59028,15 +59029,27 @@ function createTypeChecker(host) {
|
|
|
59028
59029
|
isInJSFile(signature.declaration)
|
|
59029
59030
|
);
|
|
59030
59031
|
}
|
|
59031
|
-
function
|
|
59032
|
-
const
|
|
59033
|
-
|
|
59034
|
-
|
|
59035
|
-
|
|
59036
|
-
|
|
59032
|
+
function getBaseSignature(signature) {
|
|
59033
|
+
const typeParameters = signature.typeParameters;
|
|
59034
|
+
if (typeParameters) {
|
|
59035
|
+
if (signature.baseSignatureCache) {
|
|
59036
|
+
return signature.baseSignatureCache;
|
|
59037
|
+
}
|
|
59038
|
+
const typeEraser = createTypeEraser(typeParameters);
|
|
59039
|
+
const baseConstraintMapper = createTypeMapper(typeParameters, map(typeParameters, (tp) => getConstraintOfTypeParameter(tp) || unknownType));
|
|
59040
|
+
let baseConstraints = map(typeParameters, (tp) => instantiateType(tp, baseConstraintMapper) || unknownType);
|
|
59041
|
+
for (let i = 0; i < typeParameters.length - 1; i++) {
|
|
59042
|
+
baseConstraints = instantiateTypes(baseConstraints, baseConstraintMapper);
|
|
59043
|
+
}
|
|
59044
|
+
baseConstraints = instantiateTypes(baseConstraints, typeEraser);
|
|
59045
|
+
return signature.baseSignatureCache = instantiateSignature(
|
|
59046
|
+
signature,
|
|
59047
|
+
createTypeMapper(typeParameters, baseConstraints),
|
|
59048
|
+
/*eraseTypeParameters*/
|
|
59049
|
+
true
|
|
59050
|
+
);
|
|
59037
59051
|
}
|
|
59038
|
-
|
|
59039
|
-
return createTypeMapper(typeParameters, baseConstraints);
|
|
59052
|
+
return signature;
|
|
59040
59053
|
}
|
|
59041
59054
|
function getOrCreateTypeFromSignature(signature) {
|
|
59042
59055
|
var _a2;
|
|
@@ -61561,9 +61574,9 @@ function createTypeChecker(host) {
|
|
|
61561
61574
|
}
|
|
61562
61575
|
}
|
|
61563
61576
|
if (!checkTypeDeferred) {
|
|
61564
|
-
inferTypes(context, checkType, instantiateType(extendsType, freshMapper), 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
|
|
61577
|
+
inferTypes(context.inferences, checkType, instantiateType(extendsType, freshMapper), 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
|
|
61565
61578
|
}
|
|
61566
|
-
const innerMapper = combineTypeMappers(freshMapper,
|
|
61579
|
+
const innerMapper = combineTypeMappers(freshMapper, context.mapper);
|
|
61567
61580
|
combinedMapper = mapper ? combineTypeMappers(innerMapper, mapper) : innerMapper;
|
|
61568
61581
|
}
|
|
61569
61582
|
const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
|
|
@@ -62250,11 +62263,8 @@ function createTypeChecker(host) {
|
|
|
62250
62263
|
void 0
|
|
62251
62264
|
);
|
|
62252
62265
|
}
|
|
62253
|
-
function createBackreferenceMapper(context,
|
|
62254
|
-
const
|
|
62255
|
-
Debug.assert(inferences, "Inference for backreference mapper must exist within provided context");
|
|
62256
|
-
const index = inferences.indexOf(inference);
|
|
62257
|
-
const forwardInferences = inferences.slice(index);
|
|
62266
|
+
function createBackreferenceMapper(context, index) {
|
|
62267
|
+
const forwardInferences = context.inferences.slice(index);
|
|
62258
62268
|
return createTypeMapper(map(forwardInferences, (i) => i.typeParameter), map(forwardInferences, () => unknownType));
|
|
62259
62269
|
}
|
|
62260
62270
|
function combineTypeMappers(mapper1, mapper2) {
|
|
@@ -63904,7 +63914,7 @@ function createTypeChecker(host) {
|
|
|
63904
63914
|
function tryElaborateErrorsForPrimitivesAndObjects(source2, target2) {
|
|
63905
63915
|
const sourceType = symbolValueDeclarationIsContextSensitive(source2.symbol) ? typeToString(source2, source2.symbol.valueDeclaration) : typeToString(source2);
|
|
63906
63916
|
const targetType = symbolValueDeclarationIsContextSensitive(target2.symbol) ? typeToString(target2, target2.symbol.valueDeclaration) : typeToString(target2);
|
|
63907
|
-
if (globalStringType === source2 && stringType === target2 || globalNumberType === source2 && numberType === target2 || globalBooleanType === source2 && booleanType === target2 || getGlobalESSymbolType() === source2 && esSymbolType === target2) {
|
|
63917
|
+
if (globalStringType === source2 && stringType === target2 || globalNumberType === source2 && numberType === target2 || globalBooleanType === source2 && booleanType === target2 || getGlobalESSymbolType() === source2 && esSymbolType === target2 || getGlobalBigIntType() === source2 && bigintType === target2) {
|
|
63908
63918
|
reportError(Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType);
|
|
63909
63919
|
}
|
|
63910
63920
|
}
|
|
@@ -64061,6 +64071,9 @@ function createTypeChecker(host) {
|
|
|
64061
64071
|
}
|
|
64062
64072
|
if (source2.flags & 524288 /* Object */ && target2.flags & 134348796 /* Primitive */) {
|
|
64063
64073
|
tryElaborateErrorsForPrimitivesAndObjects(source2, target2);
|
|
64074
|
+
}
|
|
64075
|
+
if (target2.flags & 524288 /* Object */ && source2.flags & 134348796 /* Primitive */) {
|
|
64076
|
+
tryElaborateErrorsForPrimitivesAndObjects(target2, source2);
|
|
64064
64077
|
} else if (source2.symbol && source2.flags & 524288 /* Object */ && globalObjectType === source2) {
|
|
64065
64078
|
reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
|
|
64066
64079
|
} else if (getObjectFlags(source2) & 2048 /* JsxAttributes */ && target2.flags & 2097152 /* Intersection */) {
|
|
@@ -65068,10 +65081,9 @@ function createTypeChecker(host) {
|
|
|
65068
65081
|
0 /* None */,
|
|
65069
65082
|
isRelatedToWorker
|
|
65070
65083
|
);
|
|
65071
|
-
inferTypes(ctx, target2.extendsType, sourceExtends, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
|
|
65072
|
-
|
|
65073
|
-
|
|
65074
|
-
mapper = newMapper;
|
|
65084
|
+
inferTypes(ctx.inferences, target2.extendsType, sourceExtends, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
|
|
65085
|
+
sourceExtends = instantiateType(sourceExtends, ctx.mapper);
|
|
65086
|
+
mapper = ctx.mapper;
|
|
65075
65087
|
}
|
|
65076
65088
|
if (isTypeIdenticalTo(sourceExtends, target2.extendsType) && (isRelatedTo(source2.checkType, target2.checkType, 3 /* Both */) || isRelatedTo(target2.checkType, source2.checkType, 3 /* Both */))) {
|
|
65077
65089
|
if (result2 = isRelatedTo(instantiateType(getTrueTypeFromConditionalType(source2), mapper), getTrueTypeFromConditionalType(target2), 3 /* Both */, reportErrors2)) {
|
|
@@ -65109,8 +65121,13 @@ function createTypeChecker(host) {
|
|
|
65109
65121
|
}
|
|
65110
65122
|
const sourceIsPrimitive = !!(sourceFlags & 134348796 /* Primitive */);
|
|
65111
65123
|
if (relation !== identityRelation) {
|
|
65124
|
+
const originalSource = source2;
|
|
65125
|
+
const originalFlags = sourceFlags;
|
|
65112
65126
|
source2 = getApparentType(source2);
|
|
65113
65127
|
sourceFlags = source2.flags;
|
|
65128
|
+
if (source2 !== originalSource && originalFlags & 402668540 /* HasWrapper */ && !(sourceFlags & 402668540 /* HasWrapper */) && source2 === target2) {
|
|
65129
|
+
return 0 /* False */;
|
|
65130
|
+
}
|
|
65114
65131
|
} else if (isGenericMappedType(source2)) {
|
|
65115
65132
|
return 0 /* False */;
|
|
65116
65133
|
}
|
|
@@ -66909,12 +66926,7 @@ function createTypeChecker(host) {
|
|
|
66909
66926
|
return createInferenceContextWorker(typeParameters.map(createInferenceInfo), signature, flags, compareTypes || compareTypesAssignable);
|
|
66910
66927
|
}
|
|
66911
66928
|
function cloneInferenceContext(context, extraFlags = 0) {
|
|
66912
|
-
|
|
66913
|
-
if (context && context.freeTypeVariables) {
|
|
66914
|
-
newContext.freeTypeVariables = map(context.freeTypeVariables, cloneInferenceInfo);
|
|
66915
|
-
newContext.freeTypeVariableSourceSignatures = new Map(mapIterator(context.freeTypeVariableSourceSignatures.entries(), ([k, v]) => [k, new Map(v.entries())]));
|
|
66916
|
-
}
|
|
66917
|
-
return newContext;
|
|
66929
|
+
return context && createInferenceContextWorker(map(context.inferences, cloneInferenceInfo), context.signature, context.flags | extraFlags, context.compareTypes);
|
|
66918
66930
|
}
|
|
66919
66931
|
function createInferenceContextWorker(inferences, signature, flags, compareTypes) {
|
|
66920
66932
|
const context = {
|
|
@@ -66931,29 +66943,20 @@ function createTypeChecker(host) {
|
|
|
66931
66943
|
return context;
|
|
66932
66944
|
}
|
|
66933
66945
|
function makeFixingMapperForContext(context) {
|
|
66934
|
-
return makeDeferredTypeMapper(map(context.inferences, (i) => i.typeParameter), map(context.inferences, (inference) => () => {
|
|
66946
|
+
return makeDeferredTypeMapper(map(context.inferences, (i) => i.typeParameter), map(context.inferences, (inference, i) => () => {
|
|
66935
66947
|
if (!inference.isFixed) {
|
|
66936
66948
|
inferFromIntraExpressionSites(context);
|
|
66937
66949
|
clearCachedInferences(context.inferences);
|
|
66938
66950
|
inference.isFixed = true;
|
|
66939
66951
|
}
|
|
66940
|
-
return getInferredType(context,
|
|
66952
|
+
return getInferredType(context, i);
|
|
66941
66953
|
}));
|
|
66942
66954
|
}
|
|
66943
66955
|
function makeNonFixingMapperForContext(context) {
|
|
66944
|
-
return makeDeferredTypeMapper(map(context.inferences, (i) => i.typeParameter), map(context.inferences, (
|
|
66945
|
-
return getInferredType(context,
|
|
66956
|
+
return makeDeferredTypeMapper(map(context.inferences, (i) => i.typeParameter), map(context.inferences, (_, i) => () => {
|
|
66957
|
+
return getInferredType(context, i);
|
|
66946
66958
|
}));
|
|
66947
66959
|
}
|
|
66948
|
-
function makeFreeTypeVariableMapperForContext(context) {
|
|
66949
|
-
if (!context.freeTypeVariables)
|
|
66950
|
-
return void 0;
|
|
66951
|
-
const baseMapper = getTypeParameterConstraintMapper(map(context.freeTypeVariables, (i) => i.typeParameter));
|
|
66952
|
-
return context.freeTypeVariables.reduceRight(
|
|
66953
|
-
(previous, i) => combineTypeMappers(makeDeferredTypeMapper([i.typeParameter], [() => hasInferenceCandidatesOrDefault(i) ? getInferredType(context, i) : instantiateType(i.typeParameter, baseMapper)]), previous),
|
|
66954
|
-
baseMapper
|
|
66955
|
-
);
|
|
66956
|
-
}
|
|
66957
66960
|
function clearCachedInferences(inferences) {
|
|
66958
66961
|
for (const inference of inferences) {
|
|
66959
66962
|
if (!inference.isFixed) {
|
|
@@ -66970,7 +66973,7 @@ function createTypeChecker(host) {
|
|
|
66970
66973
|
for (const { node, type } of context.intraExpressionInferenceSites) {
|
|
66971
66974
|
const contextualType = node.kind === 171 /* MethodDeclaration */ ? getContextualTypeForObjectLiteralMethod(node, 2 /* NoConstraints */) : getContextualType2(node, 2 /* NoConstraints */);
|
|
66972
66975
|
if (contextualType) {
|
|
66973
|
-
inferTypes(context, type, contextualType);
|
|
66976
|
+
inferTypes(context.inferences, type, contextualType);
|
|
66974
66977
|
}
|
|
66975
66978
|
}
|
|
66976
66979
|
context.intraExpressionInferenceSites = void 0;
|
|
@@ -67005,8 +67008,7 @@ function createTypeChecker(host) {
|
|
|
67005
67008
|
return inferences.length ? createInferenceContextWorker(map(inferences, cloneInferenceInfo), context.signature, context.flags, context.compareTypes) : void 0;
|
|
67006
67009
|
}
|
|
67007
67010
|
function getMapperFromContext(context) {
|
|
67008
|
-
|
|
67009
|
-
return innerContext && innerContext.mapper && (innerContext.freeTypeVariables ? combineTypeMappers(innerContext.mapper, makeFreeTypeVariableMapperForContext(innerContext)) : innerContext.mapper);
|
|
67011
|
+
return context && context.mapper;
|
|
67010
67012
|
}
|
|
67011
67013
|
function couldContainTypeVariables(type) {
|
|
67012
67014
|
const objectFlags = getObjectFlags(type);
|
|
@@ -67106,15 +67108,8 @@ function createTypeChecker(host) {
|
|
|
67106
67108
|
const typeParameter = getIndexedAccessType(constraint.type, getTypeParameterFromMappedType(target));
|
|
67107
67109
|
const templateType = getTemplateTypeFromMappedType(target);
|
|
67108
67110
|
const inference = createInferenceInfo(typeParameter);
|
|
67109
|
-
|
|
67110
|
-
|
|
67111
|
-
/*signature*/
|
|
67112
|
-
void 0,
|
|
67113
|
-
0 /* None */,
|
|
67114
|
-
compareTypesAssignable
|
|
67115
|
-
);
|
|
67116
|
-
inferTypes(context, sourceType, templateType);
|
|
67117
|
-
return getInferredTypes(context, returnFalse)[0] || unknownType;
|
|
67111
|
+
inferTypes([inference], sourceType, templateType);
|
|
67112
|
+
return getTypeFromInference(inference) || unknownType;
|
|
67118
67113
|
}
|
|
67119
67114
|
function* getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
|
|
67120
67115
|
const properties = getPropertiesOfType(target);
|
|
@@ -67291,15 +67286,7 @@ function createTypeChecker(host) {
|
|
|
67291
67286
|
pos = p;
|
|
67292
67287
|
}
|
|
67293
67288
|
}
|
|
67294
|
-
function
|
|
67295
|
-
return context.alternatives ? (context.alternatives.forEach((a) => mergeInferenceContexts(
|
|
67296
|
-
a,
|
|
67297
|
-
context,
|
|
67298
|
-
/*clone*/
|
|
67299
|
-
true
|
|
67300
|
-
)), context.alternatives) : [context];
|
|
67301
|
-
}
|
|
67302
|
-
function inferTypes(context, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
|
|
67289
|
+
function inferTypes(inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
|
|
67303
67290
|
let bivariant = false;
|
|
67304
67291
|
let propagationType;
|
|
67305
67292
|
let inferencePriority = 2048 /* MaxValue */;
|
|
@@ -67308,21 +67295,7 @@ function createTypeChecker(host) {
|
|
|
67308
67295
|
let sourceStack;
|
|
67309
67296
|
let targetStack;
|
|
67310
67297
|
let expandingFlags = 0 /* None */;
|
|
67311
|
-
let useOnlyCachedAlternativeRoutes = false;
|
|
67312
67298
|
inferFromTypes(originalSource, originalTarget);
|
|
67313
|
-
useOnlyCachedAlternativeRoutes = true;
|
|
67314
|
-
const group2 = forkInferenceContext();
|
|
67315
|
-
spawnAlternativeInferenceContext(
|
|
67316
|
-
group2,
|
|
67317
|
-
() => {
|
|
67318
|
-
if (length(context.freeTypeVariables)) {
|
|
67319
|
-
inferFromTypes(originalSource, instantiateType(originalTarget, context.nonFixingMapper));
|
|
67320
|
-
}
|
|
67321
|
-
},
|
|
67322
|
-
/*fork*/
|
|
67323
|
-
false
|
|
67324
|
-
);
|
|
67325
|
-
joinInferenceContext(group2);
|
|
67326
67299
|
function inferFromTypes(source, target) {
|
|
67327
67300
|
if (!couldContainTypeVariables(target)) {
|
|
67328
67301
|
return;
|
|
@@ -67383,9 +67356,6 @@ function createTypeChecker(host) {
|
|
|
67383
67356
|
if (getObjectFlags(source) & 262144 /* NonInferrableType */ || source === nonInferrableAnyType) {
|
|
67384
67357
|
return;
|
|
67385
67358
|
}
|
|
67386
|
-
if (useOnlyCachedAlternativeRoutes && source === target) {
|
|
67387
|
-
return;
|
|
67388
|
-
}
|
|
67389
67359
|
if (!inference.isFixed) {
|
|
67390
67360
|
if (inference.priority === void 0 || priority < inference.priority) {
|
|
67391
67361
|
inference.candidates = void 0;
|
|
@@ -67398,16 +67368,16 @@ function createTypeChecker(host) {
|
|
|
67398
67368
|
if (contravariant && !bivariant) {
|
|
67399
67369
|
if (!contains(inference.contraCandidates, candidate)) {
|
|
67400
67370
|
inference.contraCandidates = append(inference.contraCandidates, candidate);
|
|
67401
|
-
clearCachedInferences(
|
|
67371
|
+
clearCachedInferences(inferences);
|
|
67402
67372
|
}
|
|
67403
67373
|
} else if (!contains(inference.candidates, candidate)) {
|
|
67404
67374
|
inference.candidates = append(inference.candidates, candidate);
|
|
67405
|
-
clearCachedInferences(
|
|
67375
|
+
clearCachedInferences(inferences);
|
|
67406
67376
|
}
|
|
67407
67377
|
}
|
|
67408
67378
|
if (!(priority & 128 /* ReturnType */) && target.flags & 262144 /* TypeParameter */ && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) {
|
|
67409
67379
|
inference.topLevel = false;
|
|
67410
|
-
clearCachedInferences(
|
|
67380
|
+
clearCachedInferences(inferences);
|
|
67411
67381
|
}
|
|
67412
67382
|
}
|
|
67413
67383
|
inferencePriority = Math.min(inferencePriority, priority);
|
|
@@ -67575,12 +67545,7 @@ function createTypeChecker(host) {
|
|
|
67575
67545
|
}
|
|
67576
67546
|
function getInferenceInfoForType(type) {
|
|
67577
67547
|
if (type.flags & 8650752 /* TypeVariable */) {
|
|
67578
|
-
for (const inference of
|
|
67579
|
-
if (type === inference.typeParameter) {
|
|
67580
|
-
return inference;
|
|
67581
|
-
}
|
|
67582
|
-
}
|
|
67583
|
-
for (const inference of context.freeTypeVariables || []) {
|
|
67548
|
+
for (const inference of inferences) {
|
|
67584
67549
|
if (type === inference.typeParameter) {
|
|
67585
67550
|
return inference;
|
|
67586
67551
|
}
|
|
@@ -67861,88 +67826,17 @@ function createTypeChecker(host) {
|
|
|
67861
67826
|
}
|
|
67862
67827
|
}
|
|
67863
67828
|
}
|
|
67864
|
-
function forkInferenceContext() {
|
|
67865
|
-
return [];
|
|
67866
|
-
}
|
|
67867
|
-
function spawnAlternativeInferenceContext(group3, action, fork = true) {
|
|
67868
|
-
const oldContext = context;
|
|
67869
|
-
flattenInferenceContextAlternatives(context).forEach((alternative) => {
|
|
67870
|
-
const newContext = fork ? cloneInferenceContext(alternative) : alternative;
|
|
67871
|
-
context = newContext;
|
|
67872
|
-
action();
|
|
67873
|
-
context = oldContext;
|
|
67874
|
-
group3.push(...flattenInferenceContextAlternatives(newContext));
|
|
67875
|
-
});
|
|
67876
|
-
}
|
|
67877
|
-
function joinInferenceContext(group3) {
|
|
67878
|
-
group3 = group3.length < 10 ? deduplicate(group3, compareInferenceContext) : group3;
|
|
67879
|
-
if (group3.length === 1) {
|
|
67880
|
-
mergeInferenceContexts(context, group3[0]);
|
|
67881
|
-
context.freeTypeVariables = group3[0].freeTypeVariables;
|
|
67882
|
-
context.freeTypeVariableSourceSignatures = group3[0].freeTypeVariableSourceSignatures;
|
|
67883
|
-
context.inferredTypeParameters = group3[0].inferredTypeParameters;
|
|
67884
|
-
context.flags = group3[0].flags;
|
|
67885
|
-
context.alternatives = void 0;
|
|
67886
|
-
return;
|
|
67887
|
-
}
|
|
67888
|
-
context.alternatives = group3;
|
|
67889
|
-
}
|
|
67890
|
-
function compareInferenceContext(a, b) {
|
|
67891
|
-
return a.compareTypes === b.compareTypes && a.flags === b.flags && a.inferredTypeParameters === b.inferredTypeParameters && a.intraExpressionInferenceSites === b.intraExpressionInferenceSites && a.signature === b.signature && compareInferencesIdentical(a, a.inferences, b, b.inferences) && compareInferencesIdentical(a, a.freeTypeVariables, b, b.freeTypeVariables);
|
|
67892
|
-
}
|
|
67893
|
-
function compareInferencesIdentical(ctxA, a, ctxB, b) {
|
|
67894
|
-
if (length(a) !== length(b))
|
|
67895
|
-
return false;
|
|
67896
|
-
if (length(a) === 0)
|
|
67897
|
-
return true;
|
|
67898
|
-
for (let i = 0; i < length(a); i++) {
|
|
67899
|
-
if (a[i].typeParameter !== b[i].typeParameter || a[i].impliedArity !== b[i].impliedArity || a[i].isFixed !== b[i].isFixed || a[i].priority !== b[i].priority || a[i].topLevel !== b[i].topLevel || forEach(a, (_, i2) => getInferredType(ctxA, a[i2]) !== getInferredType(ctxB, b[i2])))
|
|
67900
|
-
return false;
|
|
67901
|
-
}
|
|
67902
|
-
return true;
|
|
67903
|
-
}
|
|
67904
67829
|
function inferFromSignatures(source, target, kind) {
|
|
67905
|
-
var _a2, _b;
|
|
67906
67830
|
const sourceSignatures = getSignaturesOfType(source, kind);
|
|
67907
67831
|
const targetSignatures = getSignaturesOfType(target, kind);
|
|
67908
67832
|
const sourceLen = sourceSignatures.length;
|
|
67909
67833
|
const targetLen = targetSignatures.length;
|
|
67910
|
-
|
|
67911
|
-
|
|
67912
|
-
|
|
67913
|
-
if (useOnlyCachedAlternativeRoutes && !((_b = (_a2 = context.freeTypeVariableSourceSignatures) == null ? void 0 : _a2.get(last(sourceStack))) == null ? void 0 : _b.get(sourceSignatures[i]))) {
|
|
67914
|
-
continue;
|
|
67915
|
-
}
|
|
67916
|
-
spawnAlternativeInferenceContext(
|
|
67917
|
-
group3,
|
|
67918
|
-
() => inferFromSignature(sourceSignatures[i], targetSignatures[0])
|
|
67919
|
-
);
|
|
67920
|
-
}
|
|
67921
|
-
joinInferenceContext(group3);
|
|
67922
|
-
} else {
|
|
67923
|
-
const len = sourceLen < targetLen ? sourceLen : targetLen;
|
|
67924
|
-
for (let i = 0; i < len; i++) {
|
|
67925
|
-
inferFromSignature(sourceSignatures[sourceLen - len + i], targetSignatures[targetLen - len + i]);
|
|
67926
|
-
}
|
|
67834
|
+
const len = sourceLen < targetLen ? sourceLen : targetLen;
|
|
67835
|
+
for (let i = 0; i < len; i++) {
|
|
67836
|
+
inferFromSignature(getBaseSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i]));
|
|
67927
67837
|
}
|
|
67928
67838
|
}
|
|
67929
67839
|
function inferFromSignature(source, target) {
|
|
67930
|
-
target = getErasedSignature(target);
|
|
67931
|
-
if (source.typeParameters) {
|
|
67932
|
-
let cache = (context.freeTypeVariableSourceSignatures || (context.freeTypeVariableSourceSignatures = /* @__PURE__ */ new Map())).get(last(sourceStack));
|
|
67933
|
-
if (!cache) {
|
|
67934
|
-
context.freeTypeVariableSourceSignatures.set(last(sourceStack), cache = /* @__PURE__ */ new Map());
|
|
67935
|
-
}
|
|
67936
|
-
const cached = cache.get(source);
|
|
67937
|
-
if (cached) {
|
|
67938
|
-
source = cached;
|
|
67939
|
-
} else {
|
|
67940
|
-
const originalSignature = source;
|
|
67941
|
-
source = instantiateSignature(source, makeUnaryTypeMapper(unknownType, unknownType));
|
|
67942
|
-
cache.set(originalSignature, source);
|
|
67943
|
-
(context.freeTypeVariables || (context.freeTypeVariables = [])).push(...map(source.typeParameters, createInferenceInfo));
|
|
67944
|
-
}
|
|
67945
|
-
}
|
|
67946
67840
|
const saveBivariant = bivariant;
|
|
67947
67841
|
const kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
|
|
67948
67842
|
bivariant = bivariant || kind === 171 /* MethodDeclaration */ || kind === 170 /* MethodSignature */ || kind === 173 /* Constructor */;
|
|
@@ -68017,7 +67911,8 @@ function createTypeChecker(host) {
|
|
|
68017
67911
|
const unwidenedType = inference.priority & 416 /* PriorityImpliesCombination */ ? getUnionType(baseCandidates, 2 /* Subtype */) : getCommonSupertype(baseCandidates);
|
|
68018
67912
|
return getWidenedType(unwidenedType);
|
|
68019
67913
|
}
|
|
68020
|
-
function getInferredType(context,
|
|
67914
|
+
function getInferredType(context, index) {
|
|
67915
|
+
const inference = context.inferences[index];
|
|
68021
67916
|
if (!inference.inferredType) {
|
|
68022
67917
|
let inferredType;
|
|
68023
67918
|
const signature = context.signature;
|
|
@@ -68033,7 +67928,7 @@ function createTypeChecker(host) {
|
|
|
68033
67928
|
} else {
|
|
68034
67929
|
const defaultType = getDefaultFromTypeParameter(inference.typeParameter);
|
|
68035
67930
|
if (defaultType) {
|
|
68036
|
-
inferredType = instantiateType(defaultType, mergeTypeMappers(createBackreferenceMapper(context,
|
|
67931
|
+
inferredType = instantiateType(defaultType, mergeTypeMappers(createBackreferenceMapper(context, index), context.nonFixingMapper));
|
|
68037
67932
|
}
|
|
68038
67933
|
}
|
|
68039
67934
|
} else {
|
|
@@ -68053,24 +67948,12 @@ function createTypeChecker(host) {
|
|
|
68053
67948
|
function getDefaultTypeArgumentType(isInJavaScriptFile) {
|
|
68054
67949
|
return isInJavaScriptFile ? anyType : unknownType;
|
|
68055
67950
|
}
|
|
68056
|
-
function getInferredTypes(context
|
|
68057
|
-
const
|
|
68058
|
-
let
|
|
68059
|
-
|
|
68060
|
-
const context2 = alternatives[a];
|
|
68061
|
-
const freeTypeVariableMapper = makeFreeTypeVariableMapperForContext(context2);
|
|
68062
|
-
const result = [];
|
|
68063
|
-
for (const inference of context2.inferences) {
|
|
68064
|
-
result.push(instantiateType(getInferredType(context2, inference), freeTypeVariableMapper));
|
|
68065
|
-
}
|
|
68066
|
-
if (alternatives.length === 1 || accept(result)) {
|
|
68067
|
-
return result;
|
|
68068
|
-
}
|
|
68069
|
-
if (!finalAlternative) {
|
|
68070
|
-
finalAlternative = result;
|
|
68071
|
-
}
|
|
67951
|
+
function getInferredTypes(context) {
|
|
67952
|
+
const result = [];
|
|
67953
|
+
for (let i = 0; i < context.inferences.length; i++) {
|
|
67954
|
+
result.push(getInferredType(context, i));
|
|
68072
67955
|
}
|
|
68073
|
-
return
|
|
67956
|
+
return result;
|
|
68074
67957
|
}
|
|
68075
67958
|
function getCannotFindNameDiagnosticForName(node) {
|
|
68076
67959
|
switch (node.escapedText) {
|
|
@@ -71448,11 +71331,8 @@ function createTypeChecker(host) {
|
|
|
71448
71331
|
function instantiateContextualType(contextualType, node, contextFlags) {
|
|
71449
71332
|
if (contextualType && maybeTypeOfKind(contextualType, 465829888 /* Instantiable */)) {
|
|
71450
71333
|
const inferenceContext = getInferenceContext(node);
|
|
71451
|
-
if (inferenceContext && contextFlags & 1 /* Signature */ && some(
|
|
71452
|
-
return
|
|
71453
|
-
flattenInferenceContextAlternatives(inferenceContext),
|
|
71454
|
-
(c) => instantiateInstantiableTypes(contextualType, c.nonFixingMapper)
|
|
71455
|
-
));
|
|
71334
|
+
if (inferenceContext && contextFlags & 1 /* Signature */ && some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) {
|
|
71335
|
+
return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
|
|
71456
71336
|
}
|
|
71457
71337
|
if (inferenceContext == null ? void 0 : inferenceContext.returnMapper) {
|
|
71458
71338
|
const type = instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper);
|
|
@@ -73811,23 +73691,23 @@ function createTypeChecker(host) {
|
|
|
73811
73691
|
function instantiateSignatureInContextOf(signature, contextualSignature, inferenceContext, compareTypes) {
|
|
73812
73692
|
const context = createInferenceContext(signature.typeParameters, signature, 0 /* None */, compareTypes);
|
|
73813
73693
|
const restType = getEffectiveRestType(contextualSignature);
|
|
73814
|
-
const mapper = inferenceContext && (restType && restType.flags & 262144 /* TypeParameter */ ? inferenceContext.nonFixingMapper :
|
|
73694
|
+
const mapper = inferenceContext && (restType && restType.flags & 262144 /* TypeParameter */ ? inferenceContext.nonFixingMapper : inferenceContext.mapper);
|
|
73815
73695
|
const sourceSignature = mapper ? instantiateSignature(contextualSignature, mapper) : contextualSignature;
|
|
73816
73696
|
applyToParameterTypes(sourceSignature, signature, (source, target) => {
|
|
73817
|
-
inferTypes(context, source, target);
|
|
73697
|
+
inferTypes(context.inferences, source, target);
|
|
73818
73698
|
});
|
|
73819
73699
|
if (!inferenceContext) {
|
|
73820
73700
|
applyToReturnTypes(contextualSignature, signature, (source, target) => {
|
|
73821
|
-
inferTypes(context, source, target, 128 /* ReturnType */);
|
|
73701
|
+
inferTypes(context.inferences, source, target, 128 /* ReturnType */);
|
|
73822
73702
|
});
|
|
73823
73703
|
}
|
|
73824
|
-
return getSignatureInstantiation(signature, getInferredTypes(context
|
|
73704
|
+
return getSignatureInstantiation(signature, getInferredTypes(context), isInJSFile(contextualSignature.declaration));
|
|
73825
73705
|
}
|
|
73826
|
-
function inferJsxTypeArguments(node, signature, checkMode, context
|
|
73706
|
+
function inferJsxTypeArguments(node, signature, checkMode, context) {
|
|
73827
73707
|
const paramType = getEffectiveFirstArgumentForJsxSignature(signature, node);
|
|
73828
73708
|
const checkAttrType = checkExpressionWithContextualType(node.attributes, paramType, context, checkMode);
|
|
73829
|
-
inferTypes(context, checkAttrType, paramType);
|
|
73830
|
-
return getInferredTypes(context
|
|
73709
|
+
inferTypes(context.inferences, checkAttrType, paramType);
|
|
73710
|
+
return getInferredTypes(context);
|
|
73831
73711
|
}
|
|
73832
73712
|
function getThisArgumentType(thisArgumentNode) {
|
|
73833
73713
|
if (!thisArgumentNode) {
|
|
@@ -73836,9 +73716,9 @@ function createTypeChecker(host) {
|
|
|
73836
73716
|
const thisArgumentType = checkExpression(thisArgumentNode);
|
|
73837
73717
|
return isOptionalChainRoot(thisArgumentNode.parent) ? getNonNullableType(thisArgumentType) : isOptionalChain(thisArgumentNode.parent) ? removeOptionalTypeMarker(thisArgumentType) : thisArgumentType;
|
|
73838
73718
|
}
|
|
73839
|
-
function inferTypeArguments(node, signature, args, checkMode, context
|
|
73719
|
+
function inferTypeArguments(node, signature, args, checkMode, context) {
|
|
73840
73720
|
if (isJsxOpeningLikeElement(node)) {
|
|
73841
|
-
return inferJsxTypeArguments(node, signature, checkMode, context
|
|
73721
|
+
return inferJsxTypeArguments(node, signature, checkMode, context);
|
|
73842
73722
|
}
|
|
73843
73723
|
if (node.kind !== 167 /* Decorator */) {
|
|
73844
73724
|
const skipBindingPatterns = every(signature.typeParameters, (p) => !!getDefaultFromTypeParameter(p));
|
|
@@ -73853,11 +73733,11 @@ function createTypeChecker(host) {
|
|
|
73853
73733
|
const instantiatedType = instantiateType(contextualType, outerMapper);
|
|
73854
73734
|
const contextualSignature = getSingleCallSignature(instantiatedType);
|
|
73855
73735
|
const inferenceSourceType = contextualSignature && contextualSignature.typeParameters ? getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) : instantiatedType;
|
|
73856
|
-
inferTypes(context, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
|
|
73736
|
+
inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
|
|
73857
73737
|
}
|
|
73858
73738
|
const returnContext = createInferenceContext(signature.typeParameters, signature, context.flags);
|
|
73859
73739
|
const returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper);
|
|
73860
|
-
inferTypes(returnContext, returnSourceType, inferenceTargetType);
|
|
73740
|
+
inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType);
|
|
73861
73741
|
context.returnMapper = some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : void 0;
|
|
73862
73742
|
}
|
|
73863
73743
|
}
|
|
@@ -73873,7 +73753,7 @@ function createTypeChecker(host) {
|
|
|
73873
73753
|
const thisType = getThisTypeOfSignature(signature);
|
|
73874
73754
|
if (thisType && couldContainTypeVariables(thisType)) {
|
|
73875
73755
|
const thisArgumentNode = getThisArgumentOfCall(node);
|
|
73876
|
-
inferTypes(context, getThisArgumentType(thisArgumentNode), thisType);
|
|
73756
|
+
inferTypes(context.inferences, getThisArgumentType(thisArgumentNode), thisType);
|
|
73877
73757
|
}
|
|
73878
73758
|
for (let i = 0; i < argCount; i++) {
|
|
73879
73759
|
const arg = args[i];
|
|
@@ -73881,15 +73761,15 @@ function createTypeChecker(host) {
|
|
|
73881
73761
|
const paramType = getTypeAtPosition(signature, i);
|
|
73882
73762
|
if (couldContainTypeVariables(paramType)) {
|
|
73883
73763
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
73884
|
-
inferTypes(context, argType, paramType);
|
|
73764
|
+
inferTypes(context.inferences, argType, paramType);
|
|
73885
73765
|
}
|
|
73886
73766
|
}
|
|
73887
73767
|
}
|
|
73888
73768
|
if (restType && couldContainTypeVariables(restType)) {
|
|
73889
73769
|
const spreadType = getSpreadArgumentType(args, argCount, args.length, restType, context, checkMode);
|
|
73890
|
-
inferTypes(context, spreadType, restType);
|
|
73770
|
+
inferTypes(context.inferences, spreadType, restType);
|
|
73891
73771
|
}
|
|
73892
|
-
return getInferredTypes(context
|
|
73772
|
+
return getInferredTypes(context);
|
|
73893
73773
|
}
|
|
73894
73774
|
function getMutableArrayOrTupleType(type) {
|
|
73895
73775
|
return type.flags & 1048576 /* Union */ ? mapType(type, getMutableArrayOrTupleType) : type.flags & 1 /* Any */ || isMutableArrayOrTuple(getBaseConstraintOfType(type) || type) ? type : isTupleType(type) ? createTupleType(
|
|
@@ -74656,26 +74536,6 @@ function createTypeChecker(host) {
|
|
|
74656
74536
|
}
|
|
74657
74537
|
let checkCandidate;
|
|
74658
74538
|
let inferenceContext;
|
|
74659
|
-
const acceptor = (types) => {
|
|
74660
|
-
const checkCandidate2 = getSignatureInstantiation(candidate, types, isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
|
|
74661
|
-
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate2, signatureHelpTrailingComma2)) {
|
|
74662
|
-
return false;
|
|
74663
|
-
}
|
|
74664
|
-
if (getSignatureApplicabilityError(
|
|
74665
|
-
node,
|
|
74666
|
-
args,
|
|
74667
|
-
checkCandidate2,
|
|
74668
|
-
relation,
|
|
74669
|
-
argCheckMode,
|
|
74670
|
-
/*reportErrors*/
|
|
74671
|
-
false,
|
|
74672
|
-
/*containingMessageChain*/
|
|
74673
|
-
void 0
|
|
74674
|
-
)) {
|
|
74675
|
-
return false;
|
|
74676
|
-
}
|
|
74677
|
-
return true;
|
|
74678
|
-
};
|
|
74679
74539
|
if (candidate.typeParameters) {
|
|
74680
74540
|
let typeArgumentTypes;
|
|
74681
74541
|
if (some(typeArguments)) {
|
|
@@ -74696,7 +74556,7 @@ function createTypeChecker(host) {
|
|
|
74696
74556
|
/*flags*/
|
|
74697
74557
|
isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */
|
|
74698
74558
|
);
|
|
74699
|
-
typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext
|
|
74559
|
+
typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext);
|
|
74700
74560
|
argCheckMode |= inferenceContext.flags & 4 /* SkippedGenericFunction */ ? 8 /* SkipGenericFunctions */ : 0 /* Normal */;
|
|
74701
74561
|
}
|
|
74702
74562
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
|
|
@@ -74724,7 +74584,7 @@ function createTypeChecker(host) {
|
|
|
74724
74584
|
if (argCheckMode) {
|
|
74725
74585
|
argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
74726
74586
|
if (inferenceContext) {
|
|
74727
|
-
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext
|
|
74587
|
+
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
74728
74588
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
74729
74589
|
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) {
|
|
74730
74590
|
candidateForArgumentArityError = checkCandidate;
|
|
@@ -74834,7 +74694,7 @@ function createTypeChecker(host) {
|
|
|
74834
74694
|
/*flags*/
|
|
74835
74695
|
isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */
|
|
74836
74696
|
);
|
|
74837
|
-
const typeArgumentTypes = inferTypeArguments(node, candidate, args, checkMode | 4 /* SkipContextSensitive */ | 8 /* SkipGenericFunctions */, inferenceContext
|
|
74697
|
+
const typeArgumentTypes = inferTypeArguments(node, candidate, args, checkMode | 4 /* SkipContextSensitive */ | 8 /* SkipGenericFunctions */, inferenceContext);
|
|
74838
74698
|
return createSignatureInstantiation(candidate, typeArgumentTypes);
|
|
74839
74699
|
}
|
|
74840
74700
|
function getLongestCandidateIndex(candidates, argsCount) {
|
|
@@ -76102,7 +75962,7 @@ function createTypeChecker(host) {
|
|
|
76102
75962
|
if (declaration.type) {
|
|
76103
75963
|
const typeNode = getEffectiveTypeAnnotationNode(declaration);
|
|
76104
75964
|
if (typeNode) {
|
|
76105
|
-
inferTypes(inferenceContext, getTypeFromTypeNode(typeNode), getTypeAtPosition(context, i));
|
|
75965
|
+
inferTypes(inferenceContext.inferences, getTypeFromTypeNode(typeNode), getTypeAtPosition(context, i));
|
|
76106
75966
|
}
|
|
76107
75967
|
}
|
|
76108
75968
|
}
|
|
@@ -76814,7 +76674,7 @@ function createTypeChecker(host) {
|
|
|
76814
76674
|
instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper);
|
|
76815
76675
|
}
|
|
76816
76676
|
}
|
|
76817
|
-
instantiatedContextualSignature || (instantiatedContextualSignature = inferenceContext ? instantiateSignature(contextualSignature,
|
|
76677
|
+
instantiatedContextualSignature || (instantiatedContextualSignature = inferenceContext ? instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature);
|
|
76818
76678
|
assignContextualParameterTypes(signature, instantiatedContextualSignature);
|
|
76819
76679
|
} else {
|
|
76820
76680
|
assignNonContextualParameterTypes(signature);
|
|
@@ -78195,7 +78055,7 @@ function createTypeChecker(host) {
|
|
|
78195
78055
|
return isAssertionExpression(parent2) && isConstTypeReference(parent2.type) || isJSDocTypeAssertion(parent2) && isConstTypeReference(getJSDocTypeAssertionType(parent2)) || isValidConstAssertionArgument(node) && isConstTypeParameterContext(node) || (isParenthesizedExpression(parent2) || isArrayLiteralExpression(parent2) || isSpreadElement(parent2)) && isConstContext(parent2) || (isPropertyAssignment(parent2) || isShorthandPropertyAssignment(parent2) || isTemplateSpan(parent2)) && isConstContext(parent2.parent);
|
|
78196
78056
|
}
|
|
78197
78057
|
function isConstTypeParameterContext(node) {
|
|
78198
|
-
const contextualType = getContextualType2(node,
|
|
78058
|
+
const contextualType = getContextualType2(node, 0 /* None */);
|
|
78199
78059
|
return !!contextualType && someType(contextualType, isConstTypeVariable);
|
|
78200
78060
|
}
|
|
78201
78061
|
function checkExpressionForMutableLocation(node, checkMode, forceTuple) {
|
|
@@ -78260,11 +78120,10 @@ function createTypeChecker(host) {
|
|
|
78260
78120
|
if (returnSignature && !returnSignature.typeParameters && !every(context.inferences, hasInferenceCandidates)) {
|
|
78261
78121
|
const uniqueTypeParameters = getUniqueTypeParameters(context, signature.typeParameters);
|
|
78262
78122
|
const instantiatedSignature = getSignatureInstantiationWithoutFillingInTypeArguments(signature, uniqueTypeParameters);
|
|
78263
|
-
const
|
|
78264
|
-
subcontext.inferences = map(context.inferences, (info) => createInferenceInfo(info.typeParameter));
|
|
78123
|
+
const inferences = map(context.inferences, (info) => createInferenceInfo(info.typeParameter));
|
|
78265
78124
|
applyToParameterTypes(instantiatedSignature, contextualSignature, (source, target) => {
|
|
78266
78125
|
inferTypes(
|
|
78267
|
-
|
|
78126
|
+
inferences,
|
|
78268
78127
|
source,
|
|
78269
78128
|
target,
|
|
78270
78129
|
/*priority*/
|
|
@@ -78273,12 +78132,12 @@ function createTypeChecker(host) {
|
|
|
78273
78132
|
true
|
|
78274
78133
|
);
|
|
78275
78134
|
});
|
|
78276
|
-
if (some(
|
|
78135
|
+
if (some(inferences, hasInferenceCandidates)) {
|
|
78277
78136
|
applyToReturnTypes(instantiatedSignature, contextualSignature, (source, target) => {
|
|
78278
|
-
inferTypes(
|
|
78137
|
+
inferTypes(inferences, source, target);
|
|
78279
78138
|
});
|
|
78280
|
-
if (!hasOverlappingInferences(context.inferences,
|
|
78281
|
-
|
|
78139
|
+
if (!hasOverlappingInferences(context.inferences, inferences)) {
|
|
78140
|
+
mergeInferences(context.inferences, inferences);
|
|
78282
78141
|
context.inferredTypeParameters = concatenate(context.inferredTypeParameters, uniqueTypeParameters);
|
|
78283
78142
|
return getOrCreateTypeFromSignature(instantiatedSignature);
|
|
78284
78143
|
}
|
|
@@ -78311,22 +78170,13 @@ function createTypeChecker(host) {
|
|
|
78311
78170
|
}
|
|
78312
78171
|
return false;
|
|
78313
78172
|
}
|
|
78314
|
-
function mergeInferences(target, source
|
|
78173
|
+
function mergeInferences(target, source) {
|
|
78315
78174
|
for (let i = 0; i < target.length; i++) {
|
|
78316
78175
|
if (!hasInferenceCandidates(target[i]) && hasInferenceCandidates(source[i])) {
|
|
78317
|
-
target[i] =
|
|
78318
|
-
...source[i],
|
|
78319
|
-
candidates: source[i].candidates && [...source[i].candidates],
|
|
78320
|
-
contraCandidates: source[i].contraCandidates && [...source[i].contraCandidates]
|
|
78321
|
-
} : source[i];
|
|
78176
|
+
target[i] = source[i];
|
|
78322
78177
|
}
|
|
78323
78178
|
}
|
|
78324
78179
|
}
|
|
78325
|
-
function mergeInferenceContexts(target, source, cloneInferences = false) {
|
|
78326
|
-
mergeInferences(target.inferences, source.inferences, cloneInferences);
|
|
78327
|
-
target.mapper = makeFixingMapperForContext(target);
|
|
78328
|
-
target.nonFixingMapper = makeNonFixingMapperForContext(target);
|
|
78329
|
-
}
|
|
78330
78180
|
function getUniqueTypeParameters(context, typeParameters) {
|
|
78331
78181
|
const result = [];
|
|
78332
78182
|
let oldTypeParameters;
|