typescript 4.8.0-dev.20220629 → 4.8.0-dev.20220703
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 +276 -179
- package/lib/tsserver.js +325 -227
- package/lib/tsserverlibrary.js +325 -227
- package/lib/typescript.js +325 -227
- package/lib/typescriptServices.js +325 -227
- package/lib/typingsInstaller.js +297 -198
- 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.20220703";
|
|
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);
|
|
63982
|
+
}
|
|
63983
|
+
}
|
|
63984
|
+
function attachDebugPrototypeIfDebug(mapper) {
|
|
63985
|
+
if (ts.Debug.isDebugging) {
|
|
63986
|
+
return Object.setPrototypeOf(mapper, DebugTypeMapper.prototype);
|
|
63918
63987
|
}
|
|
63988
|
+
return mapper;
|
|
63919
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
|
}
|
|
@@ -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
|
}
|
|
@@ -82113,6 +82185,32 @@ var ts;
|
|
|
82113
82185
|
isAwaitedTypeInstantiation(type) ? type.aliasTypeArguments[0] :
|
|
82114
82186
|
type;
|
|
82115
82187
|
}
|
|
82188
|
+
function isAwaitedTypeNeeded(type) {
|
|
82189
|
+
// If this is already an `Awaited<T>`, we shouldn't wrap it. This helps to avoid `Awaited<Awaited<T>>` in higher-order.
|
|
82190
|
+
if (isTypeAny(type) || isAwaitedTypeInstantiation(type)) {
|
|
82191
|
+
return false;
|
|
82192
|
+
}
|
|
82193
|
+
// We only need `Awaited<T>` if `T` contains possibly non-primitive types.
|
|
82194
|
+
if (isGenericObjectType(type)) {
|
|
82195
|
+
var baseConstraint = getBaseConstraintOfType(type);
|
|
82196
|
+
// We only need `Awaited<T>` if `T` has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
|
|
82197
|
+
// or is promise-like.
|
|
82198
|
+
if (!baseConstraint || (baseConstraint.flags & 3 /* AnyOrUnknown */) || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint)) {
|
|
82199
|
+
return true;
|
|
82200
|
+
}
|
|
82201
|
+
}
|
|
82202
|
+
return false;
|
|
82203
|
+
}
|
|
82204
|
+
function tryCreateAwaitedType(type) {
|
|
82205
|
+
// Nothing to do if `Awaited<T>` doesn't exist
|
|
82206
|
+
var awaitedSymbol = getGlobalAwaitedSymbol(/*reportErrors*/ true);
|
|
82207
|
+
if (awaitedSymbol) {
|
|
82208
|
+
// Unwrap unions that may contain `Awaited<T>`, otherwise its possible to manufacture an `Awaited<Awaited<T> | U>` where
|
|
82209
|
+
// an `Awaited<T | U>` would suffice.
|
|
82210
|
+
return getTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
|
|
82211
|
+
}
|
|
82212
|
+
return undefined;
|
|
82213
|
+
}
|
|
82116
82214
|
function createAwaitedTypeIfNeeded(type) {
|
|
82117
82215
|
// We wrap type `T` in `Awaited<T>` based on the following conditions:
|
|
82118
82216
|
// - `T` is not already an `Awaited<U>`, and
|
|
@@ -82121,26 +82219,10 @@ var ts;
|
|
|
82121
82219
|
// - `T` has no base constraint, or
|
|
82122
82220
|
// - The base constraint of `T` is `any`, `unknown`, `object`, or `{}`, or
|
|
82123
82221
|
// - The base constraint of `T` is an object type with a callable `then` method.
|
|
82124
|
-
if (
|
|
82125
|
-
|
|
82126
|
-
|
|
82127
|
-
|
|
82128
|
-
if (isAwaitedTypeInstantiation(type)) {
|
|
82129
|
-
return type;
|
|
82130
|
-
}
|
|
82131
|
-
// Only instantiate `Awaited<T>` if `T` contains possibly non-primitive types.
|
|
82132
|
-
if (isGenericObjectType(type)) {
|
|
82133
|
-
var baseConstraint = getBaseConstraintOfType(type);
|
|
82134
|
-
// Only instantiate `Awaited<T>` if `T` has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
|
|
82135
|
-
// or is promise-like.
|
|
82136
|
-
if (!baseConstraint || (baseConstraint.flags & 3 /* AnyOrUnknown */) || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint)) {
|
|
82137
|
-
// Nothing to do if `Awaited<T>` doesn't exist
|
|
82138
|
-
var awaitedSymbol = getGlobalAwaitedSymbol(/*reportErrors*/ true);
|
|
82139
|
-
if (awaitedSymbol) {
|
|
82140
|
-
// Unwrap unions that may contain `Awaited<T>`, otherwise its possible to manufacture an `Awaited<Awaited<T> | U>` where
|
|
82141
|
-
// an `Awaited<T | U>` would suffice.
|
|
82142
|
-
return getTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
|
|
82143
|
-
}
|
|
82222
|
+
if (isAwaitedTypeNeeded(type)) {
|
|
82223
|
+
var awaitedType = tryCreateAwaitedType(type);
|
|
82224
|
+
if (awaitedType) {
|
|
82225
|
+
return awaitedType;
|
|
82144
82226
|
}
|
|
82145
82227
|
}
|
|
82146
82228
|
ts.Debug.assert(getPromisedTypeOfPromise(type) === undefined, "type provided should not be a non-generic 'promise'-like.");
|
|
@@ -82180,8 +82262,21 @@ var ts;
|
|
|
82180
82262
|
}
|
|
82181
82263
|
// For a union, get a union of the awaited types of each constituent.
|
|
82182
82264
|
if (type.flags & 1048576 /* Union */) {
|
|
82265
|
+
if (awaitedTypeStack.lastIndexOf(type.id) >= 0) {
|
|
82266
|
+
if (errorNode) {
|
|
82267
|
+
error(errorNode, ts.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
82268
|
+
}
|
|
82269
|
+
return undefined;
|
|
82270
|
+
}
|
|
82183
82271
|
var mapper = errorNode ? function (constituentType) { return getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0); } : getAwaitedTypeNoAlias;
|
|
82184
|
-
|
|
82272
|
+
awaitedTypeStack.push(type.id);
|
|
82273
|
+
var mapped = mapType(type, mapper);
|
|
82274
|
+
awaitedTypeStack.pop();
|
|
82275
|
+
return typeAsAwaitable.awaitedTypeOfType = mapped;
|
|
82276
|
+
}
|
|
82277
|
+
// If `type` is generic and should be wrapped in `Awaited<T>`, return it.
|
|
82278
|
+
if (isAwaitedTypeNeeded(type)) {
|
|
82279
|
+
return typeAsAwaitable.awaitedTypeOfType = type;
|
|
82185
82280
|
}
|
|
82186
82281
|
var thisTypeForErrorOut = { value: undefined };
|
|
82187
82282
|
var promisedType = getPromisedTypeOfPromise(type, /*errorNode*/ undefined, thisTypeForErrorOut);
|
|
@@ -82830,8 +82925,8 @@ var ts;
|
|
|
82830
82925
|
return;
|
|
82831
82926
|
var typeParameters = ts.getEffectiveTypeParameterDeclarations(node);
|
|
82832
82927
|
var seenParentsWithEveryUnused = new ts.Set();
|
|
82833
|
-
for (var _i = 0,
|
|
82834
|
-
var typeParameter =
|
|
82928
|
+
for (var _i = 0, typeParameters_4 = typeParameters; _i < typeParameters_4.length; _i++) {
|
|
82929
|
+
var typeParameter = typeParameters_4[_i];
|
|
82835
82930
|
if (!isTypeParameterUnused(typeParameter))
|
|
82836
82931
|
continue;
|
|
82837
82932
|
var name = ts.idText(typeParameter.name);
|
|
@@ -84650,7 +84745,7 @@ var ts;
|
|
|
84650
84745
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84651
84746
|
var localPropDeclaration = declaration && declaration.kind === 221 /* BinaryExpression */ ||
|
|
84652
84747
|
name && name.kind === 162 /* ComputedPropertyName */ || getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
84653
|
-
var
|
|
84748
|
+
var _loop_30 = function (info) {
|
|
84654
84749
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
84655
84750
|
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
|
|
84656
84751
|
// in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
|
|
@@ -84663,7 +84758,7 @@ var ts;
|
|
|
84663
84758
|
};
|
|
84664
84759
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
84665
84760
|
var info = indexInfos_9[_i];
|
|
84666
|
-
|
|
84761
|
+
_loop_30(info);
|
|
84667
84762
|
}
|
|
84668
84763
|
}
|
|
84669
84764
|
function checkIndexConstraintForIndexSignature(type, checkInfo) {
|
|
@@ -84671,7 +84766,7 @@ var ts;
|
|
|
84671
84766
|
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
|
|
84672
84767
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84673
84768
|
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
|
|
84674
|
-
var
|
|
84769
|
+
var _loop_31 = function (info) {
|
|
84675
84770
|
if (info === checkInfo)
|
|
84676
84771
|
return "continue";
|
|
84677
84772
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
@@ -84686,7 +84781,7 @@ var ts;
|
|
|
84686
84781
|
};
|
|
84687
84782
|
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
84688
84783
|
var info = indexInfos_10[_i];
|
|
84689
|
-
|
|
84784
|
+
_loop_31(info);
|
|
84690
84785
|
}
|
|
84691
84786
|
}
|
|
84692
84787
|
function checkTypeNameIsReserved(name, message) {
|
|
@@ -85006,7 +85101,7 @@ var ts;
|
|
|
85006
85101
|
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
85007
85102
|
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
85008
85103
|
var baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
85009
|
-
var
|
|
85104
|
+
var _loop_32 = function (member) {
|
|
85010
85105
|
if (ts.hasAmbientModifier(member)) {
|
|
85011
85106
|
return "continue";
|
|
85012
85107
|
}
|
|
@@ -85023,7 +85118,7 @@ var ts;
|
|
|
85023
85118
|
};
|
|
85024
85119
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
85025
85120
|
var member = _a[_i];
|
|
85026
|
-
|
|
85121
|
+
_loop_32(member);
|
|
85027
85122
|
}
|
|
85028
85123
|
}
|
|
85029
85124
|
/**
|
|
@@ -85111,7 +85206,7 @@ var ts;
|
|
|
85111
85206
|
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
|
|
85112
85207
|
// 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
85208
|
var issuedMemberError = false;
|
|
85114
|
-
var
|
|
85209
|
+
var _loop_33 = function (member) {
|
|
85115
85210
|
if (ts.isStatic(member)) {
|
|
85116
85211
|
return "continue";
|
|
85117
85212
|
}
|
|
@@ -85130,7 +85225,7 @@ var ts;
|
|
|
85130
85225
|
};
|
|
85131
85226
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
85132
85227
|
var member = _a[_i];
|
|
85133
|
-
|
|
85228
|
+
_loop_33(member);
|
|
85134
85229
|
}
|
|
85135
85230
|
if (!issuedMemberError) {
|
|
85136
85231
|
// check again with diagnostics to generate a less-specific error
|
|
@@ -85201,7 +85296,7 @@ var ts;
|
|
|
85201
85296
|
var _a, _b, _c, _d;
|
|
85202
85297
|
// NOTE: assignability is checked in checkClassDeclaration
|
|
85203
85298
|
var baseProperties = getPropertiesOfType(baseType);
|
|
85204
|
-
var
|
|
85299
|
+
var _loop_34 = function (baseProperty) {
|
|
85205
85300
|
var base = getTargetSymbol(baseProperty);
|
|
85206
85301
|
if (base.flags & 4194304 /* Prototype */) {
|
|
85207
85302
|
return "continue";
|
|
@@ -85311,7 +85406,7 @@ var ts;
|
|
|
85311
85406
|
};
|
|
85312
85407
|
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
|
|
85313
85408
|
var baseProperty = baseProperties_1[_i];
|
|
85314
|
-
var state_10 =
|
|
85409
|
+
var state_10 = _loop_34(baseProperty);
|
|
85315
85410
|
switch (state_10) {
|
|
85316
85411
|
case "continue-basePropertyCheck": continue basePropertyCheck;
|
|
85317
85412
|
}
|
|
@@ -111826,7 +111921,6 @@ var ts;
|
|
|
111826
111921
|
if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
|
|
111827
111922
|
// Update the output signature
|
|
111828
111923
|
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, createHash, changedDtsData);
|
|
111829
|
-
newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
|
|
111830
111924
|
}
|
|
111831
111925
|
// Update sourceFileInfo
|
|
111832
111926
|
var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
|
|
@@ -121213,7 +121307,7 @@ var ts;
|
|
|
121213
121307
|
state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
|
|
121214
121308
|
}
|
|
121215
121309
|
state.changedFilesSet = new ts.Set();
|
|
121216
|
-
state.
|
|
121310
|
+
state.latestChangedDtsFile = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.latestChangedDtsFile : undefined;
|
|
121217
121311
|
var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
|
|
121218
121312
|
var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
|
|
121219
121313
|
var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
|
|
@@ -121337,7 +121431,7 @@ var ts;
|
|
|
121337
121431
|
programEmitComplete: state.programEmitComplete,
|
|
121338
121432
|
emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
|
|
121339
121433
|
outSignature: state.outSignature,
|
|
121340
|
-
|
|
121434
|
+
latestChangedDtsFile: state.latestChangedDtsFile,
|
|
121341
121435
|
hasChangedEmitSignature: state.hasChangedEmitSignature,
|
|
121342
121436
|
changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
|
|
121343
121437
|
};
|
|
@@ -121350,7 +121444,7 @@ var ts;
|
|
|
121350
121444
|
state.programEmitComplete = savedEmitState.programEmitComplete;
|
|
121351
121445
|
state.emitSignatures = savedEmitState.emitSignatures;
|
|
121352
121446
|
state.outSignature = savedEmitState.outSignature;
|
|
121353
|
-
state.
|
|
121447
|
+
state.latestChangedDtsFile = savedEmitState.latestChangedDtsFile;
|
|
121354
121448
|
state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
|
|
121355
121449
|
if (savedEmitState.changedFilesSet)
|
|
121356
121450
|
state.changedFilesSet = savedEmitState.changedFilesSet;
|
|
@@ -121664,14 +121758,14 @@ var ts;
|
|
|
121664
121758
|
/**
|
|
121665
121759
|
* Gets the program information to be emitted in buildInfo so that we can use it to create new program
|
|
121666
121760
|
*/
|
|
121667
|
-
function getProgramBuildInfo(state, getCanonicalFileName
|
|
121761
|
+
function getProgramBuildInfo(state, getCanonicalFileName) {
|
|
121668
121762
|
var outFilePath = ts.outFile(state.compilerOptions);
|
|
121669
121763
|
if (outFilePath && !state.compilerOptions.composite)
|
|
121670
121764
|
return;
|
|
121671
121765
|
var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
|
|
121672
121766
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
|
|
121673
|
-
//
|
|
121674
|
-
|
|
121767
|
+
// 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
|
|
121768
|
+
var latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : undefined;
|
|
121675
121769
|
if (outFilePath) {
|
|
121676
121770
|
var fileNames_1 = [];
|
|
121677
121771
|
var fileInfos_1 = [];
|
|
@@ -121687,7 +121781,7 @@ var ts;
|
|
|
121687
121781
|
fileInfos: fileInfos_1,
|
|
121688
121782
|
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
|
|
121689
121783
|
outSignature: state.outSignature,
|
|
121690
|
-
|
|
121784
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
121691
121785
|
};
|
|
121692
121786
|
return result_15;
|
|
121693
121787
|
}
|
|
@@ -121789,7 +121883,7 @@ var ts;
|
|
|
121789
121883
|
affectedFilesPendingEmit: affectedFilesPendingEmit,
|
|
121790
121884
|
changeFileSet: changeFileSet,
|
|
121791
121885
|
emitSignatures: emitSignatures,
|
|
121792
|
-
|
|
121886
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
121793
121887
|
};
|
|
121794
121888
|
return result;
|
|
121795
121889
|
function relativeToBuildInfoEnsuringAbsolutePath(path) {
|
|
@@ -121957,7 +122051,7 @@ var ts;
|
|
|
121957
122051
|
*/
|
|
121958
122052
|
var computeHash = ts.maybeBind(host, host.createHash);
|
|
121959
122053
|
var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
|
|
121960
|
-
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName
|
|
122054
|
+
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
|
|
121961
122055
|
// To ensure that we arent storing any references to old program or new program without state
|
|
121962
122056
|
newProgram = undefined; // TODO: GH#18217
|
|
121963
122057
|
oldProgram = undefined;
|
|
@@ -121967,6 +122061,7 @@ var ts;
|
|
|
121967
122061
|
builderProgram.getState = getState;
|
|
121968
122062
|
builderProgram.saveEmitState = function () { return backupBuilderProgramEmitState(state); };
|
|
121969
122063
|
builderProgram.restoreEmitState = function (saved) { return restoreBuilderProgramEmitState(state, saved); };
|
|
122064
|
+
builderProgram.hasChangedEmitSignature = function () { return !!state.hasChangedEmitSignature; };
|
|
121970
122065
|
builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
|
|
121971
122066
|
builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
|
|
121972
122067
|
builderProgram.emit = emit;
|
|
@@ -122074,18 +122169,22 @@ var ts;
|
|
|
122074
122169
|
var filePath = sourceFiles[0].resolvedPath;
|
|
122075
122170
|
var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath);
|
|
122076
122171
|
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text, computeHash, data));
|
|
122077
|
-
if
|
|
122078
|
-
|
|
122079
|
-
|
|
122080
|
-
|
|
122172
|
+
// Dont write dts files if they didn't change
|
|
122173
|
+
if (emitSignature === oldSignature)
|
|
122174
|
+
return;
|
|
122175
|
+
((_g = state.emitSignatures) !== null && _g !== void 0 ? _g : (state.emitSignatures = new ts.Map())).set(filePath, emitSignature);
|
|
122176
|
+
state.hasChangedEmitSignature = true;
|
|
122177
|
+
state.latestChangedDtsFile = fileName;
|
|
122081
122178
|
}
|
|
122082
122179
|
}
|
|
122083
122180
|
else if (state.compilerOptions.composite) {
|
|
122084
122181
|
var newSignature = computeSignature(text, computeHash, data);
|
|
122085
|
-
if
|
|
122086
|
-
|
|
122087
|
-
|
|
122088
|
-
|
|
122182
|
+
// Dont write dts files if they didn't change
|
|
122183
|
+
if (newSignature === state.outSignature)
|
|
122184
|
+
return;
|
|
122185
|
+
state.outSignature = newSignature;
|
|
122186
|
+
state.hasChangedEmitSignature = true;
|
|
122187
|
+
state.latestChangedDtsFile = fileName;
|
|
122089
122188
|
}
|
|
122090
122189
|
}
|
|
122091
122190
|
if (writeFile)
|
|
@@ -122248,11 +122347,12 @@ var ts;
|
|
|
122248
122347
|
var state;
|
|
122249
122348
|
var filePaths;
|
|
122250
122349
|
var filePathsSetList;
|
|
122350
|
+
var latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : undefined;
|
|
122251
122351
|
if (isProgramBundleEmitBuildInfo(program)) {
|
|
122252
122352
|
state = {
|
|
122253
122353
|
fileInfos: new ts.Map(),
|
|
122254
122354
|
compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
|
|
122255
|
-
|
|
122355
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
122256
122356
|
outSignature: program.outSignature,
|
|
122257
122357
|
};
|
|
122258
122358
|
}
|
|
@@ -122285,7 +122385,7 @@ var ts;
|
|
|
122285
122385
|
affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
|
|
122286
122386
|
affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
|
|
122287
122387
|
changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
|
|
122288
|
-
|
|
122388
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
122289
122389
|
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
|
122290
122390
|
};
|
|
122291
122391
|
}
|
|
@@ -122312,6 +122412,7 @@ var ts;
|
|
|
122312
122412
|
getSemanticDiagnosticsOfNextAffectedFile: ts.notImplemented,
|
|
122313
122413
|
emitBuildInfo: ts.notImplemented,
|
|
122314
122414
|
close: ts.noop,
|
|
122415
|
+
hasChangedEmitSignature: ts.returnFalse,
|
|
122315
122416
|
};
|
|
122316
122417
|
function toPath(path) {
|
|
122317
122418
|
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
@@ -123626,7 +123727,7 @@ var ts;
|
|
|
123626
123727
|
});
|
|
123627
123728
|
// Sort by paths closest to importing file Name directory
|
|
123628
123729
|
var sortedPaths = [];
|
|
123629
|
-
var
|
|
123730
|
+
var _loop_35 = function (directory) {
|
|
123630
123731
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
123631
123732
|
var pathsInDirectory;
|
|
123632
123733
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -123650,7 +123751,7 @@ var ts;
|
|
|
123650
123751
|
};
|
|
123651
123752
|
var out_directory_1;
|
|
123652
123753
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
123653
|
-
var state_11 =
|
|
123754
|
+
var state_11 = _loop_35(directory);
|
|
123654
123755
|
directory = out_directory_1;
|
|
123655
123756
|
if (state_11 === "break")
|
|
123656
123757
|
break;
|
|
@@ -124494,7 +124595,6 @@ var ts;
|
|
|
124494
124595
|
readDirectory: ts.maybeBind(host, host.readDirectory),
|
|
124495
124596
|
disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
|
|
124496
124597
|
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
|
|
124497
|
-
now: ts.maybeBind(host, host.now),
|
|
124498
124598
|
};
|
|
124499
124599
|
function writeFile(fileName, text, writeByteOrderMark, onError) {
|
|
124500
124600
|
try {
|
|
@@ -124652,7 +124752,6 @@ var ts;
|
|
|
124652
124752
|
host.createHash = ts.maybeBind(system, system.createHash);
|
|
124653
124753
|
host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
|
|
124654
124754
|
host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
|
|
124655
|
-
host.now = ts.maybeBind(system, system.now);
|
|
124656
124755
|
ts.setGetSourceFileAsHashVersioned(host, system);
|
|
124657
124756
|
ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
|
|
124658
124757
|
return host;
|
|
@@ -125980,8 +126079,7 @@ var ts;
|
|
|
125980
126079
|
}
|
|
125981
126080
|
// Actual Emit
|
|
125982
126081
|
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;
|
|
126082
|
+
var resultFlags = ((_d = program.hasChangedEmitSignature) === null || _d === void 0 ? void 0 : _d.call(program)) ? BuildResultFlags.None : BuildResultFlags.DeclarationOutputUnchanged;
|
|
125985
126083
|
var emitterDiagnostics = ts.createDiagnosticCollection();
|
|
125986
126084
|
var emittedOutputs = new ts.Map();
|
|
125987
126085
|
var options = program.getCompilerOptions();
|
|
@@ -125989,17 +126087,11 @@ var ts;
|
|
|
125989
126087
|
var outputTimeStampMap;
|
|
125990
126088
|
var now;
|
|
125991
126089
|
outputFiles.forEach(function (_a) {
|
|
125992
|
-
var _b, _c;
|
|
125993
126090
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
125994
126091
|
var path = toPath(state, name);
|
|
125995
126092
|
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
|
-
}
|
|
126093
|
+
if (buildInfo)
|
|
126094
|
+
setBuildInfo(state, buildInfo, projectPath, options, resultFlags);
|
|
126003
126095
|
ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
|
|
126004
126096
|
if (!isIncremental && state.watch) {
|
|
126005
126097
|
(outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
|
|
@@ -126013,7 +126105,7 @@ var ts;
|
|
|
126013
126105
|
ts.Debug.assert(step === BuildStep.EmitBuildInfo);
|
|
126014
126106
|
var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
|
|
126015
126107
|
if (data === null || data === void 0 ? void 0 : data.buildInfo)
|
|
126016
|
-
setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
|
|
126108
|
+
setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions(), BuildResultFlags.DeclarationOutputUnchanged);
|
|
126017
126109
|
if (writeFileCallback)
|
|
126018
126110
|
writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
126019
126111
|
else
|
|
@@ -126046,7 +126138,6 @@ var ts;
|
|
|
126046
126138
|
state.diagnostics.delete(projectPath);
|
|
126047
126139
|
state.projectStatus.set(projectPath, {
|
|
126048
126140
|
type: ts.UpToDateStatusType.UpToDate,
|
|
126049
|
-
newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
|
|
126050
126141
|
oldestOutputFileName: oldestOutputFileName
|
|
126051
126142
|
});
|
|
126052
126143
|
afterProgramDone(state, program, config);
|
|
@@ -126088,10 +126179,10 @@ var ts;
|
|
|
126088
126179
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
126089
126180
|
emittedOutputs.set(toPath(state, name), name);
|
|
126090
126181
|
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)) {
|
|
126182
|
+
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) {
|
|
126093
126183
|
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
|
126094
126184
|
}
|
|
126185
|
+
setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags);
|
|
126095
126186
|
}
|
|
126096
126187
|
ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
|
|
126097
126188
|
});
|
|
@@ -126350,15 +126441,23 @@ var ts;
|
|
|
126350
126441
|
state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
|
|
126351
126442
|
return result;
|
|
126352
126443
|
}
|
|
126353
|
-
function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
|
|
126444
|
+
function setBuildInfo(state, buildInfo, resolvedConfigPath, options, resultFlags) {
|
|
126354
126445
|
var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
|
|
126355
126446
|
var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
|
|
126447
|
+
var modifiedTime = getCurrentTime(state.host);
|
|
126356
126448
|
if (existing) {
|
|
126357
126449
|
existing.buildInfo = buildInfo;
|
|
126358
|
-
existing.modifiedTime =
|
|
126450
|
+
existing.modifiedTime = modifiedTime;
|
|
126451
|
+
if (!(resultFlags & BuildResultFlags.DeclarationOutputUnchanged))
|
|
126452
|
+
existing.latestChangedDtsTime = modifiedTime;
|
|
126359
126453
|
}
|
|
126360
126454
|
else {
|
|
126361
|
-
state.buildInfoCache.set(resolvedConfigPath, {
|
|
126455
|
+
state.buildInfoCache.set(resolvedConfigPath, {
|
|
126456
|
+
path: toPath(state, buildInfoPath),
|
|
126457
|
+
buildInfo: buildInfo,
|
|
126458
|
+
modifiedTime: modifiedTime,
|
|
126459
|
+
latestChangedDtsTime: resultFlags & BuildResultFlags.DeclarationOutputUnchanged ? undefined : modifiedTime,
|
|
126460
|
+
});
|
|
126362
126461
|
}
|
|
126363
126462
|
}
|
|
126364
126463
|
function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
|
|
@@ -126390,7 +126489,7 @@ var ts;
|
|
|
126390
126489
|
}
|
|
126391
126490
|
}
|
|
126392
126491
|
function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
126393
|
-
var _a, _b
|
|
126492
|
+
var _a, _b;
|
|
126394
126493
|
// Container if no files are specified in the project
|
|
126395
126494
|
if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
|
|
126396
126495
|
return {
|
|
@@ -126402,8 +126501,8 @@ var ts;
|
|
|
126402
126501
|
var force = !!state.options.force;
|
|
126403
126502
|
if (project.projectReferences) {
|
|
126404
126503
|
state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
|
|
126405
|
-
for (var _i = 0,
|
|
126406
|
-
var ref =
|
|
126504
|
+
for (var _i = 0, _c = project.projectReferences; _i < _c.length; _i++) {
|
|
126505
|
+
var ref = _c[_i];
|
|
126407
126506
|
var resolvedRef = ts.resolveProjectReferencePath(ref);
|
|
126408
126507
|
var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
|
|
126409
126508
|
var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
|
|
@@ -126443,7 +126542,6 @@ var ts;
|
|
|
126443
126542
|
var buildInfoTime;
|
|
126444
126543
|
var buildInfoProgram;
|
|
126445
126544
|
var buildInfoVersionMap;
|
|
126446
|
-
var newestDeclarationFileContentChangedTime;
|
|
126447
126545
|
if (buildInfoPath) {
|
|
126448
126546
|
var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
|
|
126449
126547
|
buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
|
|
@@ -126480,8 +126578,6 @@ var ts;
|
|
|
126480
126578
|
}
|
|
126481
126579
|
oldestOutputFileTime = buildInfoTime;
|
|
126482
126580
|
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
126581
|
}
|
|
126486
126582
|
// Check input files
|
|
126487
126583
|
var newestInputFileName = undefined;
|
|
@@ -126489,8 +126585,8 @@ var ts;
|
|
|
126489
126585
|
/** 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
126586
|
var pseudoInputUpToDate = false;
|
|
126491
126587
|
// Get timestamps of input files
|
|
126492
|
-
for (var
|
|
126493
|
-
var inputFile =
|
|
126588
|
+
for (var _d = 0, _e = project.fileNames; _d < _e.length; _d++) {
|
|
126589
|
+
var inputFile = _e[_d];
|
|
126494
126590
|
var inputTime = getModifiedTime(state, inputFile);
|
|
126495
126591
|
if (inputTime === ts.missingFileModifiedTime) {
|
|
126496
126592
|
return {
|
|
@@ -126531,8 +126627,8 @@ var ts;
|
|
|
126531
126627
|
// Collect the expected outputs of this project
|
|
126532
126628
|
var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
|
|
126533
126629
|
var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
|
|
126534
|
-
for (var
|
|
126535
|
-
var output = outputs_1[
|
|
126630
|
+
for (var _f = 0, outputs_1 = outputs; _f < outputs_1.length; _f++) {
|
|
126631
|
+
var output = outputs_1[_f];
|
|
126536
126632
|
var path = toPath(state, output);
|
|
126537
126633
|
// Output is missing; can stop checking
|
|
126538
126634
|
var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
|
|
@@ -126570,8 +126666,8 @@ var ts;
|
|
|
126570
126666
|
var usesPrepend = false;
|
|
126571
126667
|
var upstreamChangedProject;
|
|
126572
126668
|
if (referenceStatuses) {
|
|
126573
|
-
for (var
|
|
126574
|
-
var
|
|
126669
|
+
for (var _g = 0, referenceStatuses_1 = referenceStatuses; _g < referenceStatuses_1.length; _g++) {
|
|
126670
|
+
var _h = referenceStatuses_1[_g], ref = _h.ref, refStatus = _h.refStatus, resolvedConfig = _h.resolvedConfig, resolvedRefPath = _h.resolvedRefPath;
|
|
126575
126671
|
usesPrepend = usesPrepend || !!(ref.prepend);
|
|
126576
126672
|
// If the upstream project's newest file is older than our oldest output, we
|
|
126577
126673
|
// can't be out of date because of it
|
|
@@ -126588,7 +126684,8 @@ var ts;
|
|
|
126588
126684
|
}
|
|
126589
126685
|
// If the upstream project has only change .d.ts files, and we've built
|
|
126590
126686
|
// *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
|
|
126591
|
-
|
|
126687
|
+
var newestDeclarationFileContentChangedTime = getLatestChangedDtsTime(state, resolvedConfig.options, resolvedRefPath);
|
|
126688
|
+
if (newestDeclarationFileContentChangedTime && newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
|
|
126592
126689
|
pseudoUpToDate = true;
|
|
126593
126690
|
upstreamChangedProject = ref.path;
|
|
126594
126691
|
continue;
|
|
@@ -126631,7 +126728,6 @@ var ts;
|
|
|
126631
126728
|
pseudoInputUpToDate ?
|
|
126632
126729
|
ts.UpToDateStatusType.UpToDateWithInputFileText :
|
|
126633
126730
|
ts.UpToDateStatusType.UpToDate,
|
|
126634
|
-
newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
|
|
126635
126731
|
newestInputFileTime: newestInputFileTime,
|
|
126636
126732
|
newestInputFileName: newestInputFileName,
|
|
126637
126733
|
oldestOutputFileName: oldestOutputFileName
|
|
@@ -126715,13 +126811,17 @@ var ts;
|
|
|
126715
126811
|
outputTimeStampMap.delete(key);
|
|
126716
126812
|
});
|
|
126717
126813
|
}
|
|
126718
|
-
function
|
|
126719
|
-
var _a;
|
|
126814
|
+
function getLatestChangedDtsTime(state, options, resolvedConfigPath) {
|
|
126720
126815
|
if (!options.composite)
|
|
126721
126816
|
return undefined;
|
|
126722
|
-
var
|
|
126723
|
-
|
|
126724
|
-
|
|
126817
|
+
var entry = ts.Debug.checkDefined(state.buildInfoCache.get(resolvedConfigPath));
|
|
126818
|
+
if (entry.latestChangedDtsTime !== undefined)
|
|
126819
|
+
return entry.latestChangedDtsTime || undefined;
|
|
126820
|
+
var latestChangedDtsTime = entry.buildInfo && entry.buildInfo.program && entry.buildInfo.program.latestChangedDtsFile ?
|
|
126821
|
+
state.host.getModifiedTime(ts.getNormalizedAbsolutePath(entry.buildInfo.program.latestChangedDtsFile, ts.getDirectoryPath(entry.path))) :
|
|
126822
|
+
undefined;
|
|
126823
|
+
entry.latestChangedDtsTime = latestChangedDtsTime || false;
|
|
126824
|
+
return latestChangedDtsTime;
|
|
126725
126825
|
}
|
|
126726
126826
|
function updateOutputTimestamps(state, proj, resolvedPath) {
|
|
126727
126827
|
if (state.options.dry) {
|
|
@@ -126730,7 +126830,6 @@ var ts;
|
|
|
126730
126830
|
updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
|
|
126731
126831
|
state.projectStatus.set(resolvedPath, {
|
|
126732
126832
|
type: ts.UpToDateStatusType.UpToDate,
|
|
126733
|
-
newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
|
|
126734
126833
|
oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
|
|
126735
126834
|
});
|
|
126736
126835
|
}
|
|
@@ -133975,37 +134074,36 @@ var ts;
|
|
|
133975
134074
|
}
|
|
133976
134075
|
}
|
|
133977
134076
|
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);
|
|
134077
|
+
var isChecked = isCheckedFile(sourceFile, compilerOptions);
|
|
134078
|
+
if (isChecked && !isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
|
|
134079
|
+
return undefined;
|
|
133989
134080
|
}
|
|
134081
|
+
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
|
|
134082
|
+
/*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
134083
|
if (keywordFilters !== 0 /* None */) {
|
|
133991
|
-
var entryNames_1 = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
133992
134084
|
for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
|
|
133993
134085
|
var keywordEntry = _a[_i];
|
|
133994
|
-
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !
|
|
134086
|
+
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !uniqueNames.has(keywordEntry.name)) {
|
|
134087
|
+
uniqueNames.add(keywordEntry.name);
|
|
133995
134088
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
133996
134089
|
}
|
|
133997
134090
|
}
|
|
133998
134091
|
}
|
|
133999
|
-
var entryNames = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
134000
134092
|
for (var _b = 0, _c = getContextualKeywords(contextToken, position); _b < _c.length; _b++) {
|
|
134001
134093
|
var keywordEntry = _c[_b];
|
|
134002
|
-
if (!
|
|
134094
|
+
if (!uniqueNames.has(keywordEntry.name)) {
|
|
134095
|
+
uniqueNames.add(keywordEntry.name);
|
|
134003
134096
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
134004
134097
|
}
|
|
134005
134098
|
}
|
|
134006
134099
|
for (var _d = 0, literals_1 = literals; _d < literals_1.length; _d++) {
|
|
134007
134100
|
var literal = literals_1[_d];
|
|
134008
|
-
|
|
134101
|
+
var literalEntry = createCompletionEntryForLiteral(sourceFile, preferences, literal);
|
|
134102
|
+
uniqueNames.add(literalEntry.name);
|
|
134103
|
+
ts.insertSorted(entries, literalEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
134104
|
+
}
|
|
134105
|
+
if (!isChecked) {
|
|
134106
|
+
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries);
|
|
134009
134107
|
}
|
|
134010
134108
|
return {
|
|
134011
134109
|
flags: completionData.flags,
|
|
@@ -134017,8 +134115,8 @@ var ts;
|
|
|
134017
134115
|
entries: entries,
|
|
134018
134116
|
};
|
|
134019
134117
|
}
|
|
134020
|
-
function
|
|
134021
|
-
return ts.isSourceFileJS(sourceFile)
|
|
134118
|
+
function isCheckedFile(sourceFile, compilerOptions) {
|
|
134119
|
+
return !ts.isSourceFileJS(sourceFile) || !!ts.isCheckJsEnabledForFile(sourceFile, compilerOptions);
|
|
134022
134120
|
}
|
|
134023
134121
|
function isMemberCompletionKind(kind) {
|
|
134024
134122
|
switch (kind) {
|
|
@@ -134976,7 +135074,7 @@ var ts;
|
|
|
134976
135074
|
}
|
|
134977
135075
|
function getCompletionData(program, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) {
|
|
134978
135076
|
var typeChecker = program.getTypeChecker();
|
|
134979
|
-
var
|
|
135077
|
+
var inCheckedFile = isCheckedFile(sourceFile, compilerOptions);
|
|
134980
135078
|
var start = ts.timestamp();
|
|
134981
135079
|
var currentToken = ts.getTokenAtPosition(sourceFile, position); // TODO: GH#15853
|
|
134982
135080
|
// 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 +135490,7 @@ var ts;
|
|
|
135392
135490
|
isNewIdentifierLocation = true;
|
|
135393
135491
|
}
|
|
135394
135492
|
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 {
|
|
135493
|
+
if (inCheckedFile) {
|
|
135404
135494
|
for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) {
|
|
135405
135495
|
var symbol = _a[_i];
|
|
135406
135496
|
if (typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, symbol)) {
|
|
@@ -135408,6 +135498,14 @@ var ts;
|
|
|
135408
135498
|
}
|
|
135409
135499
|
}
|
|
135410
135500
|
}
|
|
135501
|
+
else {
|
|
135502
|
+
// In javascript files, for union types, we don't just get the members that
|
|
135503
|
+
// the individual types have in common, we also include all the members that
|
|
135504
|
+
// each individual type has. This is because we're going to add all identifiers
|
|
135505
|
+
// anyways. So we might as well elevate the members that were at least part
|
|
135506
|
+
// of the individual types to a higher status since we know what they are.
|
|
135507
|
+
symbols.push.apply(symbols, ts.filter(getPropertiesForCompletion(type, typeChecker), function (s) { return typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, s); }));
|
|
135508
|
+
}
|
|
135411
135509
|
if (insertAwait && preferences.includeCompletionsWithInsertText) {
|
|
135412
135510
|
var promiseType = typeChecker.getPromisedTypeOfPromise(type);
|
|
135413
135511
|
if (promiseType) {
|
|
@@ -155770,7 +155868,7 @@ var ts;
|
|
|
155770
155868
|
if (!newConstraint)
|
|
155771
155869
|
return;
|
|
155772
155870
|
var newConstraintText = newConstraint[1];
|
|
155773
|
-
changes.insertText(related.file,
|
|
155871
|
+
changes.insertText(related.file, decl.name.end, " extends " + newConstraintText);
|
|
155774
155872
|
}
|
|
155775
155873
|
function findAncestorMatchingSpan(sourceFile, span) {
|
|
155776
155874
|
var token = ts.getTokenAtPosition(sourceFile, span.start);
|