@typescript-deploys/pr-build 5.0.0-pr-52899-2 → 5.0.0-pr-52944-9
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 +243 -85
- package/lib/tsserver.js +244 -115
- package/lib/tsserverlibrary.js +244 -115
- package/lib/typescript.js +244 -115
- package/lib/typingsInstaller.js +1 -2
- package/package.json +1 -1
package/lib/typescript.js
CHANGED
|
@@ -9111,8 +9111,7 @@ ${lanes.join("\n")}
|
|
|
9111
9111
|
_0_is_possibly_undefined: diag(18048, 1 /* Error */, "_0_is_possibly_undefined_18048", "'{0}' is possibly 'undefined'."),
|
|
9112
9112
|
_0_is_possibly_null_or_undefined: diag(18049, 1 /* Error */, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."),
|
|
9113
9113
|
The_value_0_cannot_be_used_here: diag(18050, 1 /* Error */, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."),
|
|
9114
|
-
Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string.")
|
|
9115
|
-
Add_missing_comma_for_an_object_member_completion_0: diag(18052, 3 /* Message */, "Add_missing_comma_for_an_object_member_completion_0_18052", "Add missing comma for an object member completion '{0}'.")
|
|
9114
|
+
Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string.")
|
|
9116
9115
|
};
|
|
9117
9116
|
}
|
|
9118
9117
|
});
|
|
@@ -56837,27 +56836,15 @@ ${lanes.join("\n")}
|
|
|
56837
56836
|
isInJSFile(signature.declaration)
|
|
56838
56837
|
);
|
|
56839
56838
|
}
|
|
56840
|
-
function
|
|
56841
|
-
const
|
|
56842
|
-
|
|
56843
|
-
|
|
56844
|
-
|
|
56845
|
-
|
|
56846
|
-
const typeEraser = createTypeEraser(typeParameters);
|
|
56847
|
-
const baseConstraintMapper = createTypeMapper(typeParameters, map(typeParameters, (tp) => getConstraintOfTypeParameter(tp) || unknownType));
|
|
56848
|
-
let baseConstraints = map(typeParameters, (tp) => instantiateType(tp, baseConstraintMapper) || unknownType);
|
|
56849
|
-
for (let i = 0; i < typeParameters.length - 1; i++) {
|
|
56850
|
-
baseConstraints = instantiateTypes(baseConstraints, baseConstraintMapper);
|
|
56851
|
-
}
|
|
56852
|
-
baseConstraints = instantiateTypes(baseConstraints, typeEraser);
|
|
56853
|
-
return signature.baseSignatureCache = instantiateSignature(
|
|
56854
|
-
signature,
|
|
56855
|
-
createTypeMapper(typeParameters, baseConstraints),
|
|
56856
|
-
/*eraseTypeParameters*/
|
|
56857
|
-
true
|
|
56858
|
-
);
|
|
56839
|
+
function getTypeParameterConstraintMapper(typeParameters) {
|
|
56840
|
+
const typeEraser = createTypeEraser(typeParameters);
|
|
56841
|
+
const baseConstraintMapper = createTypeMapper(typeParameters, map(typeParameters, (tp) => getConstraintOfTypeParameter(tp) || unknownType));
|
|
56842
|
+
let baseConstraints = map(typeParameters, (tp) => instantiateType(tp, baseConstraintMapper) || unknownType);
|
|
56843
|
+
for (let i = 0; i < typeParameters.length - 1; i++) {
|
|
56844
|
+
baseConstraints = instantiateTypes(baseConstraints, baseConstraintMapper);
|
|
56859
56845
|
}
|
|
56860
|
-
|
|
56846
|
+
baseConstraints = instantiateTypes(baseConstraints, typeEraser);
|
|
56847
|
+
return createTypeMapper(typeParameters, baseConstraints);
|
|
56861
56848
|
}
|
|
56862
56849
|
function getOrCreateTypeFromSignature(signature) {
|
|
56863
56850
|
var _a2;
|
|
@@ -59382,9 +59369,9 @@ ${lanes.join("\n")}
|
|
|
59382
59369
|
}
|
|
59383
59370
|
}
|
|
59384
59371
|
if (!checkTypeDeferred) {
|
|
59385
|
-
inferTypes(context
|
|
59372
|
+
inferTypes(context, checkType, instantiateType(extendsType, freshMapper), 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
|
|
59386
59373
|
}
|
|
59387
|
-
const innerMapper = combineTypeMappers(freshMapper, context
|
|
59374
|
+
const innerMapper = combineTypeMappers(freshMapper, getMapperFromContext(context));
|
|
59388
59375
|
combinedMapper = mapper ? combineTypeMappers(innerMapper, mapper) : innerMapper;
|
|
59389
59376
|
}
|
|
59390
59377
|
const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
|
|
@@ -60071,8 +60058,11 @@ ${lanes.join("\n")}
|
|
|
60071
60058
|
void 0
|
|
60072
60059
|
);
|
|
60073
60060
|
}
|
|
60074
|
-
function createBackreferenceMapper(context,
|
|
60075
|
-
const
|
|
60061
|
+
function createBackreferenceMapper(context, inference) {
|
|
60062
|
+
const inferences = context.inferences.indexOf(inference) >= 0 ? context.inferences : context.freeTypeVariables;
|
|
60063
|
+
Debug.assert(inferences, "Inference for backreference mapper must exist within provided context");
|
|
60064
|
+
const index = inferences.indexOf(inference);
|
|
60065
|
+
const forwardInferences = inferences.slice(index);
|
|
60076
60066
|
return createTypeMapper(map(forwardInferences, (i) => i.typeParameter), map(forwardInferences, () => unknownType));
|
|
60077
60067
|
}
|
|
60078
60068
|
function combineTypeMappers(mapper1, mapper2) {
|
|
@@ -62886,9 +62876,10 @@ ${lanes.join("\n")}
|
|
|
62886
62876
|
0 /* None */,
|
|
62887
62877
|
isRelatedToWorker
|
|
62888
62878
|
);
|
|
62889
|
-
inferTypes(ctx
|
|
62890
|
-
|
|
62891
|
-
|
|
62879
|
+
inferTypes(ctx, target2.extendsType, sourceExtends, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
|
|
62880
|
+
const newMapper = getMapperFromContext(ctx);
|
|
62881
|
+
sourceExtends = instantiateType(sourceExtends, newMapper);
|
|
62882
|
+
mapper = newMapper;
|
|
62892
62883
|
}
|
|
62893
62884
|
if (isTypeIdenticalTo(sourceExtends, target2.extendsType) && (isRelatedTo(source2.checkType, target2.checkType, 3 /* Both */) || isRelatedTo(target2.checkType, source2.checkType, 3 /* Both */))) {
|
|
62894
62885
|
if (result2 = isRelatedTo(instantiateType(getTrueTypeFromConditionalType(source2), mapper), getTrueTypeFromConditionalType(target2), 3 /* Both */, reportErrors2)) {
|
|
@@ -64726,7 +64717,12 @@ ${lanes.join("\n")}
|
|
|
64726
64717
|
return createInferenceContextWorker(typeParameters.map(createInferenceInfo), signature, flags, compareTypes || compareTypesAssignable);
|
|
64727
64718
|
}
|
|
64728
64719
|
function cloneInferenceContext(context, extraFlags = 0) {
|
|
64729
|
-
|
|
64720
|
+
const newContext = context && createInferenceContextWorker(map(context.inferences, cloneInferenceInfo), context.signature, context.flags | extraFlags, context.compareTypes);
|
|
64721
|
+
if (context && context.freeTypeVariables) {
|
|
64722
|
+
newContext.freeTypeVariables = map(context.freeTypeVariables, cloneInferenceInfo);
|
|
64723
|
+
newContext.freeTypeVariableSourceSignatures = new Map(mapIterator(context.freeTypeVariableSourceSignatures.entries(), ([k, v]) => [k, new Map(v.entries())]));
|
|
64724
|
+
}
|
|
64725
|
+
return newContext;
|
|
64730
64726
|
}
|
|
64731
64727
|
function createInferenceContextWorker(inferences, signature, flags, compareTypes) {
|
|
64732
64728
|
const context = {
|
|
@@ -64743,20 +64739,29 @@ ${lanes.join("\n")}
|
|
|
64743
64739
|
return context;
|
|
64744
64740
|
}
|
|
64745
64741
|
function makeFixingMapperForContext(context) {
|
|
64746
|
-
return makeDeferredTypeMapper(map(context.inferences, (i) => i.typeParameter), map(context.inferences, (inference
|
|
64742
|
+
return makeDeferredTypeMapper(map(context.inferences, (i) => i.typeParameter), map(context.inferences, (inference) => () => {
|
|
64747
64743
|
if (!inference.isFixed) {
|
|
64748
64744
|
inferFromIntraExpressionSites(context);
|
|
64749
64745
|
clearCachedInferences(context.inferences);
|
|
64750
64746
|
inference.isFixed = true;
|
|
64751
64747
|
}
|
|
64752
|
-
return getInferredType(context,
|
|
64748
|
+
return getInferredType(context, inference);
|
|
64753
64749
|
}));
|
|
64754
64750
|
}
|
|
64755
64751
|
function makeNonFixingMapperForContext(context) {
|
|
64756
|
-
return makeDeferredTypeMapper(map(context.inferences, (i) => i.typeParameter), map(context.inferences, (
|
|
64757
|
-
return getInferredType(context,
|
|
64752
|
+
return makeDeferredTypeMapper(map(context.inferences, (i) => i.typeParameter), map(context.inferences, (inference) => () => {
|
|
64753
|
+
return getInferredType(context, inference);
|
|
64758
64754
|
}));
|
|
64759
64755
|
}
|
|
64756
|
+
function makeFreeTypeVariableMapperForContext(context) {
|
|
64757
|
+
if (!context.freeTypeVariables)
|
|
64758
|
+
return void 0;
|
|
64759
|
+
const baseMapper = getTypeParameterConstraintMapper(map(context.freeTypeVariables, (i) => i.typeParameter));
|
|
64760
|
+
return context.freeTypeVariables.reduceRight(
|
|
64761
|
+
(previous, i) => combineTypeMappers(makeDeferredTypeMapper([i.typeParameter], [() => hasInferenceCandidatesOrDefault(i) ? getInferredType(context, i) : instantiateType(i.typeParameter, baseMapper)]), previous),
|
|
64762
|
+
baseMapper
|
|
64763
|
+
);
|
|
64764
|
+
}
|
|
64760
64765
|
function clearCachedInferences(inferences) {
|
|
64761
64766
|
for (const inference of inferences) {
|
|
64762
64767
|
if (!inference.isFixed) {
|
|
@@ -64773,7 +64778,7 @@ ${lanes.join("\n")}
|
|
|
64773
64778
|
for (const { node, type } of context.intraExpressionInferenceSites) {
|
|
64774
64779
|
const contextualType = node.kind === 171 /* MethodDeclaration */ ? getContextualTypeForObjectLiteralMethod(node, 2 /* NoConstraints */) : getContextualType2(node, 2 /* NoConstraints */);
|
|
64775
64780
|
if (contextualType) {
|
|
64776
|
-
inferTypes(context
|
|
64781
|
+
inferTypes(context, type, contextualType);
|
|
64777
64782
|
}
|
|
64778
64783
|
}
|
|
64779
64784
|
context.intraExpressionInferenceSites = void 0;
|
|
@@ -64808,7 +64813,8 @@ ${lanes.join("\n")}
|
|
|
64808
64813
|
return inferences.length ? createInferenceContextWorker(map(inferences, cloneInferenceInfo), context.signature, context.flags, context.compareTypes) : void 0;
|
|
64809
64814
|
}
|
|
64810
64815
|
function getMapperFromContext(context) {
|
|
64811
|
-
|
|
64816
|
+
const innerContext = context && last(flattenInferenceContextAlternatives(context));
|
|
64817
|
+
return innerContext && innerContext.mapper && (innerContext.freeTypeVariables ? combineTypeMappers(innerContext.mapper, makeFreeTypeVariableMapperForContext(innerContext)) : innerContext.mapper);
|
|
64812
64818
|
}
|
|
64813
64819
|
function couldContainTypeVariables(type) {
|
|
64814
64820
|
const objectFlags = getObjectFlags(type);
|
|
@@ -64908,8 +64914,15 @@ ${lanes.join("\n")}
|
|
|
64908
64914
|
const typeParameter = getIndexedAccessType(constraint.type, getTypeParameterFromMappedType(target));
|
|
64909
64915
|
const templateType = getTemplateTypeFromMappedType(target);
|
|
64910
64916
|
const inference = createInferenceInfo(typeParameter);
|
|
64911
|
-
|
|
64912
|
-
|
|
64917
|
+
const context = createInferenceContextWorker(
|
|
64918
|
+
[inference],
|
|
64919
|
+
/*signature*/
|
|
64920
|
+
void 0,
|
|
64921
|
+
0 /* None */,
|
|
64922
|
+
compareTypesAssignable
|
|
64923
|
+
);
|
|
64924
|
+
inferTypes(context, sourceType, templateType);
|
|
64925
|
+
return getInferredTypes(context, returnFalse)[0] || unknownType;
|
|
64913
64926
|
}
|
|
64914
64927
|
function* getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
|
|
64915
64928
|
const properties = getPropertiesOfType(target);
|
|
@@ -65086,7 +65099,15 @@ ${lanes.join("\n")}
|
|
|
65086
65099
|
pos = p;
|
|
65087
65100
|
}
|
|
65088
65101
|
}
|
|
65089
|
-
function
|
|
65102
|
+
function flattenInferenceContextAlternatives(context) {
|
|
65103
|
+
return context.alternatives ? (context.alternatives.forEach((a) => mergeInferenceContexts(
|
|
65104
|
+
a,
|
|
65105
|
+
context,
|
|
65106
|
+
/*clone*/
|
|
65107
|
+
true
|
|
65108
|
+
)), context.alternatives) : [context];
|
|
65109
|
+
}
|
|
65110
|
+
function inferTypes(context, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
|
|
65090
65111
|
let bivariant = false;
|
|
65091
65112
|
let propagationType;
|
|
65092
65113
|
let inferencePriority = 2048 /* MaxValue */;
|
|
@@ -65095,7 +65116,21 @@ ${lanes.join("\n")}
|
|
|
65095
65116
|
let sourceStack;
|
|
65096
65117
|
let targetStack;
|
|
65097
65118
|
let expandingFlags = 0 /* None */;
|
|
65119
|
+
let useOnlyCachedAlternativeRoutes = false;
|
|
65098
65120
|
inferFromTypes(originalSource, originalTarget);
|
|
65121
|
+
useOnlyCachedAlternativeRoutes = true;
|
|
65122
|
+
const group2 = forkInferenceContext();
|
|
65123
|
+
spawnAlternativeInferenceContext(
|
|
65124
|
+
group2,
|
|
65125
|
+
() => {
|
|
65126
|
+
if (length(context.freeTypeVariables)) {
|
|
65127
|
+
inferFromTypes(originalSource, instantiateType(originalTarget, context.nonFixingMapper));
|
|
65128
|
+
}
|
|
65129
|
+
},
|
|
65130
|
+
/*fork*/
|
|
65131
|
+
false
|
|
65132
|
+
);
|
|
65133
|
+
joinInferenceContext(group2);
|
|
65099
65134
|
function inferFromTypes(source, target) {
|
|
65100
65135
|
if (!couldContainTypeVariables(target)) {
|
|
65101
65136
|
return;
|
|
@@ -65156,6 +65191,9 @@ ${lanes.join("\n")}
|
|
|
65156
65191
|
if (getObjectFlags(source) & 262144 /* NonInferrableType */ || source === nonInferrableAnyType) {
|
|
65157
65192
|
return;
|
|
65158
65193
|
}
|
|
65194
|
+
if (useOnlyCachedAlternativeRoutes && source === target) {
|
|
65195
|
+
return;
|
|
65196
|
+
}
|
|
65159
65197
|
if (!inference.isFixed) {
|
|
65160
65198
|
if (inference.priority === void 0 || priority < inference.priority) {
|
|
65161
65199
|
inference.candidates = void 0;
|
|
@@ -65168,16 +65206,16 @@ ${lanes.join("\n")}
|
|
|
65168
65206
|
if (contravariant && !bivariant) {
|
|
65169
65207
|
if (!contains(inference.contraCandidates, candidate)) {
|
|
65170
65208
|
inference.contraCandidates = append(inference.contraCandidates, candidate);
|
|
65171
|
-
clearCachedInferences(inferences);
|
|
65209
|
+
clearCachedInferences(context.inferences);
|
|
65172
65210
|
}
|
|
65173
65211
|
} else if (!contains(inference.candidates, candidate)) {
|
|
65174
65212
|
inference.candidates = append(inference.candidates, candidate);
|
|
65175
|
-
clearCachedInferences(inferences);
|
|
65213
|
+
clearCachedInferences(context.inferences);
|
|
65176
65214
|
}
|
|
65177
65215
|
}
|
|
65178
65216
|
if (!(priority & 128 /* ReturnType */) && target.flags & 262144 /* TypeParameter */ && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) {
|
|
65179
65217
|
inference.topLevel = false;
|
|
65180
|
-
clearCachedInferences(inferences);
|
|
65218
|
+
clearCachedInferences(context.inferences);
|
|
65181
65219
|
}
|
|
65182
65220
|
}
|
|
65183
65221
|
inferencePriority = Math.min(inferencePriority, priority);
|
|
@@ -65345,7 +65383,12 @@ ${lanes.join("\n")}
|
|
|
65345
65383
|
}
|
|
65346
65384
|
function getInferenceInfoForType(type) {
|
|
65347
65385
|
if (type.flags & 8650752 /* TypeVariable */) {
|
|
65348
|
-
for (const inference of inferences) {
|
|
65386
|
+
for (const inference of context.inferences) {
|
|
65387
|
+
if (type === inference.typeParameter) {
|
|
65388
|
+
return inference;
|
|
65389
|
+
}
|
|
65390
|
+
}
|
|
65391
|
+
for (const inference of context.freeTypeVariables || []) {
|
|
65349
65392
|
if (type === inference.typeParameter) {
|
|
65350
65393
|
return inference;
|
|
65351
65394
|
}
|
|
@@ -65626,17 +65669,88 @@ ${lanes.join("\n")}
|
|
|
65626
65669
|
}
|
|
65627
65670
|
}
|
|
65628
65671
|
}
|
|
65672
|
+
function forkInferenceContext() {
|
|
65673
|
+
return [];
|
|
65674
|
+
}
|
|
65675
|
+
function spawnAlternativeInferenceContext(group3, action, fork = true) {
|
|
65676
|
+
const oldContext = context;
|
|
65677
|
+
flattenInferenceContextAlternatives(context).forEach((alternative) => {
|
|
65678
|
+
const newContext = fork ? cloneInferenceContext(alternative) : alternative;
|
|
65679
|
+
context = newContext;
|
|
65680
|
+
action();
|
|
65681
|
+
context = oldContext;
|
|
65682
|
+
group3.push(...flattenInferenceContextAlternatives(newContext));
|
|
65683
|
+
});
|
|
65684
|
+
}
|
|
65685
|
+
function joinInferenceContext(group3) {
|
|
65686
|
+
group3 = group3.length < 10 ? deduplicate(group3, compareInferenceContext) : group3;
|
|
65687
|
+
if (group3.length === 1) {
|
|
65688
|
+
mergeInferenceContexts(context, group3[0]);
|
|
65689
|
+
context.freeTypeVariables = group3[0].freeTypeVariables;
|
|
65690
|
+
context.freeTypeVariableSourceSignatures = group3[0].freeTypeVariableSourceSignatures;
|
|
65691
|
+
context.inferredTypeParameters = group3[0].inferredTypeParameters;
|
|
65692
|
+
context.flags = group3[0].flags;
|
|
65693
|
+
context.alternatives = void 0;
|
|
65694
|
+
return;
|
|
65695
|
+
}
|
|
65696
|
+
context.alternatives = group3;
|
|
65697
|
+
}
|
|
65698
|
+
function compareInferenceContext(a, b) {
|
|
65699
|
+
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);
|
|
65700
|
+
}
|
|
65701
|
+
function compareInferencesIdentical(ctxA, a, ctxB, b) {
|
|
65702
|
+
if (length(a) !== length(b))
|
|
65703
|
+
return false;
|
|
65704
|
+
if (length(a) === 0)
|
|
65705
|
+
return true;
|
|
65706
|
+
for (let i = 0; i < length(a); i++) {
|
|
65707
|
+
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])))
|
|
65708
|
+
return false;
|
|
65709
|
+
}
|
|
65710
|
+
return true;
|
|
65711
|
+
}
|
|
65629
65712
|
function inferFromSignatures(source, target, kind) {
|
|
65713
|
+
var _a2, _b;
|
|
65630
65714
|
const sourceSignatures = getSignaturesOfType(source, kind);
|
|
65631
65715
|
const targetSignatures = getSignaturesOfType(target, kind);
|
|
65632
65716
|
const sourceLen = sourceSignatures.length;
|
|
65633
65717
|
const targetLen = targetSignatures.length;
|
|
65634
|
-
|
|
65635
|
-
|
|
65636
|
-
|
|
65718
|
+
if (targetLen === 1 && sourceLen > 1) {
|
|
65719
|
+
const group3 = forkInferenceContext();
|
|
65720
|
+
for (let i = 0; i < sourceLen; i++) {
|
|
65721
|
+
if (useOnlyCachedAlternativeRoutes && !((_b = (_a2 = context.freeTypeVariableSourceSignatures) == null ? void 0 : _a2.get(last(sourceStack))) == null ? void 0 : _b.get(sourceSignatures[i]))) {
|
|
65722
|
+
continue;
|
|
65723
|
+
}
|
|
65724
|
+
spawnAlternativeInferenceContext(
|
|
65725
|
+
group3,
|
|
65726
|
+
() => inferFromSignature(sourceSignatures[i], targetSignatures[0])
|
|
65727
|
+
);
|
|
65728
|
+
}
|
|
65729
|
+
joinInferenceContext(group3);
|
|
65730
|
+
} else {
|
|
65731
|
+
const len = sourceLen < targetLen ? sourceLen : targetLen;
|
|
65732
|
+
for (let i = 0; i < len; i++) {
|
|
65733
|
+
inferFromSignature(sourceSignatures[sourceLen - len + i], targetSignatures[targetLen - len + i]);
|
|
65734
|
+
}
|
|
65637
65735
|
}
|
|
65638
65736
|
}
|
|
65639
65737
|
function inferFromSignature(source, target) {
|
|
65738
|
+
target = getErasedSignature(target);
|
|
65739
|
+
if (source.typeParameters) {
|
|
65740
|
+
let cache = (context.freeTypeVariableSourceSignatures || (context.freeTypeVariableSourceSignatures = /* @__PURE__ */ new Map())).get(last(sourceStack));
|
|
65741
|
+
if (!cache) {
|
|
65742
|
+
context.freeTypeVariableSourceSignatures.set(last(sourceStack), cache = /* @__PURE__ */ new Map());
|
|
65743
|
+
}
|
|
65744
|
+
const cached = cache.get(source);
|
|
65745
|
+
if (cached) {
|
|
65746
|
+
source = cached;
|
|
65747
|
+
} else {
|
|
65748
|
+
const originalSignature = source;
|
|
65749
|
+
source = instantiateSignature(source, makeUnaryTypeMapper(unknownType, unknownType));
|
|
65750
|
+
cache.set(originalSignature, source);
|
|
65751
|
+
(context.freeTypeVariables || (context.freeTypeVariables = [])).push(...map(source.typeParameters, createInferenceInfo));
|
|
65752
|
+
}
|
|
65753
|
+
}
|
|
65640
65754
|
const saveBivariant = bivariant;
|
|
65641
65755
|
const kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
|
|
65642
65756
|
bivariant = bivariant || kind === 171 /* MethodDeclaration */ || kind === 170 /* MethodSignature */ || kind === 173 /* Constructor */;
|
|
@@ -65711,8 +65825,7 @@ ${lanes.join("\n")}
|
|
|
65711
65825
|
const unwidenedType = inference.priority & 416 /* PriorityImpliesCombination */ ? getUnionType(baseCandidates, 2 /* Subtype */) : getCommonSupertype(baseCandidates);
|
|
65712
65826
|
return getWidenedType(unwidenedType);
|
|
65713
65827
|
}
|
|
65714
|
-
function getInferredType(context,
|
|
65715
|
-
const inference = context.inferences[index];
|
|
65828
|
+
function getInferredType(context, inference) {
|
|
65716
65829
|
if (!inference.inferredType) {
|
|
65717
65830
|
let inferredType;
|
|
65718
65831
|
const signature = context.signature;
|
|
@@ -65728,7 +65841,7 @@ ${lanes.join("\n")}
|
|
|
65728
65841
|
} else {
|
|
65729
65842
|
const defaultType = getDefaultFromTypeParameter(inference.typeParameter);
|
|
65730
65843
|
if (defaultType) {
|
|
65731
|
-
inferredType = instantiateType(defaultType, mergeTypeMappers(createBackreferenceMapper(context,
|
|
65844
|
+
inferredType = instantiateType(defaultType, mergeTypeMappers(createBackreferenceMapper(context, inference), context.nonFixingMapper));
|
|
65732
65845
|
}
|
|
65733
65846
|
}
|
|
65734
65847
|
} else {
|
|
@@ -65748,12 +65861,24 @@ ${lanes.join("\n")}
|
|
|
65748
65861
|
function getDefaultTypeArgumentType(isInJavaScriptFile) {
|
|
65749
65862
|
return isInJavaScriptFile ? anyType : unknownType;
|
|
65750
65863
|
}
|
|
65751
|
-
function getInferredTypes(context) {
|
|
65752
|
-
const
|
|
65753
|
-
|
|
65754
|
-
|
|
65864
|
+
function getInferredTypes(context, accept) {
|
|
65865
|
+
const alternatives = flattenInferenceContextAlternatives(context);
|
|
65866
|
+
let finalAlternative;
|
|
65867
|
+
for (let a = alternatives.length - 1; a >= 0; a--) {
|
|
65868
|
+
const context2 = alternatives[a];
|
|
65869
|
+
const freeTypeVariableMapper = makeFreeTypeVariableMapperForContext(context2);
|
|
65870
|
+
const result = [];
|
|
65871
|
+
for (const inference of context2.inferences) {
|
|
65872
|
+
result.push(instantiateType(getInferredType(context2, inference), freeTypeVariableMapper));
|
|
65873
|
+
}
|
|
65874
|
+
if (alternatives.length === 1 || accept(result)) {
|
|
65875
|
+
return result;
|
|
65876
|
+
}
|
|
65877
|
+
if (!finalAlternative) {
|
|
65878
|
+
finalAlternative = result;
|
|
65879
|
+
}
|
|
65755
65880
|
}
|
|
65756
|
-
return
|
|
65881
|
+
return finalAlternative;
|
|
65757
65882
|
}
|
|
65758
65883
|
function getCannotFindNameDiagnosticForName(node) {
|
|
65759
65884
|
switch (node.escapedText) {
|
|
@@ -69131,8 +69256,11 @@ ${lanes.join("\n")}
|
|
|
69131
69256
|
function instantiateContextualType(contextualType, node, contextFlags) {
|
|
69132
69257
|
if (contextualType && maybeTypeOfKind(contextualType, 465829888 /* Instantiable */)) {
|
|
69133
69258
|
const inferenceContext = getInferenceContext(node);
|
|
69134
|
-
if (inferenceContext && contextFlags & 1 /* Signature */ && some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) {
|
|
69135
|
-
return
|
|
69259
|
+
if (inferenceContext && contextFlags & 1 /* Signature */ && some(flatMap(flattenInferenceContextAlternatives(inferenceContext), (c) => c.inferences), hasInferenceCandidatesOrDefault)) {
|
|
69260
|
+
return getUnionType(map(
|
|
69261
|
+
flattenInferenceContextAlternatives(inferenceContext),
|
|
69262
|
+
(c) => instantiateInstantiableTypes(contextualType, c.nonFixingMapper)
|
|
69263
|
+
));
|
|
69136
69264
|
}
|
|
69137
69265
|
if (inferenceContext == null ? void 0 : inferenceContext.returnMapper) {
|
|
69138
69266
|
const type = instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper);
|
|
@@ -71491,23 +71619,23 @@ ${lanes.join("\n")}
|
|
|
71491
71619
|
function instantiateSignatureInContextOf(signature, contextualSignature, inferenceContext, compareTypes) {
|
|
71492
71620
|
const context = createInferenceContext(signature.typeParameters, signature, 0 /* None */, compareTypes);
|
|
71493
71621
|
const restType = getEffectiveRestType(contextualSignature);
|
|
71494
|
-
const mapper = inferenceContext && (restType && restType.flags & 262144 /* TypeParameter */ ? inferenceContext.nonFixingMapper : inferenceContext
|
|
71622
|
+
const mapper = inferenceContext && (restType && restType.flags & 262144 /* TypeParameter */ ? inferenceContext.nonFixingMapper : getMapperFromContext(inferenceContext));
|
|
71495
71623
|
const sourceSignature = mapper ? instantiateSignature(contextualSignature, mapper) : contextualSignature;
|
|
71496
71624
|
applyToParameterTypes(sourceSignature, signature, (source, target) => {
|
|
71497
|
-
inferTypes(context
|
|
71625
|
+
inferTypes(context, source, target);
|
|
71498
71626
|
});
|
|
71499
71627
|
if (!inferenceContext) {
|
|
71500
71628
|
applyToReturnTypes(contextualSignature, signature, (source, target) => {
|
|
71501
|
-
inferTypes(context
|
|
71629
|
+
inferTypes(context, source, target, 128 /* ReturnType */);
|
|
71502
71630
|
});
|
|
71503
71631
|
}
|
|
71504
|
-
return getSignatureInstantiation(signature, getInferredTypes(context), isInJSFile(contextualSignature.declaration));
|
|
71632
|
+
return getSignatureInstantiation(signature, getInferredTypes(context, returnFalse), isInJSFile(contextualSignature.declaration));
|
|
71505
71633
|
}
|
|
71506
|
-
function inferJsxTypeArguments(node, signature, checkMode, context) {
|
|
71634
|
+
function inferJsxTypeArguments(node, signature, checkMode, context, accept) {
|
|
71507
71635
|
const paramType = getEffectiveFirstArgumentForJsxSignature(signature, node);
|
|
71508
71636
|
const checkAttrType = checkExpressionWithContextualType(node.attributes, paramType, context, checkMode);
|
|
71509
|
-
inferTypes(context
|
|
71510
|
-
return getInferredTypes(context);
|
|
71637
|
+
inferTypes(context, checkAttrType, paramType);
|
|
71638
|
+
return getInferredTypes(context, accept);
|
|
71511
71639
|
}
|
|
71512
71640
|
function getThisArgumentType(thisArgumentNode) {
|
|
71513
71641
|
if (!thisArgumentNode) {
|
|
@@ -71516,9 +71644,9 @@ ${lanes.join("\n")}
|
|
|
71516
71644
|
const thisArgumentType = checkExpression(thisArgumentNode);
|
|
71517
71645
|
return isOptionalChainRoot(thisArgumentNode.parent) ? getNonNullableType(thisArgumentType) : isOptionalChain(thisArgumentNode.parent) ? removeOptionalTypeMarker(thisArgumentType) : thisArgumentType;
|
|
71518
71646
|
}
|
|
71519
|
-
function inferTypeArguments(node, signature, args, checkMode, context) {
|
|
71647
|
+
function inferTypeArguments(node, signature, args, checkMode, context, accept) {
|
|
71520
71648
|
if (isJsxOpeningLikeElement(node)) {
|
|
71521
|
-
return inferJsxTypeArguments(node, signature, checkMode, context);
|
|
71649
|
+
return inferJsxTypeArguments(node, signature, checkMode, context, accept);
|
|
71522
71650
|
}
|
|
71523
71651
|
if (node.kind !== 167 /* Decorator */) {
|
|
71524
71652
|
const skipBindingPatterns = every(signature.typeParameters, (p) => !!getDefaultFromTypeParameter(p));
|
|
@@ -71533,11 +71661,11 @@ ${lanes.join("\n")}
|
|
|
71533
71661
|
const instantiatedType = instantiateType(contextualType, outerMapper);
|
|
71534
71662
|
const contextualSignature = getSingleCallSignature(instantiatedType);
|
|
71535
71663
|
const inferenceSourceType = contextualSignature && contextualSignature.typeParameters ? getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) : instantiatedType;
|
|
71536
|
-
inferTypes(context
|
|
71664
|
+
inferTypes(context, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
|
|
71537
71665
|
}
|
|
71538
71666
|
const returnContext = createInferenceContext(signature.typeParameters, signature, context.flags);
|
|
71539
71667
|
const returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper);
|
|
71540
|
-
inferTypes(returnContext
|
|
71668
|
+
inferTypes(returnContext, returnSourceType, inferenceTargetType);
|
|
71541
71669
|
context.returnMapper = some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : void 0;
|
|
71542
71670
|
}
|
|
71543
71671
|
}
|
|
@@ -71553,7 +71681,7 @@ ${lanes.join("\n")}
|
|
|
71553
71681
|
const thisType = getThisTypeOfSignature(signature);
|
|
71554
71682
|
if (thisType && couldContainTypeVariables(thisType)) {
|
|
71555
71683
|
const thisArgumentNode = getThisArgumentOfCall(node);
|
|
71556
|
-
inferTypes(context
|
|
71684
|
+
inferTypes(context, getThisArgumentType(thisArgumentNode), thisType);
|
|
71557
71685
|
}
|
|
71558
71686
|
for (let i = 0; i < argCount; i++) {
|
|
71559
71687
|
const arg = args[i];
|
|
@@ -71561,15 +71689,15 @@ ${lanes.join("\n")}
|
|
|
71561
71689
|
const paramType = getTypeAtPosition(signature, i);
|
|
71562
71690
|
if (couldContainTypeVariables(paramType)) {
|
|
71563
71691
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
71564
|
-
inferTypes(context
|
|
71692
|
+
inferTypes(context, argType, paramType);
|
|
71565
71693
|
}
|
|
71566
71694
|
}
|
|
71567
71695
|
}
|
|
71568
71696
|
if (restType && couldContainTypeVariables(restType)) {
|
|
71569
71697
|
const spreadType = getSpreadArgumentType(args, argCount, args.length, restType, context, checkMode);
|
|
71570
|
-
inferTypes(context
|
|
71698
|
+
inferTypes(context, spreadType, restType);
|
|
71571
71699
|
}
|
|
71572
|
-
return getInferredTypes(context);
|
|
71700
|
+
return getInferredTypes(context, accept);
|
|
71573
71701
|
}
|
|
71574
71702
|
function getMutableArrayOrTupleType(type) {
|
|
71575
71703
|
return type.flags & 1048576 /* Union */ ? mapType(type, getMutableArrayOrTupleType) : type.flags & 1 /* Any */ || isMutableArrayOrTuple(getBaseConstraintOfType(type) || type) ? type : isTupleType(type) ? createTupleType(
|
|
@@ -72336,6 +72464,26 @@ ${lanes.join("\n")}
|
|
|
72336
72464
|
}
|
|
72337
72465
|
let checkCandidate;
|
|
72338
72466
|
let inferenceContext;
|
|
72467
|
+
const acceptor = (types) => {
|
|
72468
|
+
const checkCandidate2 = getSignatureInstantiation(candidate, types, isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
|
|
72469
|
+
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate2, signatureHelpTrailingComma2)) {
|
|
72470
|
+
return false;
|
|
72471
|
+
}
|
|
72472
|
+
if (getSignatureApplicabilityError(
|
|
72473
|
+
node,
|
|
72474
|
+
args,
|
|
72475
|
+
checkCandidate2,
|
|
72476
|
+
relation,
|
|
72477
|
+
argCheckMode,
|
|
72478
|
+
/*reportErrors*/
|
|
72479
|
+
false,
|
|
72480
|
+
/*containingMessageChain*/
|
|
72481
|
+
void 0
|
|
72482
|
+
)) {
|
|
72483
|
+
return false;
|
|
72484
|
+
}
|
|
72485
|
+
return true;
|
|
72486
|
+
};
|
|
72339
72487
|
if (candidate.typeParameters) {
|
|
72340
72488
|
let typeArgumentTypes;
|
|
72341
72489
|
if (some(typeArguments)) {
|
|
@@ -72356,7 +72504,7 @@ ${lanes.join("\n")}
|
|
|
72356
72504
|
/*flags*/
|
|
72357
72505
|
isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */
|
|
72358
72506
|
);
|
|
72359
|
-
typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext);
|
|
72507
|
+
typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext, acceptor);
|
|
72360
72508
|
argCheckMode |= inferenceContext.flags & 4 /* SkippedGenericFunction */ ? 8 /* SkipGenericFunctions */ : 0 /* Normal */;
|
|
72361
72509
|
}
|
|
72362
72510
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
|
|
@@ -72384,7 +72532,7 @@ ${lanes.join("\n")}
|
|
|
72384
72532
|
if (argCheckMode) {
|
|
72385
72533
|
argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
72386
72534
|
if (inferenceContext) {
|
|
72387
|
-
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
72535
|
+
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext, acceptor);
|
|
72388
72536
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
72389
72537
|
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) {
|
|
72390
72538
|
candidateForArgumentArityError = checkCandidate;
|
|
@@ -72494,7 +72642,7 @@ ${lanes.join("\n")}
|
|
|
72494
72642
|
/*flags*/
|
|
72495
72643
|
isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */
|
|
72496
72644
|
);
|
|
72497
|
-
const typeArgumentTypes = inferTypeArguments(node, candidate, args, checkMode | 4 /* SkipContextSensitive */ | 8 /* SkipGenericFunctions */, inferenceContext);
|
|
72645
|
+
const typeArgumentTypes = inferTypeArguments(node, candidate, args, checkMode | 4 /* SkipContextSensitive */ | 8 /* SkipGenericFunctions */, inferenceContext, returnFalse);
|
|
72498
72646
|
return createSignatureInstantiation(candidate, typeArgumentTypes);
|
|
72499
72647
|
}
|
|
72500
72648
|
function getLongestCandidateIndex(candidates, argsCount) {
|
|
@@ -73762,7 +73910,7 @@ ${lanes.join("\n")}
|
|
|
73762
73910
|
if (declaration.type) {
|
|
73763
73911
|
const typeNode = getEffectiveTypeAnnotationNode(declaration);
|
|
73764
73912
|
if (typeNode) {
|
|
73765
|
-
inferTypes(inferenceContext
|
|
73913
|
+
inferTypes(inferenceContext, getTypeFromTypeNode(typeNode), getTypeAtPosition(context, i));
|
|
73766
73914
|
}
|
|
73767
73915
|
}
|
|
73768
73916
|
}
|
|
@@ -74474,7 +74622,7 @@ ${lanes.join("\n")}
|
|
|
74474
74622
|
instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper);
|
|
74475
74623
|
}
|
|
74476
74624
|
}
|
|
74477
|
-
instantiatedContextualSignature || (instantiatedContextualSignature = inferenceContext ? instantiateSignature(contextualSignature, inferenceContext
|
|
74625
|
+
instantiatedContextualSignature || (instantiatedContextualSignature = inferenceContext ? instantiateSignature(contextualSignature, getMapperFromContext(inferenceContext)) : contextualSignature);
|
|
74478
74626
|
assignContextualParameterTypes(signature, instantiatedContextualSignature);
|
|
74479
74627
|
} else {
|
|
74480
74628
|
assignNonContextualParameterTypes(signature);
|
|
@@ -75855,7 +76003,7 @@ ${lanes.join("\n")}
|
|
|
75855
76003
|
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);
|
|
75856
76004
|
}
|
|
75857
76005
|
function isConstTypeParameterContext(node) {
|
|
75858
|
-
const contextualType = getContextualType2(node,
|
|
76006
|
+
const contextualType = getContextualType2(node, 1 /* Signature */);
|
|
75859
76007
|
return !!contextualType && someType(contextualType, isConstTypeVariable);
|
|
75860
76008
|
}
|
|
75861
76009
|
function checkExpressionForMutableLocation(node, checkMode, forceTuple) {
|
|
@@ -75920,10 +76068,11 @@ ${lanes.join("\n")}
|
|
|
75920
76068
|
if (returnSignature && !returnSignature.typeParameters && !every(context.inferences, hasInferenceCandidates)) {
|
|
75921
76069
|
const uniqueTypeParameters = getUniqueTypeParameters(context, signature.typeParameters);
|
|
75922
76070
|
const instantiatedSignature = getSignatureInstantiationWithoutFillingInTypeArguments(signature, uniqueTypeParameters);
|
|
75923
|
-
const
|
|
76071
|
+
const subcontext = cloneInferenceContext(context);
|
|
76072
|
+
subcontext.inferences = map(context.inferences, (info) => createInferenceInfo(info.typeParameter));
|
|
75924
76073
|
applyToParameterTypes(instantiatedSignature, contextualSignature, (source, target) => {
|
|
75925
76074
|
inferTypes(
|
|
75926
|
-
|
|
76075
|
+
subcontext,
|
|
75927
76076
|
source,
|
|
75928
76077
|
target,
|
|
75929
76078
|
/*priority*/
|
|
@@ -75932,12 +76081,12 @@ ${lanes.join("\n")}
|
|
|
75932
76081
|
true
|
|
75933
76082
|
);
|
|
75934
76083
|
});
|
|
75935
|
-
if (some(inferences, hasInferenceCandidates)) {
|
|
76084
|
+
if (some(subcontext.inferences, hasInferenceCandidates)) {
|
|
75936
76085
|
applyToReturnTypes(instantiatedSignature, contextualSignature, (source, target) => {
|
|
75937
|
-
inferTypes(
|
|
76086
|
+
inferTypes(subcontext, source, target);
|
|
75938
76087
|
});
|
|
75939
|
-
if (!hasOverlappingInferences(context.inferences, inferences)) {
|
|
75940
|
-
|
|
76088
|
+
if (!hasOverlappingInferences(context.inferences, subcontext.inferences)) {
|
|
76089
|
+
mergeInferenceContexts(context, subcontext);
|
|
75941
76090
|
context.inferredTypeParameters = concatenate(context.inferredTypeParameters, uniqueTypeParameters);
|
|
75942
76091
|
return getOrCreateTypeFromSignature(instantiatedSignature);
|
|
75943
76092
|
}
|
|
@@ -75970,13 +76119,22 @@ ${lanes.join("\n")}
|
|
|
75970
76119
|
}
|
|
75971
76120
|
return false;
|
|
75972
76121
|
}
|
|
75973
|
-
function mergeInferences(target, source) {
|
|
76122
|
+
function mergeInferences(target, source, clone2 = false) {
|
|
75974
76123
|
for (let i = 0; i < target.length; i++) {
|
|
75975
76124
|
if (!hasInferenceCandidates(target[i]) && hasInferenceCandidates(source[i])) {
|
|
75976
|
-
target[i] =
|
|
76125
|
+
target[i] = clone2 ? {
|
|
76126
|
+
...source[i],
|
|
76127
|
+
candidates: source[i].candidates && [...source[i].candidates],
|
|
76128
|
+
contraCandidates: source[i].contraCandidates && [...source[i].contraCandidates]
|
|
76129
|
+
} : source[i];
|
|
75977
76130
|
}
|
|
75978
76131
|
}
|
|
75979
76132
|
}
|
|
76133
|
+
function mergeInferenceContexts(target, source, cloneInferences = false) {
|
|
76134
|
+
mergeInferences(target.inferences, source.inferences, cloneInferences);
|
|
76135
|
+
target.mapper = makeFixingMapperForContext(target);
|
|
76136
|
+
target.nonFixingMapper = makeNonFixingMapperForContext(target);
|
|
76137
|
+
}
|
|
75980
76138
|
function getUniqueTypeParameters(context, typeParameters) {
|
|
75981
76139
|
const result = [];
|
|
75982
76140
|
let oldTypeParameters;
|
|
@@ -147958,7 +148116,6 @@ ${lanes.join("\n")}
|
|
|
147958
148116
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
147959
148117
|
}
|
|
147960
148118
|
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol) {
|
|
147961
|
-
var _a2;
|
|
147962
148119
|
let insertText;
|
|
147963
148120
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
147964
148121
|
let data;
|
|
@@ -148016,10 +148173,6 @@ ${lanes.join("\n")}
|
|
|
148016
148173
|
if ((origin == null ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
|
|
148017
148174
|
hasAction = true;
|
|
148018
148175
|
}
|
|
148019
|
-
if (contextToken && isPropertyAssignment(contextToken.parent) && ((_a2 = findNextToken(contextToken, contextToken == null ? void 0 : contextToken.parent, sourceFile)) == null ? void 0 : _a2.kind) !== 27 /* CommaToken */ && completionKind === 0 /* ObjectPropertyDeclaration */) {
|
|
148020
|
-
source = "ObjectLiteralExpression/" /* ObjectLiteralExpression */;
|
|
148021
|
-
hasAction = true;
|
|
148022
|
-
}
|
|
148023
148176
|
if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
|
|
148024
148177
|
let importAdder;
|
|
148025
148178
|
({ insertText, isSnippet, importAdder, replacementSpan } = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext));
|
|
@@ -148708,7 +148861,7 @@ ${lanes.join("\n")}
|
|
|
148708
148861
|
return firstDefined(symbols, (symbol, index) => {
|
|
148709
148862
|
const origin = symbolToOriginInfoMap[index];
|
|
148710
148863
|
const info = getCompletionEntryDisplayNameForSymbol(symbol, getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected);
|
|
148711
|
-
return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source
|
|
148864
|
+
return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0;
|
|
148712
148865
|
}) || { type: "none" };
|
|
148713
148866
|
}
|
|
148714
148867
|
function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) {
|
|
@@ -148846,21 +148999,6 @@ ${lanes.join("\n")}
|
|
|
148846
148999
|
Debug.assertIsDefined(codeAction2, "Expected to have a code action for promoting type-only alias");
|
|
148847
149000
|
return { codeActions: [codeAction2], sourceDisplay: void 0 };
|
|
148848
149001
|
}
|
|
148849
|
-
if (source === "ObjectLiteralExpression/" /* ObjectLiteralExpression */ && contextToken) {
|
|
148850
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
148851
|
-
{ host, formatContext, preferences },
|
|
148852
|
-
(tracker) => tracker.insertText(sourceFile, contextToken.end, ",")
|
|
148853
|
-
);
|
|
148854
|
-
if (changes) {
|
|
148855
|
-
return {
|
|
148856
|
-
sourceDisplay: void 0,
|
|
148857
|
-
codeActions: [{
|
|
148858
|
-
changes,
|
|
148859
|
-
description: diagnosticToString([Diagnostics.Add_missing_comma_for_an_object_member_completion_0, name])
|
|
148860
|
-
}]
|
|
148861
|
-
};
|
|
148862
|
-
}
|
|
148863
|
-
}
|
|
148864
149002
|
if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
|
|
148865
149003
|
return { codeActions: void 0, sourceDisplay: void 0 };
|
|
148866
149004
|
}
|
|
@@ -150259,10 +150397,6 @@ ${lanes.join("\n")}
|
|
|
150259
150397
|
return isMethodDeclaration(parent2) ? tryCast(parent2.parent, isObjectLiteralExpression) : void 0;
|
|
150260
150398
|
case 79 /* Identifier */:
|
|
150261
150399
|
return contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent) ? contextToken.parent.parent : void 0;
|
|
150262
|
-
default:
|
|
150263
|
-
if (parent2.parent && isObjectLiteralExpression(parent2.parent) && contextToken.kind !== 58 /* ColonToken */) {
|
|
150264
|
-
return parent2.parent;
|
|
150265
|
-
}
|
|
150266
150400
|
}
|
|
150267
150401
|
}
|
|
150268
150402
|
return void 0;
|
|
@@ -150803,7 +150937,6 @@ ${lanes.join("\n")}
|
|
|
150803
150937
|
CompletionSource2["TypeOnlyAlias"] = "TypeOnlyAlias/";
|
|
150804
150938
|
CompletionSource2["ObjectLiteralMethodSnippet"] = "ObjectLiteralMethodSnippet/";
|
|
150805
150939
|
CompletionSource2["SwitchCases"] = "SwitchCases/";
|
|
150806
|
-
CompletionSource2["ObjectLiteralExpression"] = "ObjectLiteralExpression/";
|
|
150807
150940
|
return CompletionSource2;
|
|
150808
150941
|
})(CompletionSource || {});
|
|
150809
150942
|
SymbolOriginInfoKind = /* @__PURE__ */ ((SymbolOriginInfoKind2) => {
|
|
@@ -163797,10 +163930,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163797
163930
|
const suffix = this.nextCommaToken(sourceFile, oldNode) ? "" : "," + this.newLineCharacter;
|
|
163798
163931
|
this.replaceNode(sourceFile, oldNode, newNode, { suffix });
|
|
163799
163932
|
}
|
|
163800
|
-
replacePropertyAssignmentOnSameLine(sourceFile, oldNode, newNode) {
|
|
163801
|
-
const suffix = this.nextCommaToken(sourceFile, oldNode) ? "" : ",";
|
|
163802
|
-
this.replaceNode(sourceFile, oldNode, newNode, { suffix });
|
|
163803
|
-
}
|
|
163804
163933
|
insertNodeAt(sourceFile, pos, newNode, options = {}) {
|
|
163805
163934
|
this.replaceRange(sourceFile, createRange(pos), newNode, options);
|
|
163806
163935
|
}
|