typescript 4.8.0-dev.20220628 → 4.8.0-dev.20220701
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 +264 -180
- package/lib/tsserver.js +302 -218
- package/lib/tsserverlibrary.js +302 -218
- package/lib/typescript.js +302 -218
- package/lib/typescriptServices.js +302 -218
- package/lib/typingsInstaller.js +274 -189
- package/package.json +1 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -303,7 +303,7 @@ var ts;
|
|
|
303
303
|
// The following is baselined as a literal template type without intervention
|
|
304
304
|
/** The version of the TypeScript compiler release */
|
|
305
305
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
306
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
306
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220701";
|
|
307
307
|
/* @internal */
|
|
308
308
|
var Comparison;
|
|
309
309
|
(function (Comparison) {
|
|
@@ -3318,6 +3318,22 @@ var ts;
|
|
|
3318
3318
|
return wrapFunction(deprecation, func);
|
|
3319
3319
|
}
|
|
3320
3320
|
Debug.deprecate = deprecate;
|
|
3321
|
+
function formatVariance(varianceFlags) {
|
|
3322
|
+
var variance = varianceFlags & 7 /* VarianceMask */;
|
|
3323
|
+
var result = variance === 0 /* Invariant */ ? "in out" :
|
|
3324
|
+
variance === 3 /* Bivariant */ ? "[bivariant]" :
|
|
3325
|
+
variance === 2 /* Contravariant */ ? "in" :
|
|
3326
|
+
variance === 1 /* Covariant */ ? "out" :
|
|
3327
|
+
variance === 4 /* Independent */ ? "[independent]" : "";
|
|
3328
|
+
if (varianceFlags & 8 /* Unmeasurable */) {
|
|
3329
|
+
result += " (unmeasurable)";
|
|
3330
|
+
}
|
|
3331
|
+
else if (varianceFlags & 16 /* Unreliable */) {
|
|
3332
|
+
result += " (unreliable)";
|
|
3333
|
+
}
|
|
3334
|
+
return result;
|
|
3335
|
+
}
|
|
3336
|
+
Debug.formatVariance = formatVariance;
|
|
3321
3337
|
})(Debug = ts.Debug || (ts.Debug = {}));
|
|
3322
3338
|
})(ts || (ts = {}));
|
|
3323
3339
|
/* @internal */
|
|
@@ -4059,9 +4075,9 @@ var ts;
|
|
|
4059
4075
|
eventStack.push({ phase: phase, name: name, args: args, time: 1000 * ts.timestamp(), separateBeginAndEnd: separateBeginAndEnd });
|
|
4060
4076
|
}
|
|
4061
4077
|
tracingEnabled.push = push;
|
|
4062
|
-
function pop() {
|
|
4078
|
+
function pop(results) {
|
|
4063
4079
|
ts.Debug.assert(eventStack.length > 0);
|
|
4064
|
-
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp());
|
|
4080
|
+
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp(), results);
|
|
4065
4081
|
eventStack.length--;
|
|
4066
4082
|
}
|
|
4067
4083
|
tracingEnabled.pop = pop;
|
|
@@ -4075,14 +4091,15 @@ var ts;
|
|
|
4075
4091
|
tracingEnabled.popAll = popAll;
|
|
4076
4092
|
// sample every 10ms
|
|
4077
4093
|
var sampleInterval = 1000 * 10;
|
|
4078
|
-
function writeStackEvent(index, endTime) {
|
|
4094
|
+
function writeStackEvent(index, endTime, results) {
|
|
4079
4095
|
var _a = eventStack[index], phase = _a.phase, name = _a.name, args = _a.args, time = _a.time, separateBeginAndEnd = _a.separateBeginAndEnd;
|
|
4080
4096
|
if (separateBeginAndEnd) {
|
|
4097
|
+
ts.Debug.assert(!results, "`results` are not supported for events with `separateBeginAndEnd`");
|
|
4081
4098
|
writeEvent("E", phase, name, args, /*extras*/ undefined, endTime);
|
|
4082
4099
|
}
|
|
4083
4100
|
// test if [time,endTime) straddles a sampling point
|
|
4084
4101
|
else if (sampleInterval - (time % sampleInterval) <= endTime - time) {
|
|
4085
|
-
writeEvent("X", phase, name, args, "\"dur\":" + (endTime - time), time);
|
|
4102
|
+
writeEvent("X", phase, name, __assign(__assign({}, args), { results: results }), "\"dur\":" + (endTime - time), time);
|
|
4086
4103
|
}
|
|
4087
4104
|
}
|
|
4088
4105
|
function writeEvent(eventType, phase, name, args, extras, time) {
|
|
@@ -5453,9 +5470,10 @@ var ts;
|
|
|
5453
5470
|
(function (TypeMapKind) {
|
|
5454
5471
|
TypeMapKind[TypeMapKind["Simple"] = 0] = "Simple";
|
|
5455
5472
|
TypeMapKind[TypeMapKind["Array"] = 1] = "Array";
|
|
5456
|
-
TypeMapKind[TypeMapKind["
|
|
5457
|
-
TypeMapKind[TypeMapKind["
|
|
5458
|
-
TypeMapKind[TypeMapKind["
|
|
5473
|
+
TypeMapKind[TypeMapKind["Deferred"] = 2] = "Deferred";
|
|
5474
|
+
TypeMapKind[TypeMapKind["Function"] = 3] = "Function";
|
|
5475
|
+
TypeMapKind[TypeMapKind["Composite"] = 4] = "Composite";
|
|
5476
|
+
TypeMapKind[TypeMapKind["Merged"] = 5] = "Merged";
|
|
5459
5477
|
})(TypeMapKind = ts.TypeMapKind || (ts.TypeMapKind = {}));
|
|
5460
5478
|
var InferencePriority;
|
|
5461
5479
|
(function (InferencePriority) {
|
|
@@ -48858,6 +48876,24 @@ var ts;
|
|
|
48858
48876
|
var Symbol = ts.objectAllocator.getSymbolConstructor();
|
|
48859
48877
|
var Type = ts.objectAllocator.getTypeConstructor();
|
|
48860
48878
|
var Signature = ts.objectAllocator.getSignatureConstructor();
|
|
48879
|
+
var DebugTypeMapper = /** @class */ (function () {
|
|
48880
|
+
function DebugTypeMapper() {
|
|
48881
|
+
}
|
|
48882
|
+
DebugTypeMapper.prototype.__debugToString = function () {
|
|
48883
|
+
var _a;
|
|
48884
|
+
ts.Debug.type(this);
|
|
48885
|
+
switch (this.kind) {
|
|
48886
|
+
case 3 /* Function */: return ((_a = this.debugInfo) === null || _a === void 0 ? void 0 : _a.call(this)) || "(function mapper)";
|
|
48887
|
+
case 0 /* Simple */: return this.source.__debugTypeToString() + " -> " + this.target.__debugTypeToString();
|
|
48888
|
+
case 1 /* Array */: return ts.zipWith(this.sources, this.targets || ts.map(this.sources, function () { return anyType; }), function (s, t) { return s.__debugTypeToString() + " -> " + t.__debugTypeToString(); }).join(", ");
|
|
48889
|
+
case 2 /* Deferred */: return ts.zipWith(this.sources, this.targets, function (s, t) { return s.__debugTypeToString() + " -> " + t().__debugTypeToString(); }).join(", ");
|
|
48890
|
+
case 5 /* Merged */:
|
|
48891
|
+
case 4 /* Composite */: return "m1: " + this.mapper1.__debugToString().split("\n").join("\n ") + "\nm2: " + this.mapper2.__debugToString().split("\n").join("\n ");
|
|
48892
|
+
default: return ts.Debug.assertNever(this);
|
|
48893
|
+
}
|
|
48894
|
+
};
|
|
48895
|
+
return DebugTypeMapper;
|
|
48896
|
+
}());
|
|
48861
48897
|
var typeCount = 0;
|
|
48862
48898
|
var symbolCount = 0;
|
|
48863
48899
|
var enumCount = 0;
|
|
@@ -49318,10 +49354,23 @@ var ts;
|
|
|
49318
49354
|
var numberOrBigIntType = getUnionType([numberType, bigintType]);
|
|
49319
49355
|
var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
|
|
49320
49356
|
var numericStringType = getTemplateLiteralType(["", ""], [numberType]); // The `${number}` type
|
|
49321
|
-
var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; });
|
|
49322
|
-
var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? wildcardType : t; });
|
|
49357
|
+
var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; }, function () { return "(restrictive mapper)"; });
|
|
49358
|
+
var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? wildcardType : t; }, function () { return "(permissive mapper)"; });
|
|
49323
49359
|
var uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never"); // `uniqueLiteralType` is a special `never` flagged by union reduction to behave as a literal
|
|
49324
|
-
var uniqueLiteralMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? uniqueLiteralType : t; }); // replace all type parameters with the unique literal type (disregarding constraints)
|
|
49360
|
+
var uniqueLiteralMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? uniqueLiteralType : t; }, function () { return "(unique literal mapper)"; }); // replace all type parameters with the unique literal type (disregarding constraints)
|
|
49361
|
+
var outofbandVarianceMarkerHandler;
|
|
49362
|
+
var reportUnreliableMapper = makeFunctionTypeMapper(function (t) {
|
|
49363
|
+
if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
|
|
49364
|
+
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ true);
|
|
49365
|
+
}
|
|
49366
|
+
return t;
|
|
49367
|
+
}, function () { return "(unmeasurable reporter)"; });
|
|
49368
|
+
var reportUnmeasurableMapper = makeFunctionTypeMapper(function (t) {
|
|
49369
|
+
if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
|
|
49370
|
+
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ false);
|
|
49371
|
+
}
|
|
49372
|
+
return t;
|
|
49373
|
+
}, function () { return "(unreliable reporter)"; });
|
|
49325
49374
|
var emptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49326
49375
|
var emptyJsxObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49327
49376
|
emptyJsxObjectType.objectFlags |= 2048 /* JsxAttributes */;
|
|
@@ -49481,7 +49530,6 @@ var ts;
|
|
|
49481
49530
|
var typeofType = createTypeofType();
|
|
49482
49531
|
var _jsxNamespace;
|
|
49483
49532
|
var _jsxFactoryEntity;
|
|
49484
|
-
var outofbandVarianceMarkerHandler;
|
|
49485
49533
|
var subtypeRelation = new ts.Map();
|
|
49486
49534
|
var strictSubtypeRelation = new ts.Map();
|
|
49487
49535
|
var assignableRelation = new ts.Map();
|
|
@@ -53248,7 +53296,7 @@ var ts;
|
|
|
53248
53296
|
var name = typeParameterToName(newParam, context);
|
|
53249
53297
|
var newTypeVariable = ts.factory.createTypeReferenceNode(name);
|
|
53250
53298
|
context.approximateLength += 37; // 15 each for two added conditionals, 7 for an added infer type
|
|
53251
|
-
var newMapper = prependTypeMapping(type.root.checkType, newParam, type.
|
|
53299
|
+
var newMapper = prependTypeMapping(type.root.checkType, newParam, type.mapper);
|
|
53252
53300
|
var saveInferTypeParameters_1 = context.inferTypeParameters;
|
|
53253
53301
|
context.inferTypeParameters = type.root.inferTypeParameters;
|
|
53254
53302
|
var extendsTypeNode_1 = typeToTypeNodeHelper(instantiateType(type.root.extendsType, newMapper), context);
|
|
@@ -60659,8 +60707,7 @@ var ts;
|
|
|
60659
60707
|
var _a;
|
|
60660
60708
|
var inferences;
|
|
60661
60709
|
if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
|
|
60662
|
-
|
|
60663
|
-
var declaration = _b[_i];
|
|
60710
|
+
var _loop_15 = function (declaration) {
|
|
60664
60711
|
if (declaration.parent.kind === 190 /* InferType */) {
|
|
60665
60712
|
// When an 'infer T' declaration is immediately contained in a type reference node
|
|
60666
60713
|
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
|
|
@@ -60668,12 +60715,12 @@ var ts;
|
|
|
60668
60715
|
// present, we form an intersection of the inferred constraint types.
|
|
60669
60716
|
var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1];
|
|
60670
60717
|
if (grandParent.kind === 178 /* TypeReference */ && !omitTypeReferences) {
|
|
60671
|
-
var
|
|
60672
|
-
var
|
|
60673
|
-
if (
|
|
60674
|
-
var index =
|
|
60675
|
-
if (index <
|
|
60676
|
-
var declaredConstraint = getConstraintOfTypeParameter(
|
|
60718
|
+
var typeReference_1 = grandParent;
|
|
60719
|
+
var typeParameters_1 = getTypeParametersForTypeReference(typeReference_1);
|
|
60720
|
+
if (typeParameters_1) {
|
|
60721
|
+
var index = typeReference_1.typeArguments.indexOf(childTypeParameter);
|
|
60722
|
+
if (index < typeParameters_1.length) {
|
|
60723
|
+
var declaredConstraint = getConstraintOfTypeParameter(typeParameters_1[index]);
|
|
60677
60724
|
if (declaredConstraint) {
|
|
60678
60725
|
// Type parameter constraints can reference other type parameters so
|
|
60679
60726
|
// constraints need to be instantiated. If instantiation produces the
|
|
@@ -60681,7 +60728,9 @@ var ts;
|
|
|
60681
60728
|
// type Foo<T extends string, U extends T> = [T, U];
|
|
60682
60729
|
// type Bar<T> = T extends Foo<infer X, infer X> ? Foo<X, X> : T;
|
|
60683
60730
|
// the instantiated constraint for U is X, so we discard that inference.
|
|
60684
|
-
var mapper =
|
|
60731
|
+
var mapper = makeDeferredTypeMapper(typeParameters_1, typeParameters_1.map(function (_, index) { return function () {
|
|
60732
|
+
return getEffectiveTypeArgumentAtIndex(typeReference_1, typeParameters_1, index);
|
|
60733
|
+
}; }));
|
|
60685
60734
|
var constraint = instantiateType(declaredConstraint, mapper);
|
|
60686
60735
|
if (constraint !== typeParameter) {
|
|
60687
60736
|
inferences = ts.append(inferences, constraint);
|
|
@@ -60719,6 +60768,10 @@ var ts;
|
|
|
60719
60768
|
inferences = ts.append(inferences, instantiateType(nodeType, makeUnaryTypeMapper(getDeclaredTypeOfTypeParameter(getSymbolOfNode(checkMappedType_1.typeParameter)), checkMappedType_1.typeParameter.constraint ? getTypeFromTypeNode(checkMappedType_1.typeParameter.constraint) : keyofConstraintType)));
|
|
60720
60769
|
}
|
|
60721
60770
|
}
|
|
60771
|
+
};
|
|
60772
|
+
for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
|
|
60773
|
+
var declaration = _b[_i];
|
|
60774
|
+
_loop_15(declaration);
|
|
60722
60775
|
}
|
|
60723
60776
|
}
|
|
60724
60777
|
return inferences && getIntersectionType(inferences);
|
|
@@ -61607,7 +61660,7 @@ var ts;
|
|
|
61607
61660
|
var lastRequiredIndex = -1;
|
|
61608
61661
|
var firstRestIndex = -1;
|
|
61609
61662
|
var lastOptionalOrRestIndex = -1;
|
|
61610
|
-
var
|
|
61663
|
+
var _loop_16 = function (i) {
|
|
61611
61664
|
var type = elementTypes[i];
|
|
61612
61665
|
var flags = target.elementFlags[i];
|
|
61613
61666
|
if (flags & 8 /* Variadic */) {
|
|
@@ -61637,7 +61690,7 @@ var ts;
|
|
|
61637
61690
|
}
|
|
61638
61691
|
};
|
|
61639
61692
|
for (var i = 0; i < elementTypes.length; i++) {
|
|
61640
|
-
var state_4 =
|
|
61693
|
+
var state_4 = _loop_16(i);
|
|
61641
61694
|
if (typeof state_4 === "object")
|
|
61642
61695
|
return state_4.value;
|
|
61643
61696
|
}
|
|
@@ -61833,7 +61886,7 @@ var ts;
|
|
|
61833
61886
|
var templates = ts.filter(types, isPatternLiteralType);
|
|
61834
61887
|
if (templates.length) {
|
|
61835
61888
|
var i = types.length;
|
|
61836
|
-
var
|
|
61889
|
+
var _loop_17 = function () {
|
|
61837
61890
|
i--;
|
|
61838
61891
|
var t = types[i];
|
|
61839
61892
|
if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
|
|
@@ -61841,7 +61894,7 @@ var ts;
|
|
|
61841
61894
|
}
|
|
61842
61895
|
};
|
|
61843
61896
|
while (i > 0) {
|
|
61844
|
-
|
|
61897
|
+
_loop_17();
|
|
61845
61898
|
}
|
|
61846
61899
|
}
|
|
61847
61900
|
}
|
|
@@ -61918,14 +61971,14 @@ var ts;
|
|
|
61918
61971
|
var namedUnions = [];
|
|
61919
61972
|
addNamedUnions(namedUnions, types);
|
|
61920
61973
|
var reducedTypes = [];
|
|
61921
|
-
var
|
|
61974
|
+
var _loop_18 = function (t) {
|
|
61922
61975
|
if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
|
|
61923
61976
|
reducedTypes.push(t);
|
|
61924
61977
|
}
|
|
61925
61978
|
};
|
|
61926
61979
|
for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
|
|
61927
61980
|
var t = typeSet_1[_i];
|
|
61928
|
-
|
|
61981
|
+
_loop_18(t);
|
|
61929
61982
|
}
|
|
61930
61983
|
if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
|
|
61931
61984
|
return namedUnions[0];
|
|
@@ -63149,7 +63202,7 @@ var ts;
|
|
|
63149
63202
|
var result;
|
|
63150
63203
|
var extraTypes;
|
|
63151
63204
|
var tailCount = 0;
|
|
63152
|
-
var
|
|
63205
|
+
var _loop_19 = function () {
|
|
63153
63206
|
if (tailCount === 1000) {
|
|
63154
63207
|
error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
63155
63208
|
result = errorType;
|
|
@@ -63270,7 +63323,7 @@ var ts;
|
|
|
63270
63323
|
// another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
|
|
63271
63324
|
// cases we increment the tail recursion counter and stop after 1000 iterations.
|
|
63272
63325
|
while (true) {
|
|
63273
|
-
var state_5 =
|
|
63326
|
+
var state_5 = _loop_19();
|
|
63274
63327
|
if (typeof state_5 === "object")
|
|
63275
63328
|
return state_5.value;
|
|
63276
63329
|
if (state_5 === "break")
|
|
@@ -63900,7 +63953,7 @@ var ts;
|
|
|
63900
63953
|
switch (mapper.kind) {
|
|
63901
63954
|
case 0 /* Simple */:
|
|
63902
63955
|
return type === mapper.source ? mapper.target : type;
|
|
63903
|
-
case 1 /* Array */:
|
|
63956
|
+
case 1 /* Array */: {
|
|
63904
63957
|
var sources = mapper.sources;
|
|
63905
63958
|
var targets = mapper.targets;
|
|
63906
63959
|
for (var i = 0; i < sources.length; i++) {
|
|
@@ -63909,25 +63962,45 @@ var ts;
|
|
|
63909
63962
|
}
|
|
63910
63963
|
}
|
|
63911
63964
|
return type;
|
|
63912
|
-
|
|
63965
|
+
}
|
|
63966
|
+
case 2 /* Deferred */: {
|
|
63967
|
+
var sources = mapper.sources;
|
|
63968
|
+
var targets = mapper.targets;
|
|
63969
|
+
for (var i = 0; i < sources.length; i++) {
|
|
63970
|
+
if (type === sources[i]) {
|
|
63971
|
+
return targets[i]();
|
|
63972
|
+
}
|
|
63973
|
+
}
|
|
63974
|
+
return type;
|
|
63975
|
+
}
|
|
63976
|
+
case 3 /* Function */:
|
|
63913
63977
|
return mapper.func(type);
|
|
63914
|
-
case
|
|
63915
|
-
case
|
|
63978
|
+
case 4 /* Composite */:
|
|
63979
|
+
case 5 /* Merged */:
|
|
63916
63980
|
var t1 = getMappedType(type, mapper.mapper1);
|
|
63917
|
-
return t1 !== type && mapper.kind ===
|
|
63981
|
+
return t1 !== type && mapper.kind === 4 /* Composite */ ? instantiateType(t1, mapper.mapper2) : getMappedType(t1, mapper.mapper2);
|
|
63918
63982
|
}
|
|
63919
63983
|
}
|
|
63984
|
+
function attachDebugPrototypeIfDebug(mapper) {
|
|
63985
|
+
if (ts.Debug.isDebugging) {
|
|
63986
|
+
return Object.setPrototypeOf(mapper, DebugTypeMapper.prototype);
|
|
63987
|
+
}
|
|
63988
|
+
return mapper;
|
|
63989
|
+
}
|
|
63920
63990
|
function makeUnaryTypeMapper(source, target) {
|
|
63921
|
-
return { kind: 0 /* Simple */, source: source, target: target };
|
|
63991
|
+
return attachDebugPrototypeIfDebug({ kind: 0 /* Simple */, source: source, target: target });
|
|
63922
63992
|
}
|
|
63923
63993
|
function makeArrayTypeMapper(sources, targets) {
|
|
63924
|
-
return { kind: 1 /* Array */, sources: sources, targets: targets };
|
|
63994
|
+
return attachDebugPrototypeIfDebug({ kind: 1 /* Array */, sources: sources, targets: targets });
|
|
63995
|
+
}
|
|
63996
|
+
function makeFunctionTypeMapper(func, debugInfo) {
|
|
63997
|
+
return attachDebugPrototypeIfDebug({ kind: 3 /* Function */, func: func, debugInfo: ts.Debug.isDebugging ? debugInfo : undefined });
|
|
63925
63998
|
}
|
|
63926
|
-
function
|
|
63927
|
-
return { kind: 2 /*
|
|
63999
|
+
function makeDeferredTypeMapper(sources, targets) {
|
|
64000
|
+
return attachDebugPrototypeIfDebug({ kind: 2 /* Deferred */, sources: sources, targets: targets });
|
|
63928
64001
|
}
|
|
63929
64002
|
function makeCompositeTypeMapper(kind, mapper1, mapper2) {
|
|
63930
|
-
return { kind: kind, mapper1: mapper1, mapper2: mapper2 };
|
|
64003
|
+
return attachDebugPrototypeIfDebug({ kind: kind, mapper1: mapper1, mapper2: mapper2 });
|
|
63931
64004
|
}
|
|
63932
64005
|
function createTypeEraser(sources) {
|
|
63933
64006
|
return createTypeMapper(sources, /*targets*/ undefined);
|
|
@@ -63937,19 +64010,20 @@ var ts;
|
|
|
63937
64010
|
* This is used during inference when instantiating type parameter defaults.
|
|
63938
64011
|
*/
|
|
63939
64012
|
function createBackreferenceMapper(context, index) {
|
|
63940
|
-
|
|
64013
|
+
var forwardInferences = context.inferences.slice(index);
|
|
64014
|
+
return createTypeMapper(ts.map(forwardInferences, function (i) { return i.typeParameter; }), ts.map(forwardInferences, function () { return unknownType; }));
|
|
63941
64015
|
}
|
|
63942
64016
|
function combineTypeMappers(mapper1, mapper2) {
|
|
63943
|
-
return mapper1 ? makeCompositeTypeMapper(
|
|
64017
|
+
return mapper1 ? makeCompositeTypeMapper(4 /* Composite */, mapper1, mapper2) : mapper2;
|
|
63944
64018
|
}
|
|
63945
64019
|
function mergeTypeMappers(mapper1, mapper2) {
|
|
63946
|
-
return mapper1 ? makeCompositeTypeMapper(
|
|
64020
|
+
return mapper1 ? makeCompositeTypeMapper(5 /* Merged */, mapper1, mapper2) : mapper2;
|
|
63947
64021
|
}
|
|
63948
64022
|
function prependTypeMapping(source, target, mapper) {
|
|
63949
|
-
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(
|
|
64023
|
+
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* Merged */, makeUnaryTypeMapper(source, target), mapper);
|
|
63950
64024
|
}
|
|
63951
64025
|
function appendTypeMapping(mapper, source, target) {
|
|
63952
|
-
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(
|
|
64026
|
+
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* Merged */, mapper, makeUnaryTypeMapper(source, target));
|
|
63953
64027
|
}
|
|
63954
64028
|
function getRestrictiveTypeParameter(tp) {
|
|
63955
64029
|
return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol),
|
|
@@ -65845,7 +65919,7 @@ var ts;
|
|
|
65845
65919
|
reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
|
|
65846
65920
|
checkTypes = reducedTarget.flags & 1048576 /* Union */ ? reducedTarget.types : [reducedTarget];
|
|
65847
65921
|
}
|
|
65848
|
-
var
|
|
65922
|
+
var _loop_20 = function (prop) {
|
|
65849
65923
|
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
|
|
65850
65924
|
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
|
|
65851
65925
|
if (reportErrors) {
|
|
@@ -65908,7 +65982,7 @@ var ts;
|
|
|
65908
65982
|
};
|
|
65909
65983
|
for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
|
|
65910
65984
|
var prop = _b[_i];
|
|
65911
|
-
var state_6 =
|
|
65985
|
+
var state_6 = _loop_20(prop);
|
|
65912
65986
|
if (typeof state_6 === "object")
|
|
65913
65987
|
return state_6.value;
|
|
65914
65988
|
}
|
|
@@ -66140,10 +66214,10 @@ var ts;
|
|
|
66140
66214
|
// We're in the middle of variance checking - integrate any unmeasurable/unreliable flags from this cached component
|
|
66141
66215
|
var saved = entry & 24 /* ReportsMask */;
|
|
66142
66216
|
if (saved & 8 /* ReportsUnmeasurable */) {
|
|
66143
|
-
instantiateType(source,
|
|
66217
|
+
instantiateType(source, reportUnmeasurableMapper);
|
|
66144
66218
|
}
|
|
66145
66219
|
if (saved & 16 /* ReportsUnreliable */) {
|
|
66146
|
-
instantiateType(source,
|
|
66220
|
+
instantiateType(source, reportUnreliableMapper);
|
|
66147
66221
|
}
|
|
66148
66222
|
}
|
|
66149
66223
|
return entry & 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */;
|
|
@@ -66569,7 +66643,7 @@ var ts;
|
|
|
66569
66643
|
}
|
|
66570
66644
|
// Report unreliable variance for type variables referenced in template literal type placeholders.
|
|
66571
66645
|
// For example, `foo-${number}` is related to `foo-${string}` even though number isn't related to string.
|
|
66572
|
-
instantiateType(source,
|
|
66646
|
+
instantiateType(source, reportUnreliableMapper);
|
|
66573
66647
|
}
|
|
66574
66648
|
if (isTypeMatchedByTemplateLiteralType(source, target)) {
|
|
66575
66649
|
return -1 /* True */;
|
|
@@ -66841,18 +66915,6 @@ var ts;
|
|
|
66841
66915
|
}
|
|
66842
66916
|
}
|
|
66843
66917
|
}
|
|
66844
|
-
function reportUnmeasurableMarkers(p) {
|
|
66845
|
-
if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
|
|
66846
|
-
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ false);
|
|
66847
|
-
}
|
|
66848
|
-
return p;
|
|
66849
|
-
}
|
|
66850
|
-
function reportUnreliableMarkers(p) {
|
|
66851
|
-
if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
|
|
66852
|
-
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ true);
|
|
66853
|
-
}
|
|
66854
|
-
return p;
|
|
66855
|
-
}
|
|
66856
66918
|
// A type [P in S]: X is related to a type [Q in T]: Y if T is related to S and X' is
|
|
66857
66919
|
// related to Y, where X' is an instantiation of X in which P is replaced with Q. Notice
|
|
66858
66920
|
// that S and T are contra-variant whereas X and Y are co-variant.
|
|
@@ -66862,7 +66924,7 @@ var ts;
|
|
|
66862
66924
|
if (modifiersRelated) {
|
|
66863
66925
|
var result_10;
|
|
66864
66926
|
var targetConstraint = getConstraintTypeFromMappedType(target);
|
|
66865
|
-
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source),
|
|
66927
|
+
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMapper : reportUnreliableMapper);
|
|
66866
66928
|
if (result_10 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
|
|
66867
66929
|
var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
|
|
66868
66930
|
if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
|
|
@@ -66916,11 +66978,11 @@ var ts;
|
|
|
66916
66978
|
// constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
|
|
66917
66979
|
var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
|
|
66918
66980
|
var matchingTypes = [];
|
|
66919
|
-
var
|
|
66981
|
+
var _loop_21 = function (combination) {
|
|
66920
66982
|
var hasMatch = false;
|
|
66921
66983
|
outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
|
|
66922
66984
|
var type = _d[_c];
|
|
66923
|
-
var
|
|
66985
|
+
var _loop_22 = function (i) {
|
|
66924
66986
|
var sourceProperty = sourcePropertiesFiltered[i];
|
|
66925
66987
|
var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
|
|
66926
66988
|
if (!targetProperty)
|
|
@@ -66936,7 +66998,7 @@ var ts;
|
|
|
66936
66998
|
}
|
|
66937
66999
|
};
|
|
66938
67000
|
for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
|
|
66939
|
-
var state_8 =
|
|
67001
|
+
var state_8 = _loop_22(i);
|
|
66940
67002
|
switch (state_8) {
|
|
66941
67003
|
case "continue-outer": continue outer;
|
|
66942
67004
|
}
|
|
@@ -66950,7 +67012,7 @@ var ts;
|
|
|
66950
67012
|
};
|
|
66951
67013
|
for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
|
|
66952
67014
|
var combination = discriminantCombinations_1[_a];
|
|
66953
|
-
var state_7 =
|
|
67015
|
+
var state_7 = _loop_21(combination);
|
|
66954
67016
|
if (typeof state_7 === "object")
|
|
66955
67017
|
return state_7.value;
|
|
66956
67018
|
}
|
|
@@ -67398,7 +67460,7 @@ var ts;
|
|
|
67398
67460
|
* See signatureAssignableTo, compareSignaturesIdentical
|
|
67399
67461
|
*/
|
|
67400
67462
|
function signatureRelatedTo(source, target, erase, reportErrors, incompatibleReporter) {
|
|
67401
|
-
return compareSignaturesRelated(erase ? getErasedSignature(source) : source, erase ? getErasedSignature(target) : target, relation === strictSubtypeRelation ? 8 /* StrictArity */ : 0, reportErrors, reportError, incompatibleReporter, isRelatedToWorker,
|
|
67463
|
+
return compareSignaturesRelated(erase ? getErasedSignature(source) : source, erase ? getErasedSignature(target) : target, relation === strictSubtypeRelation ? 8 /* StrictArity */ : 0, reportErrors, reportError, incompatibleReporter, isRelatedToWorker, reportUnreliableMapper);
|
|
67402
67464
|
}
|
|
67403
67465
|
function signaturesIdenticalTo(source, target, kind) {
|
|
67404
67466
|
var sourceSignatures = getSignaturesOfType(source, kind);
|
|
@@ -67657,7 +67719,7 @@ var ts;
|
|
|
67657
67719
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
|
|
67658
67720
|
links.variances = ts.emptyArray;
|
|
67659
67721
|
var variances = [];
|
|
67660
|
-
var
|
|
67722
|
+
var _loop_23 = function (tp) {
|
|
67661
67723
|
var modifiers = getVarianceModifiers(tp);
|
|
67662
67724
|
var variance = modifiers & 65536 /* Out */ ?
|
|
67663
67725
|
modifiers & 32768 /* In */ ? 0 /* Invariant */ : 1 /* Covariant */ :
|
|
@@ -67693,12 +67755,12 @@ var ts;
|
|
|
67693
67755
|
}
|
|
67694
67756
|
variances.push(variance);
|
|
67695
67757
|
};
|
|
67696
|
-
for (var _i = 0,
|
|
67697
|
-
var tp =
|
|
67698
|
-
|
|
67758
|
+
for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
|
|
67759
|
+
var tp = typeParameters_2[_i];
|
|
67760
|
+
_loop_23(tp);
|
|
67699
67761
|
}
|
|
67700
67762
|
links.variances = variances;
|
|
67701
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
67763
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
|
|
67702
67764
|
}
|
|
67703
67765
|
return links.variances;
|
|
67704
67766
|
}
|
|
@@ -68690,27 +68752,29 @@ var ts;
|
|
|
68690
68752
|
signature: signature,
|
|
68691
68753
|
flags: flags,
|
|
68692
68754
|
compareTypes: compareTypes,
|
|
68693
|
-
mapper:
|
|
68694
|
-
nonFixingMapper:
|
|
68755
|
+
mapper: reportUnmeasurableMapper,
|
|
68756
|
+
nonFixingMapper: reportUnmeasurableMapper,
|
|
68695
68757
|
};
|
|
68758
|
+
context.mapper = makeFixingMapperForContext(context);
|
|
68759
|
+
context.nonFixingMapper = makeNonFixingMapperForContext(context);
|
|
68696
68760
|
return context;
|
|
68697
68761
|
}
|
|
68698
|
-
function
|
|
68699
|
-
|
|
68700
|
-
|
|
68701
|
-
|
|
68702
|
-
|
|
68703
|
-
|
|
68704
|
-
|
|
68705
|
-
|
|
68706
|
-
inferFromIntraExpressionSites(context);
|
|
68707
|
-
clearCachedInferences(inferences);
|
|
68708
|
-
inference.isFixed = true;
|
|
68709
|
-
}
|
|
68710
|
-
return getInferredType(context, i);
|
|
68762
|
+
function makeFixingMapperForContext(context) {
|
|
68763
|
+
return makeDeferredTypeMapper(ts.map(context.inferences, function (i) { return i.typeParameter; }), ts.map(context.inferences, function (inference, i) { return function () {
|
|
68764
|
+
if (!inference.isFixed) {
|
|
68765
|
+
// Before we commit to a particular inference (and thus lock out any further inferences),
|
|
68766
|
+
// we infer from any intra-expression inference sites we have collected.
|
|
68767
|
+
inferFromIntraExpressionSites(context);
|
|
68768
|
+
clearCachedInferences(context.inferences);
|
|
68769
|
+
inference.isFixed = true;
|
|
68711
68770
|
}
|
|
68712
|
-
|
|
68713
|
-
|
|
68771
|
+
return getInferredType(context, i);
|
|
68772
|
+
}; }));
|
|
68773
|
+
}
|
|
68774
|
+
function makeNonFixingMapperForContext(context) {
|
|
68775
|
+
return makeDeferredTypeMapper(ts.map(context.inferences, function (i) { return i.typeParameter; }), ts.map(context.inferences, function (_, i) { return function () {
|
|
68776
|
+
return getInferredType(context, i);
|
|
68777
|
+
}; }));
|
|
68714
68778
|
}
|
|
68715
68779
|
function clearCachedInferences(inferences) {
|
|
68716
68780
|
for (var _i = 0, inferences_1 = inferences; _i < inferences_1.length; _i++) {
|
|
@@ -69630,7 +69694,7 @@ var ts;
|
|
|
69630
69694
|
// upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
|
|
69631
69695
|
// succeed. That would be a pointless and confusing outcome.
|
|
69632
69696
|
if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
|
|
69633
|
-
var
|
|
69697
|
+
var _loop_24 = function (i) {
|
|
69634
69698
|
var source_1 = matches ? matches[i] : neverType;
|
|
69635
69699
|
var target_3 = types[i];
|
|
69636
69700
|
// If we are inferring from a string literal type to a type variable whose constraint includes one of the
|
|
@@ -69680,7 +69744,7 @@ var ts;
|
|
|
69680
69744
|
inferFromTypes(source_1, target_3);
|
|
69681
69745
|
};
|
|
69682
69746
|
for (var i = 0; i < types.length; i++) {
|
|
69683
|
-
|
|
69747
|
+
_loop_24(i);
|
|
69684
69748
|
}
|
|
69685
69749
|
}
|
|
69686
69750
|
}
|
|
@@ -70198,7 +70262,7 @@ var ts;
|
|
|
70198
70262
|
function mapTypesByKeyProperty(types, name) {
|
|
70199
70263
|
var map = new ts.Map();
|
|
70200
70264
|
var count = 0;
|
|
70201
|
-
var
|
|
70265
|
+
var _loop_25 = function (type) {
|
|
70202
70266
|
if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
70203
70267
|
var discriminant = getTypeOfPropertyOfType(type, name);
|
|
70204
70268
|
if (discriminant) {
|
|
@@ -70224,7 +70288,7 @@ var ts;
|
|
|
70224
70288
|
};
|
|
70225
70289
|
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
|
|
70226
70290
|
var type = types_15[_i];
|
|
70227
|
-
var state_9 =
|
|
70291
|
+
var state_9 = _loop_25(type);
|
|
70228
70292
|
if (typeof state_9 === "object")
|
|
70229
70293
|
return state_9.value;
|
|
70230
70294
|
}
|
|
@@ -73571,8 +73635,8 @@ var ts;
|
|
|
73571
73635
|
var conditional = node.parent;
|
|
73572
73636
|
return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional, contextFlags) : undefined;
|
|
73573
73637
|
}
|
|
73574
|
-
function getContextualTypeForChildJsxExpression(node, child) {
|
|
73575
|
-
var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName);
|
|
73638
|
+
function getContextualTypeForChildJsxExpression(node, child, contextFlags) {
|
|
73639
|
+
var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName, contextFlags);
|
|
73576
73640
|
// JSX expression is in children of JSX Element, we will look for an "children" attribute (we get the name from JSX.ElementAttributesProperty)
|
|
73577
73641
|
var jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
|
|
73578
73642
|
if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) {
|
|
@@ -73590,27 +73654,27 @@ var ts;
|
|
|
73590
73654
|
}
|
|
73591
73655
|
}, /*noReductions*/ true));
|
|
73592
73656
|
}
|
|
73593
|
-
function getContextualTypeForJsxExpression(node) {
|
|
73657
|
+
function getContextualTypeForJsxExpression(node, contextFlags) {
|
|
73594
73658
|
var exprParent = node.parent;
|
|
73595
73659
|
return ts.isJsxAttributeLike(exprParent)
|
|
73596
|
-
? getContextualType(node)
|
|
73660
|
+
? getContextualType(node, contextFlags)
|
|
73597
73661
|
: ts.isJsxElement(exprParent)
|
|
73598
|
-
? getContextualTypeForChildJsxExpression(exprParent, node)
|
|
73662
|
+
? getContextualTypeForChildJsxExpression(exprParent, node, contextFlags)
|
|
73599
73663
|
: undefined;
|
|
73600
73664
|
}
|
|
73601
|
-
function getContextualTypeForJsxAttribute(attribute) {
|
|
73665
|
+
function getContextualTypeForJsxAttribute(attribute, contextFlags) {
|
|
73602
73666
|
// When we trying to resolve JsxOpeningLikeElement as a stateless function element, we will already give its attributes a contextual type
|
|
73603
73667
|
// which is a type of the parameter of the signature we are trying out.
|
|
73604
73668
|
// If there is no contextual type (e.g. we are trying to resolve stateful component), get attributes type from resolving element's tagName
|
|
73605
73669
|
if (ts.isJsxAttribute(attribute)) {
|
|
73606
|
-
var attributesType = getApparentTypeOfContextualType(attribute.parent);
|
|
73670
|
+
var attributesType = getApparentTypeOfContextualType(attribute.parent, contextFlags);
|
|
73607
73671
|
if (!attributesType || isTypeAny(attributesType)) {
|
|
73608
73672
|
return undefined;
|
|
73609
73673
|
}
|
|
73610
73674
|
return getTypeOfPropertyOfContextualType(attributesType, attribute.name.escapedText);
|
|
73611
73675
|
}
|
|
73612
73676
|
else {
|
|
73613
|
-
return getContextualType(attribute.parent);
|
|
73677
|
+
return getContextualType(attribute.parent, contextFlags);
|
|
73614
73678
|
}
|
|
73615
73679
|
}
|
|
73616
73680
|
// Return true if the given expression is possibly a discriminant value. We limit the kinds of
|
|
@@ -73771,10 +73835,10 @@ var ts;
|
|
|
73771
73835
|
case 271 /* ExportAssignment */:
|
|
73772
73836
|
return tryGetTypeFromEffectiveTypeNode(parent);
|
|
73773
73837
|
case 288 /* JsxExpression */:
|
|
73774
|
-
return getContextualTypeForJsxExpression(parent);
|
|
73838
|
+
return getContextualTypeForJsxExpression(parent, contextFlags);
|
|
73775
73839
|
case 285 /* JsxAttribute */:
|
|
73776
73840
|
case 287 /* JsxSpreadAttribute */:
|
|
73777
|
-
return getContextualTypeForJsxAttribute(parent);
|
|
73841
|
+
return getContextualTypeForJsxAttribute(parent, contextFlags);
|
|
73778
73842
|
case 280 /* JsxOpeningElement */:
|
|
73779
73843
|
case 279 /* JsxSelfClosingElement */:
|
|
73780
73844
|
return getContextualJsxElementAttributesType(parent, contextFlags);
|
|
@@ -76573,7 +76637,7 @@ var ts;
|
|
|
76573
76637
|
if (spreadIndex >= 0) {
|
|
76574
76638
|
// Create synthetic arguments from spreads of tuple types.
|
|
76575
76639
|
var effectiveArgs_1 = args.slice(0, spreadIndex);
|
|
76576
|
-
var
|
|
76640
|
+
var _loop_26 = function (i) {
|
|
76577
76641
|
var arg = args[i];
|
|
76578
76642
|
// We can call checkExpressionCached because spread expressions never have a contextual type.
|
|
76579
76643
|
var spreadType = arg.kind === 225 /* SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
|
|
@@ -76590,7 +76654,7 @@ var ts;
|
|
|
76590
76654
|
}
|
|
76591
76655
|
};
|
|
76592
76656
|
for (var i = spreadIndex; i < args.length; i++) {
|
|
76593
|
-
|
|
76657
|
+
_loop_26(i);
|
|
76594
76658
|
}
|
|
76595
76659
|
return effectiveArgs_1;
|
|
76596
76660
|
}
|
|
@@ -76919,7 +76983,7 @@ var ts;
|
|
|
76919
76983
|
var min_3 = Number.MAX_VALUE;
|
|
76920
76984
|
var minIndex = 0;
|
|
76921
76985
|
var i_1 = 0;
|
|
76922
|
-
var
|
|
76986
|
+
var _loop_27 = function (c) {
|
|
76923
76987
|
var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
|
|
76924
76988
|
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2);
|
|
76925
76989
|
if (diags_2) {
|
|
@@ -76937,7 +77001,7 @@ var ts;
|
|
|
76937
77001
|
};
|
|
76938
77002
|
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
|
|
76939
77003
|
var c = candidatesForArgumentError_1[_a];
|
|
76940
|
-
|
|
77004
|
+
_loop_27(c);
|
|
76941
77005
|
}
|
|
76942
77006
|
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
|
|
76943
77007
|
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
|
|
@@ -77095,7 +77159,7 @@ var ts;
|
|
|
77095
77159
|
}
|
|
77096
77160
|
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
|
|
77097
77161
|
var parameters = [];
|
|
77098
|
-
var
|
|
77162
|
+
var _loop_28 = function (i) {
|
|
77099
77163
|
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
|
|
77100
77164
|
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
|
|
77101
77165
|
i < s.parameters.length ? s.parameters[i] : undefined; });
|
|
@@ -77103,7 +77167,7 @@ var ts;
|
|
|
77103
77167
|
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
|
|
77104
77168
|
};
|
|
77105
77169
|
for (var i = 0; i < maxNonRestParam; i++) {
|
|
77106
|
-
|
|
77170
|
+
_loop_28(i);
|
|
77107
77171
|
}
|
|
77108
77172
|
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
|
|
77109
77173
|
var flags = 0 /* None */;
|
|
@@ -80456,8 +80520,8 @@ var ts;
|
|
|
80456
80520
|
var result = [];
|
|
80457
80521
|
var oldTypeParameters;
|
|
80458
80522
|
var newTypeParameters;
|
|
80459
|
-
for (var _i = 0,
|
|
80460
|
-
var tp =
|
|
80523
|
+
for (var _i = 0, typeParameters_3 = typeParameters; _i < typeParameters_3.length; _i++) {
|
|
80524
|
+
var tp = typeParameters_3[_i];
|
|
80461
80525
|
var name = tp.symbol.escapedName;
|
|
80462
80526
|
if (hasTypeParameterByName(context.inferredTypeParameters, name) || hasTypeParameterByName(result, name)) {
|
|
80463
80527
|
var newName = getUniqueTypeParameterName(ts.concatenate(context.inferredTypeParameters, result), name);
|
|
@@ -80779,12 +80843,14 @@ var ts;
|
|
|
80779
80843
|
error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
80780
80844
|
}
|
|
80781
80845
|
else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
80846
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
80782
80847
|
var source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck);
|
|
80783
80848
|
var target = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSuperTypeForCheck : markerSubTypeForCheck);
|
|
80784
80849
|
var saveVarianceTypeParameter = typeParameter;
|
|
80785
80850
|
varianceTypeParameter = typeParameter;
|
|
80786
80851
|
checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
|
|
80787
80852
|
varianceTypeParameter = saveVarianceTypeParameter;
|
|
80853
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
80788
80854
|
}
|
|
80789
80855
|
}
|
|
80790
80856
|
}
|
|
@@ -81134,7 +81200,7 @@ var ts;
|
|
|
81134
81200
|
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
|
|
81135
81201
|
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
|
|
81136
81202
|
var indexSignatureMap_1 = new ts.Map();
|
|
81137
|
-
var
|
|
81203
|
+
var _loop_29 = function (declaration) {
|
|
81138
81204
|
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
|
|
81139
81205
|
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
|
|
81140
81206
|
var entry = indexSignatureMap_1.get(getTypeId(type));
|
|
@@ -81149,7 +81215,7 @@ var ts;
|
|
|
81149
81215
|
};
|
|
81150
81216
|
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
|
|
81151
81217
|
var declaration = _a[_i];
|
|
81152
|
-
|
|
81218
|
+
_loop_29(declaration);
|
|
81153
81219
|
}
|
|
81154
81220
|
indexSignatureMap_1.forEach(function (entry) {
|
|
81155
81221
|
if (entry.declarations.length > 1) {
|
|
@@ -81372,6 +81438,12 @@ var ts;
|
|
|
81372
81438
|
function checkMissingDeclaration(node) {
|
|
81373
81439
|
checkDecorators(node);
|
|
81374
81440
|
}
|
|
81441
|
+
function getEffectiveTypeArgumentAtIndex(node, typeParameters, index) {
|
|
81442
|
+
if (index < typeParameters.length) {
|
|
81443
|
+
return getTypeFromTypeNode(node.typeArguments[index]);
|
|
81444
|
+
}
|
|
81445
|
+
return getEffectiveTypeArguments(node, typeParameters)[index];
|
|
81446
|
+
}
|
|
81375
81447
|
function getEffectiveTypeArguments(node, typeParameters) {
|
|
81376
81448
|
return fillMissingTypeArguments(ts.map(node.typeArguments, getTypeFromTypeNode), typeParameters, getMinTypeArgumentCount(typeParameters), ts.isInJSFile(node));
|
|
81377
81449
|
}
|
|
@@ -82180,8 +82252,17 @@ var ts;
|
|
|
82180
82252
|
}
|
|
82181
82253
|
// For a union, get a union of the awaited types of each constituent.
|
|
82182
82254
|
if (type.flags & 1048576 /* Union */) {
|
|
82255
|
+
if (awaitedTypeStack.lastIndexOf(type.id) >= 0) {
|
|
82256
|
+
if (errorNode) {
|
|
82257
|
+
error(errorNode, ts.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
82258
|
+
}
|
|
82259
|
+
return undefined;
|
|
82260
|
+
}
|
|
82183
82261
|
var mapper = errorNode ? function (constituentType) { return getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0); } : getAwaitedTypeNoAlias;
|
|
82184
|
-
|
|
82262
|
+
awaitedTypeStack.push(type.id);
|
|
82263
|
+
var mapped = mapType(type, mapper);
|
|
82264
|
+
awaitedTypeStack.pop();
|
|
82265
|
+
return typeAsAwaitable.awaitedTypeOfType = mapped;
|
|
82185
82266
|
}
|
|
82186
82267
|
var thisTypeForErrorOut = { value: undefined };
|
|
82187
82268
|
var promisedType = getPromisedTypeOfPromise(type, /*errorNode*/ undefined, thisTypeForErrorOut);
|
|
@@ -82830,8 +82911,8 @@ var ts;
|
|
|
82830
82911
|
return;
|
|
82831
82912
|
var typeParameters = ts.getEffectiveTypeParameterDeclarations(node);
|
|
82832
82913
|
var seenParentsWithEveryUnused = new ts.Set();
|
|
82833
|
-
for (var _i = 0,
|
|
82834
|
-
var typeParameter =
|
|
82914
|
+
for (var _i = 0, typeParameters_4 = typeParameters; _i < typeParameters_4.length; _i++) {
|
|
82915
|
+
var typeParameter = typeParameters_4[_i];
|
|
82835
82916
|
if (!isTypeParameterUnused(typeParameter))
|
|
82836
82917
|
continue;
|
|
82837
82918
|
var name = ts.idText(typeParameter.name);
|
|
@@ -84650,7 +84731,7 @@ var ts;
|
|
|
84650
84731
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84651
84732
|
var localPropDeclaration = declaration && declaration.kind === 221 /* BinaryExpression */ ||
|
|
84652
84733
|
name && name.kind === 162 /* ComputedPropertyName */ || getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
84653
|
-
var
|
|
84734
|
+
var _loop_30 = function (info) {
|
|
84654
84735
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
84655
84736
|
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
|
|
84656
84737
|
// in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
|
|
@@ -84663,7 +84744,7 @@ var ts;
|
|
|
84663
84744
|
};
|
|
84664
84745
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
84665
84746
|
var info = indexInfos_9[_i];
|
|
84666
|
-
|
|
84747
|
+
_loop_30(info);
|
|
84667
84748
|
}
|
|
84668
84749
|
}
|
|
84669
84750
|
function checkIndexConstraintForIndexSignature(type, checkInfo) {
|
|
@@ -84671,7 +84752,7 @@ var ts;
|
|
|
84671
84752
|
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
|
|
84672
84753
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84673
84754
|
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
|
|
84674
|
-
var
|
|
84755
|
+
var _loop_31 = function (info) {
|
|
84675
84756
|
if (info === checkInfo)
|
|
84676
84757
|
return "continue";
|
|
84677
84758
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
@@ -84686,7 +84767,7 @@ var ts;
|
|
|
84686
84767
|
};
|
|
84687
84768
|
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
84688
84769
|
var info = indexInfos_10[_i];
|
|
84689
|
-
|
|
84770
|
+
_loop_31(info);
|
|
84690
84771
|
}
|
|
84691
84772
|
}
|
|
84692
84773
|
function checkTypeNameIsReserved(name, message) {
|
|
@@ -85006,7 +85087,7 @@ var ts;
|
|
|
85006
85087
|
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
85007
85088
|
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
85008
85089
|
var baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
85009
|
-
var
|
|
85090
|
+
var _loop_32 = function (member) {
|
|
85010
85091
|
if (ts.hasAmbientModifier(member)) {
|
|
85011
85092
|
return "continue";
|
|
85012
85093
|
}
|
|
@@ -85023,7 +85104,7 @@ var ts;
|
|
|
85023
85104
|
};
|
|
85024
85105
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
85025
85106
|
var member = _a[_i];
|
|
85026
|
-
|
|
85107
|
+
_loop_32(member);
|
|
85027
85108
|
}
|
|
85028
85109
|
}
|
|
85029
85110
|
/**
|
|
@@ -85111,7 +85192,7 @@ var ts;
|
|
|
85111
85192
|
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
|
|
85112
85193
|
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
|
|
85113
85194
|
var issuedMemberError = false;
|
|
85114
|
-
var
|
|
85195
|
+
var _loop_33 = function (member) {
|
|
85115
85196
|
if (ts.isStatic(member)) {
|
|
85116
85197
|
return "continue";
|
|
85117
85198
|
}
|
|
@@ -85130,7 +85211,7 @@ var ts;
|
|
|
85130
85211
|
};
|
|
85131
85212
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
85132
85213
|
var member = _a[_i];
|
|
85133
|
-
|
|
85214
|
+
_loop_33(member);
|
|
85134
85215
|
}
|
|
85135
85216
|
if (!issuedMemberError) {
|
|
85136
85217
|
// check again with diagnostics to generate a less-specific error
|
|
@@ -85201,7 +85282,7 @@ var ts;
|
|
|
85201
85282
|
var _a, _b, _c, _d;
|
|
85202
85283
|
// NOTE: assignability is checked in checkClassDeclaration
|
|
85203
85284
|
var baseProperties = getPropertiesOfType(baseType);
|
|
85204
|
-
var
|
|
85285
|
+
var _loop_34 = function (baseProperty) {
|
|
85205
85286
|
var base = getTargetSymbol(baseProperty);
|
|
85206
85287
|
if (base.flags & 4194304 /* Prototype */) {
|
|
85207
85288
|
return "continue";
|
|
@@ -85311,7 +85392,7 @@ var ts;
|
|
|
85311
85392
|
};
|
|
85312
85393
|
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
|
|
85313
85394
|
var baseProperty = baseProperties_1[_i];
|
|
85314
|
-
var state_10 =
|
|
85395
|
+
var state_10 = _loop_34(baseProperty);
|
|
85315
85396
|
switch (state_10) {
|
|
85316
85397
|
case "continue-basePropertyCheck": continue basePropertyCheck;
|
|
85317
85398
|
}
|
|
@@ -111826,7 +111907,6 @@ var ts;
|
|
|
111826
111907
|
if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
|
|
111827
111908
|
// Update the output signature
|
|
111828
111909
|
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, createHash, changedDtsData);
|
|
111829
|
-
newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
|
|
111830
111910
|
}
|
|
111831
111911
|
// Update sourceFileInfo
|
|
111832
111912
|
var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
|
|
@@ -119631,7 +119711,7 @@ var ts;
|
|
|
119631
119711
|
}
|
|
119632
119712
|
}
|
|
119633
119713
|
function processTypeReferenceDirective(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) {
|
|
119634
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!
|
|
119714
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : undefined });
|
|
119635
119715
|
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason);
|
|
119636
119716
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
119637
119717
|
}
|
|
@@ -121213,7 +121293,7 @@ var ts;
|
|
|
121213
121293
|
state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
|
|
121214
121294
|
}
|
|
121215
121295
|
state.changedFilesSet = new ts.Set();
|
|
121216
|
-
state.
|
|
121296
|
+
state.latestChangedDtsFile = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.latestChangedDtsFile : undefined;
|
|
121217
121297
|
var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
|
|
121218
121298
|
var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
|
|
121219
121299
|
var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
|
|
@@ -121337,7 +121417,7 @@ var ts;
|
|
|
121337
121417
|
programEmitComplete: state.programEmitComplete,
|
|
121338
121418
|
emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
|
|
121339
121419
|
outSignature: state.outSignature,
|
|
121340
|
-
|
|
121420
|
+
latestChangedDtsFile: state.latestChangedDtsFile,
|
|
121341
121421
|
hasChangedEmitSignature: state.hasChangedEmitSignature,
|
|
121342
121422
|
changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
|
|
121343
121423
|
};
|
|
@@ -121350,7 +121430,7 @@ var ts;
|
|
|
121350
121430
|
state.programEmitComplete = savedEmitState.programEmitComplete;
|
|
121351
121431
|
state.emitSignatures = savedEmitState.emitSignatures;
|
|
121352
121432
|
state.outSignature = savedEmitState.outSignature;
|
|
121353
|
-
state.
|
|
121433
|
+
state.latestChangedDtsFile = savedEmitState.latestChangedDtsFile;
|
|
121354
121434
|
state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
|
|
121355
121435
|
if (savedEmitState.changedFilesSet)
|
|
121356
121436
|
state.changedFilesSet = savedEmitState.changedFilesSet;
|
|
@@ -121664,14 +121744,14 @@ var ts;
|
|
|
121664
121744
|
/**
|
|
121665
121745
|
* Gets the program information to be emitted in buildInfo so that we can use it to create new program
|
|
121666
121746
|
*/
|
|
121667
|
-
function getProgramBuildInfo(state, getCanonicalFileName
|
|
121747
|
+
function getProgramBuildInfo(state, getCanonicalFileName) {
|
|
121668
121748
|
var outFilePath = ts.outFile(state.compilerOptions);
|
|
121669
121749
|
if (outFilePath && !state.compilerOptions.composite)
|
|
121670
121750
|
return;
|
|
121671
121751
|
var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
|
|
121672
121752
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
|
|
121673
|
-
//
|
|
121674
|
-
|
|
121753
|
+
// Convert the file name to Path here if we set the fileName instead to optimize multiple d.ts file emits and having to compute Canonical path
|
|
121754
|
+
var latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : undefined;
|
|
121675
121755
|
if (outFilePath) {
|
|
121676
121756
|
var fileNames_1 = [];
|
|
121677
121757
|
var fileInfos_1 = [];
|
|
@@ -121687,7 +121767,7 @@ var ts;
|
|
|
121687
121767
|
fileInfos: fileInfos_1,
|
|
121688
121768
|
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
|
|
121689
121769
|
outSignature: state.outSignature,
|
|
121690
|
-
|
|
121770
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
121691
121771
|
};
|
|
121692
121772
|
return result_15;
|
|
121693
121773
|
}
|
|
@@ -121789,7 +121869,7 @@ var ts;
|
|
|
121789
121869
|
affectedFilesPendingEmit: affectedFilesPendingEmit,
|
|
121790
121870
|
changeFileSet: changeFileSet,
|
|
121791
121871
|
emitSignatures: emitSignatures,
|
|
121792
|
-
|
|
121872
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
121793
121873
|
};
|
|
121794
121874
|
return result;
|
|
121795
121875
|
function relativeToBuildInfoEnsuringAbsolutePath(path) {
|
|
@@ -121957,7 +122037,7 @@ var ts;
|
|
|
121957
122037
|
*/
|
|
121958
122038
|
var computeHash = ts.maybeBind(host, host.createHash);
|
|
121959
122039
|
var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
|
|
121960
|
-
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName
|
|
122040
|
+
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
|
|
121961
122041
|
// To ensure that we arent storing any references to old program or new program without state
|
|
121962
122042
|
newProgram = undefined; // TODO: GH#18217
|
|
121963
122043
|
oldProgram = undefined;
|
|
@@ -121967,6 +122047,7 @@ var ts;
|
|
|
121967
122047
|
builderProgram.getState = getState;
|
|
121968
122048
|
builderProgram.saveEmitState = function () { return backupBuilderProgramEmitState(state); };
|
|
121969
122049
|
builderProgram.restoreEmitState = function (saved) { return restoreBuilderProgramEmitState(state, saved); };
|
|
122050
|
+
builderProgram.hasChangedEmitSignature = function () { return !!state.hasChangedEmitSignature; };
|
|
121970
122051
|
builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
|
|
121971
122052
|
builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
|
|
121972
122053
|
builderProgram.emit = emit;
|
|
@@ -122074,18 +122155,22 @@ var ts;
|
|
|
122074
122155
|
var filePath = sourceFiles[0].resolvedPath;
|
|
122075
122156
|
var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath);
|
|
122076
122157
|
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text, computeHash, data));
|
|
122077
|
-
if
|
|
122078
|
-
|
|
122079
|
-
|
|
122080
|
-
|
|
122158
|
+
// Dont write dts files if they didn't change
|
|
122159
|
+
if (emitSignature === oldSignature)
|
|
122160
|
+
return;
|
|
122161
|
+
((_g = state.emitSignatures) !== null && _g !== void 0 ? _g : (state.emitSignatures = new ts.Map())).set(filePath, emitSignature);
|
|
122162
|
+
state.hasChangedEmitSignature = true;
|
|
122163
|
+
state.latestChangedDtsFile = fileName;
|
|
122081
122164
|
}
|
|
122082
122165
|
}
|
|
122083
122166
|
else if (state.compilerOptions.composite) {
|
|
122084
122167
|
var newSignature = computeSignature(text, computeHash, data);
|
|
122085
|
-
if
|
|
122086
|
-
|
|
122087
|
-
|
|
122088
|
-
|
|
122168
|
+
// Dont write dts files if they didn't change
|
|
122169
|
+
if (newSignature === state.outSignature)
|
|
122170
|
+
return;
|
|
122171
|
+
state.outSignature = newSignature;
|
|
122172
|
+
state.hasChangedEmitSignature = true;
|
|
122173
|
+
state.latestChangedDtsFile = fileName;
|
|
122089
122174
|
}
|
|
122090
122175
|
}
|
|
122091
122176
|
if (writeFile)
|
|
@@ -122248,11 +122333,12 @@ var ts;
|
|
|
122248
122333
|
var state;
|
|
122249
122334
|
var filePaths;
|
|
122250
122335
|
var filePathsSetList;
|
|
122336
|
+
var latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : undefined;
|
|
122251
122337
|
if (isProgramBundleEmitBuildInfo(program)) {
|
|
122252
122338
|
state = {
|
|
122253
122339
|
fileInfos: new ts.Map(),
|
|
122254
122340
|
compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
|
|
122255
|
-
|
|
122341
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
122256
122342
|
outSignature: program.outSignature,
|
|
122257
122343
|
};
|
|
122258
122344
|
}
|
|
@@ -122285,7 +122371,7 @@ var ts;
|
|
|
122285
122371
|
affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
|
|
122286
122372
|
affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
|
|
122287
122373
|
changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
|
|
122288
|
-
|
|
122374
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
122289
122375
|
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
|
122290
122376
|
};
|
|
122291
122377
|
}
|
|
@@ -122312,6 +122398,7 @@ var ts;
|
|
|
122312
122398
|
getSemanticDiagnosticsOfNextAffectedFile: ts.notImplemented,
|
|
122313
122399
|
emitBuildInfo: ts.notImplemented,
|
|
122314
122400
|
close: ts.noop,
|
|
122401
|
+
hasChangedEmitSignature: ts.returnFalse,
|
|
122315
122402
|
};
|
|
122316
122403
|
function toPath(path) {
|
|
122317
122404
|
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
@@ -123626,7 +123713,7 @@ var ts;
|
|
|
123626
123713
|
});
|
|
123627
123714
|
// Sort by paths closest to importing file Name directory
|
|
123628
123715
|
var sortedPaths = [];
|
|
123629
|
-
var
|
|
123716
|
+
var _loop_35 = function (directory) {
|
|
123630
123717
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
123631
123718
|
var pathsInDirectory;
|
|
123632
123719
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -123650,7 +123737,7 @@ var ts;
|
|
|
123650
123737
|
};
|
|
123651
123738
|
var out_directory_1;
|
|
123652
123739
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
123653
|
-
var state_11 =
|
|
123740
|
+
var state_11 = _loop_35(directory);
|
|
123654
123741
|
directory = out_directory_1;
|
|
123655
123742
|
if (state_11 === "break")
|
|
123656
123743
|
break;
|
|
@@ -124494,7 +124581,6 @@ var ts;
|
|
|
124494
124581
|
readDirectory: ts.maybeBind(host, host.readDirectory),
|
|
124495
124582
|
disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
|
|
124496
124583
|
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
|
|
124497
|
-
now: ts.maybeBind(host, host.now),
|
|
124498
124584
|
};
|
|
124499
124585
|
function writeFile(fileName, text, writeByteOrderMark, onError) {
|
|
124500
124586
|
try {
|
|
@@ -124652,7 +124738,6 @@ var ts;
|
|
|
124652
124738
|
host.createHash = ts.maybeBind(system, system.createHash);
|
|
124653
124739
|
host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
|
|
124654
124740
|
host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
|
|
124655
|
-
host.now = ts.maybeBind(system, system.now);
|
|
124656
124741
|
ts.setGetSourceFileAsHashVersioned(host, system);
|
|
124657
124742
|
ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
|
|
124658
124743
|
return host;
|
|
@@ -125980,8 +126065,7 @@ var ts;
|
|
|
125980
126065
|
}
|
|
125981
126066
|
// Actual Emit
|
|
125982
126067
|
var host = state.host, compilerHost = state.compilerHost;
|
|
125983
|
-
var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
|
|
125984
|
-
var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
|
|
126068
|
+
var resultFlags = ((_d = program.hasChangedEmitSignature) === null || _d === void 0 ? void 0 : _d.call(program)) ? BuildResultFlags.None : BuildResultFlags.DeclarationOutputUnchanged;
|
|
125985
126069
|
var emitterDiagnostics = ts.createDiagnosticCollection();
|
|
125986
126070
|
var emittedOutputs = new ts.Map();
|
|
125987
126071
|
var options = program.getCompilerOptions();
|
|
@@ -125989,17 +126073,11 @@ var ts;
|
|
|
125989
126073
|
var outputTimeStampMap;
|
|
125990
126074
|
var now;
|
|
125991
126075
|
outputFiles.forEach(function (_a) {
|
|
125992
|
-
var _b, _c;
|
|
125993
126076
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
125994
126077
|
var path = toPath(state, name);
|
|
125995
126078
|
emittedOutputs.set(toPath(state, name), name);
|
|
125996
|
-
if (buildInfo)
|
|
125997
|
-
setBuildInfo(state, buildInfo, projectPath, options);
|
|
125998
|
-
// Buildinfo has information on when last dts change time
|
|
125999
|
-
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
|
|
126000
|
-
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
|
126001
|
-
}
|
|
126002
|
-
}
|
|
126079
|
+
if (buildInfo)
|
|
126080
|
+
setBuildInfo(state, buildInfo, projectPath, options, resultFlags);
|
|
126003
126081
|
ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
|
|
126004
126082
|
if (!isIncremental && state.watch) {
|
|
126005
126083
|
(outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
|
|
@@ -126013,7 +126091,7 @@ var ts;
|
|
|
126013
126091
|
ts.Debug.assert(step === BuildStep.EmitBuildInfo);
|
|
126014
126092
|
var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
|
|
126015
126093
|
if (data === null || data === void 0 ? void 0 : data.buildInfo)
|
|
126016
|
-
setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
|
|
126094
|
+
setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions(), BuildResultFlags.DeclarationOutputUnchanged);
|
|
126017
126095
|
if (writeFileCallback)
|
|
126018
126096
|
writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
126019
126097
|
else
|
|
@@ -126046,7 +126124,6 @@ var ts;
|
|
|
126046
126124
|
state.diagnostics.delete(projectPath);
|
|
126047
126125
|
state.projectStatus.set(projectPath, {
|
|
126048
126126
|
type: ts.UpToDateStatusType.UpToDate,
|
|
126049
|
-
newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
|
|
126050
126127
|
oldestOutputFileName: oldestOutputFileName
|
|
126051
126128
|
});
|
|
126052
126129
|
afterProgramDone(state, program, config);
|
|
@@ -126088,10 +126165,10 @@ var ts;
|
|
|
126088
126165
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
126089
126166
|
emittedOutputs.set(toPath(state, name), name);
|
|
126090
126167
|
if (buildInfo) {
|
|
126091
|
-
|
|
126092
|
-
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
|
|
126168
|
+
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) {
|
|
126093
126169
|
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
|
126094
126170
|
}
|
|
126171
|
+
setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags);
|
|
126095
126172
|
}
|
|
126096
126173
|
ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
|
|
126097
126174
|
});
|
|
@@ -126350,15 +126427,23 @@ var ts;
|
|
|
126350
126427
|
state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
|
|
126351
126428
|
return result;
|
|
126352
126429
|
}
|
|
126353
|
-
function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
|
|
126430
|
+
function setBuildInfo(state, buildInfo, resolvedConfigPath, options, resultFlags) {
|
|
126354
126431
|
var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
|
|
126355
126432
|
var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
|
|
126433
|
+
var modifiedTime = getCurrentTime(state.host);
|
|
126356
126434
|
if (existing) {
|
|
126357
126435
|
existing.buildInfo = buildInfo;
|
|
126358
|
-
existing.modifiedTime =
|
|
126436
|
+
existing.modifiedTime = modifiedTime;
|
|
126437
|
+
if (!(resultFlags & BuildResultFlags.DeclarationOutputUnchanged))
|
|
126438
|
+
existing.latestChangedDtsTime = modifiedTime;
|
|
126359
126439
|
}
|
|
126360
126440
|
else {
|
|
126361
|
-
state.buildInfoCache.set(resolvedConfigPath, {
|
|
126441
|
+
state.buildInfoCache.set(resolvedConfigPath, {
|
|
126442
|
+
path: toPath(state, buildInfoPath),
|
|
126443
|
+
buildInfo: buildInfo,
|
|
126444
|
+
modifiedTime: modifiedTime,
|
|
126445
|
+
latestChangedDtsTime: resultFlags & BuildResultFlags.DeclarationOutputUnchanged ? undefined : modifiedTime,
|
|
126446
|
+
});
|
|
126362
126447
|
}
|
|
126363
126448
|
}
|
|
126364
126449
|
function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
|
|
@@ -126390,7 +126475,7 @@ var ts;
|
|
|
126390
126475
|
}
|
|
126391
126476
|
}
|
|
126392
126477
|
function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
126393
|
-
var _a, _b
|
|
126478
|
+
var _a, _b;
|
|
126394
126479
|
// Container if no files are specified in the project
|
|
126395
126480
|
if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
|
|
126396
126481
|
return {
|
|
@@ -126402,8 +126487,8 @@ var ts;
|
|
|
126402
126487
|
var force = !!state.options.force;
|
|
126403
126488
|
if (project.projectReferences) {
|
|
126404
126489
|
state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
|
|
126405
|
-
for (var _i = 0,
|
|
126406
|
-
var ref =
|
|
126490
|
+
for (var _i = 0, _c = project.projectReferences; _i < _c.length; _i++) {
|
|
126491
|
+
var ref = _c[_i];
|
|
126407
126492
|
var resolvedRef = ts.resolveProjectReferencePath(ref);
|
|
126408
126493
|
var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
|
|
126409
126494
|
var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
|
|
@@ -126443,7 +126528,6 @@ var ts;
|
|
|
126443
126528
|
var buildInfoTime;
|
|
126444
126529
|
var buildInfoProgram;
|
|
126445
126530
|
var buildInfoVersionMap;
|
|
126446
|
-
var newestDeclarationFileContentChangedTime;
|
|
126447
126531
|
if (buildInfoPath) {
|
|
126448
126532
|
var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
|
|
126449
126533
|
buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
|
|
@@ -126480,8 +126564,6 @@ var ts;
|
|
|
126480
126564
|
}
|
|
126481
126565
|
oldestOutputFileTime = buildInfoTime;
|
|
126482
126566
|
oldestOutputFileName = buildInfoPath;
|
|
126483
|
-
// Get the last dtsChange time from build info
|
|
126484
|
-
newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
|
|
126485
126567
|
}
|
|
126486
126568
|
// Check input files
|
|
126487
126569
|
var newestInputFileName = undefined;
|
|
@@ -126489,8 +126571,8 @@ var ts;
|
|
|
126489
126571
|
/** True if input file has changed timestamp but text is not changed, we can then do only timestamp updates on output to make it look up-to-date later */
|
|
126490
126572
|
var pseudoInputUpToDate = false;
|
|
126491
126573
|
// Get timestamps of input files
|
|
126492
|
-
for (var
|
|
126493
|
-
var inputFile =
|
|
126574
|
+
for (var _d = 0, _e = project.fileNames; _d < _e.length; _d++) {
|
|
126575
|
+
var inputFile = _e[_d];
|
|
126494
126576
|
var inputTime = getModifiedTime(state, inputFile);
|
|
126495
126577
|
if (inputTime === ts.missingFileModifiedTime) {
|
|
126496
126578
|
return {
|
|
@@ -126531,8 +126613,8 @@ var ts;
|
|
|
126531
126613
|
// Collect the expected outputs of this project
|
|
126532
126614
|
var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
|
|
126533
126615
|
var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
|
|
126534
|
-
for (var
|
|
126535
|
-
var output = outputs_1[
|
|
126616
|
+
for (var _f = 0, outputs_1 = outputs; _f < outputs_1.length; _f++) {
|
|
126617
|
+
var output = outputs_1[_f];
|
|
126536
126618
|
var path = toPath(state, output);
|
|
126537
126619
|
// Output is missing; can stop checking
|
|
126538
126620
|
var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
|
|
@@ -126570,8 +126652,8 @@ var ts;
|
|
|
126570
126652
|
var usesPrepend = false;
|
|
126571
126653
|
var upstreamChangedProject;
|
|
126572
126654
|
if (referenceStatuses) {
|
|
126573
|
-
for (var
|
|
126574
|
-
var
|
|
126655
|
+
for (var _g = 0, referenceStatuses_1 = referenceStatuses; _g < referenceStatuses_1.length; _g++) {
|
|
126656
|
+
var _h = referenceStatuses_1[_g], ref = _h.ref, refStatus = _h.refStatus, resolvedConfig = _h.resolvedConfig, resolvedRefPath = _h.resolvedRefPath;
|
|
126575
126657
|
usesPrepend = usesPrepend || !!(ref.prepend);
|
|
126576
126658
|
// If the upstream project's newest file is older than our oldest output, we
|
|
126577
126659
|
// can't be out of date because of it
|
|
@@ -126588,7 +126670,8 @@ var ts;
|
|
|
126588
126670
|
}
|
|
126589
126671
|
// If the upstream project has only change .d.ts files, and we've built
|
|
126590
126672
|
// *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
|
|
126591
|
-
|
|
126673
|
+
var newestDeclarationFileContentChangedTime = getLatestChangedDtsTime(state, resolvedConfig.options, resolvedRefPath);
|
|
126674
|
+
if (newestDeclarationFileContentChangedTime && newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
|
|
126592
126675
|
pseudoUpToDate = true;
|
|
126593
126676
|
upstreamChangedProject = ref.path;
|
|
126594
126677
|
continue;
|
|
@@ -126631,7 +126714,6 @@ var ts;
|
|
|
126631
126714
|
pseudoInputUpToDate ?
|
|
126632
126715
|
ts.UpToDateStatusType.UpToDateWithInputFileText :
|
|
126633
126716
|
ts.UpToDateStatusType.UpToDate,
|
|
126634
|
-
newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
|
|
126635
126717
|
newestInputFileTime: newestInputFileTime,
|
|
126636
126718
|
newestInputFileName: newestInputFileName,
|
|
126637
126719
|
oldestOutputFileName: oldestOutputFileName
|
|
@@ -126715,13 +126797,17 @@ var ts;
|
|
|
126715
126797
|
outputTimeStampMap.delete(key);
|
|
126716
126798
|
});
|
|
126717
126799
|
}
|
|
126718
|
-
function
|
|
126719
|
-
var _a;
|
|
126800
|
+
function getLatestChangedDtsTime(state, options, resolvedConfigPath) {
|
|
126720
126801
|
if (!options.composite)
|
|
126721
126802
|
return undefined;
|
|
126722
|
-
var
|
|
126723
|
-
|
|
126724
|
-
|
|
126803
|
+
var entry = ts.Debug.checkDefined(state.buildInfoCache.get(resolvedConfigPath));
|
|
126804
|
+
if (entry.latestChangedDtsTime !== undefined)
|
|
126805
|
+
return entry.latestChangedDtsTime || undefined;
|
|
126806
|
+
var latestChangedDtsTime = entry.buildInfo && entry.buildInfo.program && entry.buildInfo.program.latestChangedDtsFile ?
|
|
126807
|
+
state.host.getModifiedTime(ts.getNormalizedAbsolutePath(entry.buildInfo.program.latestChangedDtsFile, ts.getDirectoryPath(entry.path))) :
|
|
126808
|
+
undefined;
|
|
126809
|
+
entry.latestChangedDtsTime = latestChangedDtsTime || false;
|
|
126810
|
+
return latestChangedDtsTime;
|
|
126725
126811
|
}
|
|
126726
126812
|
function updateOutputTimestamps(state, proj, resolvedPath) {
|
|
126727
126813
|
if (state.options.dry) {
|
|
@@ -126730,7 +126816,6 @@ var ts;
|
|
|
126730
126816
|
updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
|
|
126731
126817
|
state.projectStatus.set(resolvedPath, {
|
|
126732
126818
|
type: ts.UpToDateStatusType.UpToDate,
|
|
126733
|
-
newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
|
|
126734
126819
|
oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
|
|
126735
126820
|
});
|
|
126736
126821
|
}
|
|
@@ -133975,37 +134060,36 @@ var ts;
|
|
|
133975
134060
|
}
|
|
133976
134061
|
}
|
|
133977
134062
|
var entries = ts.createSortedArray();
|
|
133978
|
-
|
|
133979
|
-
|
|
133980
|
-
|
|
133981
|
-
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries);
|
|
133982
|
-
}
|
|
133983
|
-
else {
|
|
133984
|
-
if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
|
|
133985
|
-
return undefined;
|
|
133986
|
-
}
|
|
133987
|
-
getCompletionEntriesFromSymbols(symbols, entries,
|
|
133988
|
-
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag);
|
|
134063
|
+
var isChecked = isCheckedFile(sourceFile, compilerOptions);
|
|
134064
|
+
if (isChecked && !isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
|
|
134065
|
+
return undefined;
|
|
133989
134066
|
}
|
|
134067
|
+
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
|
|
134068
|
+
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag);
|
|
133990
134069
|
if (keywordFilters !== 0 /* None */) {
|
|
133991
|
-
var entryNames_1 = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
133992
134070
|
for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
|
|
133993
134071
|
var keywordEntry = _a[_i];
|
|
133994
|
-
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !
|
|
134072
|
+
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !uniqueNames.has(keywordEntry.name)) {
|
|
134073
|
+
uniqueNames.add(keywordEntry.name);
|
|
133995
134074
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
133996
134075
|
}
|
|
133997
134076
|
}
|
|
133998
134077
|
}
|
|
133999
|
-
var entryNames = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
134000
134078
|
for (var _b = 0, _c = getContextualKeywords(contextToken, position); _b < _c.length; _b++) {
|
|
134001
134079
|
var keywordEntry = _c[_b];
|
|
134002
|
-
if (!
|
|
134080
|
+
if (!uniqueNames.has(keywordEntry.name)) {
|
|
134081
|
+
uniqueNames.add(keywordEntry.name);
|
|
134003
134082
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
134004
134083
|
}
|
|
134005
134084
|
}
|
|
134006
134085
|
for (var _d = 0, literals_1 = literals; _d < literals_1.length; _d++) {
|
|
134007
134086
|
var literal = literals_1[_d];
|
|
134008
|
-
|
|
134087
|
+
var literalEntry = createCompletionEntryForLiteral(sourceFile, preferences, literal);
|
|
134088
|
+
uniqueNames.add(literalEntry.name);
|
|
134089
|
+
ts.insertSorted(entries, literalEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
134090
|
+
}
|
|
134091
|
+
if (!isChecked) {
|
|
134092
|
+
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries);
|
|
134009
134093
|
}
|
|
134010
134094
|
return {
|
|
134011
134095
|
flags: completionData.flags,
|
|
@@ -134017,8 +134101,8 @@ var ts;
|
|
|
134017
134101
|
entries: entries,
|
|
134018
134102
|
};
|
|
134019
134103
|
}
|
|
134020
|
-
function
|
|
134021
|
-
return ts.isSourceFileJS(sourceFile)
|
|
134104
|
+
function isCheckedFile(sourceFile, compilerOptions) {
|
|
134105
|
+
return !ts.isSourceFileJS(sourceFile) || !!ts.isCheckJsEnabledForFile(sourceFile, compilerOptions);
|
|
134022
134106
|
}
|
|
134023
134107
|
function isMemberCompletionKind(kind) {
|
|
134024
134108
|
switch (kind) {
|
|
@@ -134976,7 +135060,7 @@ var ts;
|
|
|
134976
135060
|
}
|
|
134977
135061
|
function getCompletionData(program, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) {
|
|
134978
135062
|
var typeChecker = program.getTypeChecker();
|
|
134979
|
-
var
|
|
135063
|
+
var inCheckedFile = isCheckedFile(sourceFile, compilerOptions);
|
|
134980
135064
|
var start = ts.timestamp();
|
|
134981
135065
|
var currentToken = ts.getTokenAtPosition(sourceFile, position); // TODO: GH#15853
|
|
134982
135066
|
// We will check for jsdoc comments with insideComment and getJsDocTagAtPosition. (TODO: that seems rather inefficient to check the same thing so many times.)
|
|
@@ -135392,15 +135476,7 @@ var ts;
|
|
|
135392
135476
|
isNewIdentifierLocation = true;
|
|
135393
135477
|
}
|
|
135394
135478
|
var propertyAccess = node.kind === 200 /* ImportType */ ? node : node.parent;
|
|
135395
|
-
if (
|
|
135396
|
-
// In javascript files, for union types, we don't just get the members that
|
|
135397
|
-
// the individual types have in common, we also include all the members that
|
|
135398
|
-
// each individual type has. This is because we're going to add all identifiers
|
|
135399
|
-
// anyways. So we might as well elevate the members that were at least part
|
|
135400
|
-
// of the individual types to a higher status since we know what they are.
|
|
135401
|
-
symbols.push.apply(symbols, ts.filter(getPropertiesForCompletion(type, typeChecker), function (s) { return typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, s); }));
|
|
135402
|
-
}
|
|
135403
|
-
else {
|
|
135479
|
+
if (inCheckedFile) {
|
|
135404
135480
|
for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) {
|
|
135405
135481
|
var symbol = _a[_i];
|
|
135406
135482
|
if (typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, symbol)) {
|
|
@@ -135408,6 +135484,14 @@ var ts;
|
|
|
135408
135484
|
}
|
|
135409
135485
|
}
|
|
135410
135486
|
}
|
|
135487
|
+
else {
|
|
135488
|
+
// In javascript files, for union types, we don't just get the members that
|
|
135489
|
+
// the individual types have in common, we also include all the members that
|
|
135490
|
+
// each individual type has. This is because we're going to add all identifiers
|
|
135491
|
+
// anyways. So we might as well elevate the members that were at least part
|
|
135492
|
+
// of the individual types to a higher status since we know what they are.
|
|
135493
|
+
symbols.push.apply(symbols, ts.filter(getPropertiesForCompletion(type, typeChecker), function (s) { return typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, s); }));
|
|
135494
|
+
}
|
|
135411
135495
|
if (insertAwait && preferences.includeCompletionsWithInsertText) {
|
|
135412
135496
|
var promiseType = typeChecker.getPromisedTypeOfPromise(type);
|
|
135413
135497
|
if (promiseType) {
|
|
@@ -155770,7 +155854,7 @@ var ts;
|
|
|
155770
155854
|
if (!newConstraint)
|
|
155771
155855
|
return;
|
|
155772
155856
|
var newConstraintText = newConstraint[1];
|
|
155773
|
-
changes.insertText(related.file,
|
|
155857
|
+
changes.insertText(related.file, decl.name.end, " extends " + newConstraintText);
|
|
155774
155858
|
}
|
|
155775
155859
|
function findAncestorMatchingSpan(sourceFile, span) {
|
|
155776
155860
|
var token = ts.getTokenAtPosition(sourceFile, span.start);
|