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/tsserver.js
CHANGED
|
@@ -109,7 +109,7 @@ var ts;
|
|
|
109
109
|
// The following is baselined as a literal template type without intervention
|
|
110
110
|
/** The version of the TypeScript compiler release */
|
|
111
111
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
112
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
112
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220703";
|
|
113
113
|
/* @internal */
|
|
114
114
|
var Comparison;
|
|
115
115
|
(function (Comparison) {
|
|
@@ -3124,6 +3124,22 @@ var ts;
|
|
|
3124
3124
|
return wrapFunction(deprecation, func);
|
|
3125
3125
|
}
|
|
3126
3126
|
Debug.deprecate = deprecate;
|
|
3127
|
+
function formatVariance(varianceFlags) {
|
|
3128
|
+
var variance = varianceFlags & 7 /* VarianceMask */;
|
|
3129
|
+
var result = variance === 0 /* Invariant */ ? "in out" :
|
|
3130
|
+
variance === 3 /* Bivariant */ ? "[bivariant]" :
|
|
3131
|
+
variance === 2 /* Contravariant */ ? "in" :
|
|
3132
|
+
variance === 1 /* Covariant */ ? "out" :
|
|
3133
|
+
variance === 4 /* Independent */ ? "[independent]" : "";
|
|
3134
|
+
if (varianceFlags & 8 /* Unmeasurable */) {
|
|
3135
|
+
result += " (unmeasurable)";
|
|
3136
|
+
}
|
|
3137
|
+
else if (varianceFlags & 16 /* Unreliable */) {
|
|
3138
|
+
result += " (unreliable)";
|
|
3139
|
+
}
|
|
3140
|
+
return result;
|
|
3141
|
+
}
|
|
3142
|
+
Debug.formatVariance = formatVariance;
|
|
3127
3143
|
})(Debug = ts.Debug || (ts.Debug = {}));
|
|
3128
3144
|
})(ts || (ts = {}));
|
|
3129
3145
|
/* @internal */
|
|
@@ -3865,9 +3881,9 @@ var ts;
|
|
|
3865
3881
|
eventStack.push({ phase: phase, name: name, args: args, time: 1000 * ts.timestamp(), separateBeginAndEnd: separateBeginAndEnd });
|
|
3866
3882
|
}
|
|
3867
3883
|
tracingEnabled.push = push;
|
|
3868
|
-
function pop() {
|
|
3884
|
+
function pop(results) {
|
|
3869
3885
|
ts.Debug.assert(eventStack.length > 0);
|
|
3870
|
-
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp());
|
|
3886
|
+
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp(), results);
|
|
3871
3887
|
eventStack.length--;
|
|
3872
3888
|
}
|
|
3873
3889
|
tracingEnabled.pop = pop;
|
|
@@ -3881,14 +3897,15 @@ var ts;
|
|
|
3881
3897
|
tracingEnabled.popAll = popAll;
|
|
3882
3898
|
// sample every 10ms
|
|
3883
3899
|
var sampleInterval = 1000 * 10;
|
|
3884
|
-
function writeStackEvent(index, endTime) {
|
|
3900
|
+
function writeStackEvent(index, endTime, results) {
|
|
3885
3901
|
var _a = eventStack[index], phase = _a.phase, name = _a.name, args = _a.args, time = _a.time, separateBeginAndEnd = _a.separateBeginAndEnd;
|
|
3886
3902
|
if (separateBeginAndEnd) {
|
|
3903
|
+
ts.Debug.assert(!results, "`results` are not supported for events with `separateBeginAndEnd`");
|
|
3887
3904
|
writeEvent("E", phase, name, args, /*extras*/ undefined, endTime);
|
|
3888
3905
|
}
|
|
3889
3906
|
// test if [time,endTime) straddles a sampling point
|
|
3890
3907
|
else if (sampleInterval - (time % sampleInterval) <= endTime - time) {
|
|
3891
|
-
writeEvent("X", phase, name, args, "\"dur\":" + (endTime - time), time);
|
|
3908
|
+
writeEvent("X", phase, name, __assign(__assign({}, args), { results: results }), "\"dur\":" + (endTime - time), time);
|
|
3892
3909
|
}
|
|
3893
3910
|
}
|
|
3894
3911
|
function writeEvent(eventType, phase, name, args, extras, time) {
|
|
@@ -5259,9 +5276,10 @@ var ts;
|
|
|
5259
5276
|
(function (TypeMapKind) {
|
|
5260
5277
|
TypeMapKind[TypeMapKind["Simple"] = 0] = "Simple";
|
|
5261
5278
|
TypeMapKind[TypeMapKind["Array"] = 1] = "Array";
|
|
5262
|
-
TypeMapKind[TypeMapKind["
|
|
5263
|
-
TypeMapKind[TypeMapKind["
|
|
5264
|
-
TypeMapKind[TypeMapKind["
|
|
5279
|
+
TypeMapKind[TypeMapKind["Deferred"] = 2] = "Deferred";
|
|
5280
|
+
TypeMapKind[TypeMapKind["Function"] = 3] = "Function";
|
|
5281
|
+
TypeMapKind[TypeMapKind["Composite"] = 4] = "Composite";
|
|
5282
|
+
TypeMapKind[TypeMapKind["Merged"] = 5] = "Merged";
|
|
5265
5283
|
})(TypeMapKind = ts.TypeMapKind || (ts.TypeMapKind = {}));
|
|
5266
5284
|
var InferencePriority;
|
|
5267
5285
|
(function (InferencePriority) {
|
|
@@ -48664,6 +48682,24 @@ var ts;
|
|
|
48664
48682
|
var Symbol = ts.objectAllocator.getSymbolConstructor();
|
|
48665
48683
|
var Type = ts.objectAllocator.getTypeConstructor();
|
|
48666
48684
|
var Signature = ts.objectAllocator.getSignatureConstructor();
|
|
48685
|
+
var DebugTypeMapper = /** @class */ (function () {
|
|
48686
|
+
function DebugTypeMapper() {
|
|
48687
|
+
}
|
|
48688
|
+
DebugTypeMapper.prototype.__debugToString = function () {
|
|
48689
|
+
var _a;
|
|
48690
|
+
ts.Debug.type(this);
|
|
48691
|
+
switch (this.kind) {
|
|
48692
|
+
case 3 /* Function */: return ((_a = this.debugInfo) === null || _a === void 0 ? void 0 : _a.call(this)) || "(function mapper)";
|
|
48693
|
+
case 0 /* Simple */: return this.source.__debugTypeToString() + " -> " + this.target.__debugTypeToString();
|
|
48694
|
+
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(", ");
|
|
48695
|
+
case 2 /* Deferred */: return ts.zipWith(this.sources, this.targets, function (s, t) { return s.__debugTypeToString() + " -> " + t().__debugTypeToString(); }).join(", ");
|
|
48696
|
+
case 5 /* Merged */:
|
|
48697
|
+
case 4 /* Composite */: return "m1: " + this.mapper1.__debugToString().split("\n").join("\n ") + "\nm2: " + this.mapper2.__debugToString().split("\n").join("\n ");
|
|
48698
|
+
default: return ts.Debug.assertNever(this);
|
|
48699
|
+
}
|
|
48700
|
+
};
|
|
48701
|
+
return DebugTypeMapper;
|
|
48702
|
+
}());
|
|
48667
48703
|
var typeCount = 0;
|
|
48668
48704
|
var symbolCount = 0;
|
|
48669
48705
|
var enumCount = 0;
|
|
@@ -49124,10 +49160,23 @@ var ts;
|
|
|
49124
49160
|
var numberOrBigIntType = getUnionType([numberType, bigintType]);
|
|
49125
49161
|
var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
|
|
49126
49162
|
var numericStringType = getTemplateLiteralType(["", ""], [numberType]); // The `${number}` type
|
|
49127
|
-
var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; });
|
|
49128
|
-
var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? wildcardType : t; });
|
|
49163
|
+
var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; }, function () { return "(restrictive mapper)"; });
|
|
49164
|
+
var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? wildcardType : t; }, function () { return "(permissive mapper)"; });
|
|
49129
49165
|
var uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never"); // `uniqueLiteralType` is a special `never` flagged by union reduction to behave as a literal
|
|
49130
|
-
var uniqueLiteralMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? uniqueLiteralType : t; }); // replace all type parameters with the unique literal type (disregarding constraints)
|
|
49166
|
+
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)
|
|
49167
|
+
var outofbandVarianceMarkerHandler;
|
|
49168
|
+
var reportUnreliableMapper = makeFunctionTypeMapper(function (t) {
|
|
49169
|
+
if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
|
|
49170
|
+
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ true);
|
|
49171
|
+
}
|
|
49172
|
+
return t;
|
|
49173
|
+
}, function () { return "(unmeasurable reporter)"; });
|
|
49174
|
+
var reportUnmeasurableMapper = makeFunctionTypeMapper(function (t) {
|
|
49175
|
+
if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
|
|
49176
|
+
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ false);
|
|
49177
|
+
}
|
|
49178
|
+
return t;
|
|
49179
|
+
}, function () { return "(unreliable reporter)"; });
|
|
49131
49180
|
var emptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49132
49181
|
var emptyJsxObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49133
49182
|
emptyJsxObjectType.objectFlags |= 2048 /* JsxAttributes */;
|
|
@@ -49287,7 +49336,6 @@ var ts;
|
|
|
49287
49336
|
var typeofType = createTypeofType();
|
|
49288
49337
|
var _jsxNamespace;
|
|
49289
49338
|
var _jsxFactoryEntity;
|
|
49290
|
-
var outofbandVarianceMarkerHandler;
|
|
49291
49339
|
var subtypeRelation = new ts.Map();
|
|
49292
49340
|
var strictSubtypeRelation = new ts.Map();
|
|
49293
49341
|
var assignableRelation = new ts.Map();
|
|
@@ -53054,7 +53102,7 @@ var ts;
|
|
|
53054
53102
|
var name = typeParameterToName(newParam, context);
|
|
53055
53103
|
var newTypeVariable = ts.factory.createTypeReferenceNode(name);
|
|
53056
53104
|
context.approximateLength += 37; // 15 each for two added conditionals, 7 for an added infer type
|
|
53057
|
-
var newMapper = prependTypeMapping(type.root.checkType, newParam, type.
|
|
53105
|
+
var newMapper = prependTypeMapping(type.root.checkType, newParam, type.mapper);
|
|
53058
53106
|
var saveInferTypeParameters_1 = context.inferTypeParameters;
|
|
53059
53107
|
context.inferTypeParameters = type.root.inferTypeParameters;
|
|
53060
53108
|
var extendsTypeNode_1 = typeToTypeNodeHelper(instantiateType(type.root.extendsType, newMapper), context);
|
|
@@ -60465,8 +60513,7 @@ var ts;
|
|
|
60465
60513
|
var _a;
|
|
60466
60514
|
var inferences;
|
|
60467
60515
|
if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
|
|
60468
|
-
|
|
60469
|
-
var declaration = _b[_i];
|
|
60516
|
+
var _loop_15 = function (declaration) {
|
|
60470
60517
|
if (declaration.parent.kind === 190 /* InferType */) {
|
|
60471
60518
|
// When an 'infer T' declaration is immediately contained in a type reference node
|
|
60472
60519
|
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
|
|
@@ -60474,12 +60521,12 @@ var ts;
|
|
|
60474
60521
|
// present, we form an intersection of the inferred constraint types.
|
|
60475
60522
|
var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1];
|
|
60476
60523
|
if (grandParent.kind === 178 /* TypeReference */ && !omitTypeReferences) {
|
|
60477
|
-
var
|
|
60478
|
-
var
|
|
60479
|
-
if (
|
|
60480
|
-
var index =
|
|
60481
|
-
if (index <
|
|
60482
|
-
var declaredConstraint = getConstraintOfTypeParameter(
|
|
60524
|
+
var typeReference_1 = grandParent;
|
|
60525
|
+
var typeParameters_1 = getTypeParametersForTypeReference(typeReference_1);
|
|
60526
|
+
if (typeParameters_1) {
|
|
60527
|
+
var index = typeReference_1.typeArguments.indexOf(childTypeParameter);
|
|
60528
|
+
if (index < typeParameters_1.length) {
|
|
60529
|
+
var declaredConstraint = getConstraintOfTypeParameter(typeParameters_1[index]);
|
|
60483
60530
|
if (declaredConstraint) {
|
|
60484
60531
|
// Type parameter constraints can reference other type parameters so
|
|
60485
60532
|
// constraints need to be instantiated. If instantiation produces the
|
|
@@ -60487,7 +60534,9 @@ var ts;
|
|
|
60487
60534
|
// type Foo<T extends string, U extends T> = [T, U];
|
|
60488
60535
|
// type Bar<T> = T extends Foo<infer X, infer X> ? Foo<X, X> : T;
|
|
60489
60536
|
// the instantiated constraint for U is X, so we discard that inference.
|
|
60490
|
-
var mapper =
|
|
60537
|
+
var mapper = makeDeferredTypeMapper(typeParameters_1, typeParameters_1.map(function (_, index) { return function () {
|
|
60538
|
+
return getEffectiveTypeArgumentAtIndex(typeReference_1, typeParameters_1, index);
|
|
60539
|
+
}; }));
|
|
60491
60540
|
var constraint = instantiateType(declaredConstraint, mapper);
|
|
60492
60541
|
if (constraint !== typeParameter) {
|
|
60493
60542
|
inferences = ts.append(inferences, constraint);
|
|
@@ -60525,6 +60574,10 @@ var ts;
|
|
|
60525
60574
|
inferences = ts.append(inferences, instantiateType(nodeType, makeUnaryTypeMapper(getDeclaredTypeOfTypeParameter(getSymbolOfNode(checkMappedType_1.typeParameter)), checkMappedType_1.typeParameter.constraint ? getTypeFromTypeNode(checkMappedType_1.typeParameter.constraint) : keyofConstraintType)));
|
|
60526
60575
|
}
|
|
60527
60576
|
}
|
|
60577
|
+
};
|
|
60578
|
+
for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
|
|
60579
|
+
var declaration = _b[_i];
|
|
60580
|
+
_loop_15(declaration);
|
|
60528
60581
|
}
|
|
60529
60582
|
}
|
|
60530
60583
|
return inferences && getIntersectionType(inferences);
|
|
@@ -61413,7 +61466,7 @@ var ts;
|
|
|
61413
61466
|
var lastRequiredIndex = -1;
|
|
61414
61467
|
var firstRestIndex = -1;
|
|
61415
61468
|
var lastOptionalOrRestIndex = -1;
|
|
61416
|
-
var
|
|
61469
|
+
var _loop_16 = function (i) {
|
|
61417
61470
|
var type = elementTypes[i];
|
|
61418
61471
|
var flags = target.elementFlags[i];
|
|
61419
61472
|
if (flags & 8 /* Variadic */) {
|
|
@@ -61443,7 +61496,7 @@ var ts;
|
|
|
61443
61496
|
}
|
|
61444
61497
|
};
|
|
61445
61498
|
for (var i = 0; i < elementTypes.length; i++) {
|
|
61446
|
-
var state_4 =
|
|
61499
|
+
var state_4 = _loop_16(i);
|
|
61447
61500
|
if (typeof state_4 === "object")
|
|
61448
61501
|
return state_4.value;
|
|
61449
61502
|
}
|
|
@@ -61639,7 +61692,7 @@ var ts;
|
|
|
61639
61692
|
var templates = ts.filter(types, isPatternLiteralType);
|
|
61640
61693
|
if (templates.length) {
|
|
61641
61694
|
var i = types.length;
|
|
61642
|
-
var
|
|
61695
|
+
var _loop_17 = function () {
|
|
61643
61696
|
i--;
|
|
61644
61697
|
var t = types[i];
|
|
61645
61698
|
if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
|
|
@@ -61647,7 +61700,7 @@ var ts;
|
|
|
61647
61700
|
}
|
|
61648
61701
|
};
|
|
61649
61702
|
while (i > 0) {
|
|
61650
|
-
|
|
61703
|
+
_loop_17();
|
|
61651
61704
|
}
|
|
61652
61705
|
}
|
|
61653
61706
|
}
|
|
@@ -61724,14 +61777,14 @@ var ts;
|
|
|
61724
61777
|
var namedUnions = [];
|
|
61725
61778
|
addNamedUnions(namedUnions, types);
|
|
61726
61779
|
var reducedTypes = [];
|
|
61727
|
-
var
|
|
61780
|
+
var _loop_18 = function (t) {
|
|
61728
61781
|
if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
|
|
61729
61782
|
reducedTypes.push(t);
|
|
61730
61783
|
}
|
|
61731
61784
|
};
|
|
61732
61785
|
for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
|
|
61733
61786
|
var t = typeSet_1[_i];
|
|
61734
|
-
|
|
61787
|
+
_loop_18(t);
|
|
61735
61788
|
}
|
|
61736
61789
|
if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
|
|
61737
61790
|
return namedUnions[0];
|
|
@@ -62955,7 +63008,7 @@ var ts;
|
|
|
62955
63008
|
var result;
|
|
62956
63009
|
var extraTypes;
|
|
62957
63010
|
var tailCount = 0;
|
|
62958
|
-
var
|
|
63011
|
+
var _loop_19 = function () {
|
|
62959
63012
|
if (tailCount === 1000) {
|
|
62960
63013
|
error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
62961
63014
|
result = errorType;
|
|
@@ -63076,7 +63129,7 @@ var ts;
|
|
|
63076
63129
|
// another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
|
|
63077
63130
|
// cases we increment the tail recursion counter and stop after 1000 iterations.
|
|
63078
63131
|
while (true) {
|
|
63079
|
-
var state_5 =
|
|
63132
|
+
var state_5 = _loop_19();
|
|
63080
63133
|
if (typeof state_5 === "object")
|
|
63081
63134
|
return state_5.value;
|
|
63082
63135
|
if (state_5 === "break")
|
|
@@ -63706,7 +63759,7 @@ var ts;
|
|
|
63706
63759
|
switch (mapper.kind) {
|
|
63707
63760
|
case 0 /* Simple */:
|
|
63708
63761
|
return type === mapper.source ? mapper.target : type;
|
|
63709
|
-
case 1 /* Array */:
|
|
63762
|
+
case 1 /* Array */: {
|
|
63710
63763
|
var sources = mapper.sources;
|
|
63711
63764
|
var targets = mapper.targets;
|
|
63712
63765
|
for (var i = 0; i < sources.length; i++) {
|
|
@@ -63715,25 +63768,45 @@ var ts;
|
|
|
63715
63768
|
}
|
|
63716
63769
|
}
|
|
63717
63770
|
return type;
|
|
63718
|
-
|
|
63771
|
+
}
|
|
63772
|
+
case 2 /* Deferred */: {
|
|
63773
|
+
var sources = mapper.sources;
|
|
63774
|
+
var targets = mapper.targets;
|
|
63775
|
+
for (var i = 0; i < sources.length; i++) {
|
|
63776
|
+
if (type === sources[i]) {
|
|
63777
|
+
return targets[i]();
|
|
63778
|
+
}
|
|
63779
|
+
}
|
|
63780
|
+
return type;
|
|
63781
|
+
}
|
|
63782
|
+
case 3 /* Function */:
|
|
63719
63783
|
return mapper.func(type);
|
|
63720
|
-
case
|
|
63721
|
-
case
|
|
63784
|
+
case 4 /* Composite */:
|
|
63785
|
+
case 5 /* Merged */:
|
|
63722
63786
|
var t1 = getMappedType(type, mapper.mapper1);
|
|
63723
|
-
return t1 !== type && mapper.kind ===
|
|
63787
|
+
return t1 !== type && mapper.kind === 4 /* Composite */ ? instantiateType(t1, mapper.mapper2) : getMappedType(t1, mapper.mapper2);
|
|
63788
|
+
}
|
|
63789
|
+
}
|
|
63790
|
+
function attachDebugPrototypeIfDebug(mapper) {
|
|
63791
|
+
if (ts.Debug.isDebugging) {
|
|
63792
|
+
return Object.setPrototypeOf(mapper, DebugTypeMapper.prototype);
|
|
63724
63793
|
}
|
|
63794
|
+
return mapper;
|
|
63725
63795
|
}
|
|
63726
63796
|
function makeUnaryTypeMapper(source, target) {
|
|
63727
|
-
return { kind: 0 /* Simple */, source: source, target: target };
|
|
63797
|
+
return attachDebugPrototypeIfDebug({ kind: 0 /* Simple */, source: source, target: target });
|
|
63728
63798
|
}
|
|
63729
63799
|
function makeArrayTypeMapper(sources, targets) {
|
|
63730
|
-
return { kind: 1 /* Array */, sources: sources, targets: targets };
|
|
63800
|
+
return attachDebugPrototypeIfDebug({ kind: 1 /* Array */, sources: sources, targets: targets });
|
|
63801
|
+
}
|
|
63802
|
+
function makeFunctionTypeMapper(func, debugInfo) {
|
|
63803
|
+
return attachDebugPrototypeIfDebug({ kind: 3 /* Function */, func: func, debugInfo: ts.Debug.isDebugging ? debugInfo : undefined });
|
|
63731
63804
|
}
|
|
63732
|
-
function
|
|
63733
|
-
return { kind: 2 /*
|
|
63805
|
+
function makeDeferredTypeMapper(sources, targets) {
|
|
63806
|
+
return attachDebugPrototypeIfDebug({ kind: 2 /* Deferred */, sources: sources, targets: targets });
|
|
63734
63807
|
}
|
|
63735
63808
|
function makeCompositeTypeMapper(kind, mapper1, mapper2) {
|
|
63736
|
-
return { kind: kind, mapper1: mapper1, mapper2: mapper2 };
|
|
63809
|
+
return attachDebugPrototypeIfDebug({ kind: kind, mapper1: mapper1, mapper2: mapper2 });
|
|
63737
63810
|
}
|
|
63738
63811
|
function createTypeEraser(sources) {
|
|
63739
63812
|
return createTypeMapper(sources, /*targets*/ undefined);
|
|
@@ -63743,19 +63816,20 @@ var ts;
|
|
|
63743
63816
|
* This is used during inference when instantiating type parameter defaults.
|
|
63744
63817
|
*/
|
|
63745
63818
|
function createBackreferenceMapper(context, index) {
|
|
63746
|
-
|
|
63819
|
+
var forwardInferences = context.inferences.slice(index);
|
|
63820
|
+
return createTypeMapper(ts.map(forwardInferences, function (i) { return i.typeParameter; }), ts.map(forwardInferences, function () { return unknownType; }));
|
|
63747
63821
|
}
|
|
63748
63822
|
function combineTypeMappers(mapper1, mapper2) {
|
|
63749
|
-
return mapper1 ? makeCompositeTypeMapper(
|
|
63823
|
+
return mapper1 ? makeCompositeTypeMapper(4 /* Composite */, mapper1, mapper2) : mapper2;
|
|
63750
63824
|
}
|
|
63751
63825
|
function mergeTypeMappers(mapper1, mapper2) {
|
|
63752
|
-
return mapper1 ? makeCompositeTypeMapper(
|
|
63826
|
+
return mapper1 ? makeCompositeTypeMapper(5 /* Merged */, mapper1, mapper2) : mapper2;
|
|
63753
63827
|
}
|
|
63754
63828
|
function prependTypeMapping(source, target, mapper) {
|
|
63755
|
-
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(
|
|
63829
|
+
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* Merged */, makeUnaryTypeMapper(source, target), mapper);
|
|
63756
63830
|
}
|
|
63757
63831
|
function appendTypeMapping(mapper, source, target) {
|
|
63758
|
-
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(
|
|
63832
|
+
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* Merged */, mapper, makeUnaryTypeMapper(source, target));
|
|
63759
63833
|
}
|
|
63760
63834
|
function getRestrictiveTypeParameter(tp) {
|
|
63761
63835
|
return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol),
|
|
@@ -65651,7 +65725,7 @@ var ts;
|
|
|
65651
65725
|
reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
|
|
65652
65726
|
checkTypes = reducedTarget.flags & 1048576 /* Union */ ? reducedTarget.types : [reducedTarget];
|
|
65653
65727
|
}
|
|
65654
|
-
var
|
|
65728
|
+
var _loop_20 = function (prop) {
|
|
65655
65729
|
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
|
|
65656
65730
|
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
|
|
65657
65731
|
if (reportErrors) {
|
|
@@ -65714,7 +65788,7 @@ var ts;
|
|
|
65714
65788
|
};
|
|
65715
65789
|
for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
|
|
65716
65790
|
var prop = _b[_i];
|
|
65717
|
-
var state_6 =
|
|
65791
|
+
var state_6 = _loop_20(prop);
|
|
65718
65792
|
if (typeof state_6 === "object")
|
|
65719
65793
|
return state_6.value;
|
|
65720
65794
|
}
|
|
@@ -65946,10 +66020,10 @@ var ts;
|
|
|
65946
66020
|
// We're in the middle of variance checking - integrate any unmeasurable/unreliable flags from this cached component
|
|
65947
66021
|
var saved = entry & 24 /* ReportsMask */;
|
|
65948
66022
|
if (saved & 8 /* ReportsUnmeasurable */) {
|
|
65949
|
-
instantiateType(source,
|
|
66023
|
+
instantiateType(source, reportUnmeasurableMapper);
|
|
65950
66024
|
}
|
|
65951
66025
|
if (saved & 16 /* ReportsUnreliable */) {
|
|
65952
|
-
instantiateType(source,
|
|
66026
|
+
instantiateType(source, reportUnreliableMapper);
|
|
65953
66027
|
}
|
|
65954
66028
|
}
|
|
65955
66029
|
return entry & 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */;
|
|
@@ -66375,7 +66449,7 @@ var ts;
|
|
|
66375
66449
|
}
|
|
66376
66450
|
// Report unreliable variance for type variables referenced in template literal type placeholders.
|
|
66377
66451
|
// For example, `foo-${number}` is related to `foo-${string}` even though number isn't related to string.
|
|
66378
|
-
instantiateType(source,
|
|
66452
|
+
instantiateType(source, reportUnreliableMapper);
|
|
66379
66453
|
}
|
|
66380
66454
|
if (isTypeMatchedByTemplateLiteralType(source, target)) {
|
|
66381
66455
|
return -1 /* True */;
|
|
@@ -66647,18 +66721,6 @@ var ts;
|
|
|
66647
66721
|
}
|
|
66648
66722
|
}
|
|
66649
66723
|
}
|
|
66650
|
-
function reportUnmeasurableMarkers(p) {
|
|
66651
|
-
if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
|
|
66652
|
-
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ false);
|
|
66653
|
-
}
|
|
66654
|
-
return p;
|
|
66655
|
-
}
|
|
66656
|
-
function reportUnreliableMarkers(p) {
|
|
66657
|
-
if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
|
|
66658
|
-
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ true);
|
|
66659
|
-
}
|
|
66660
|
-
return p;
|
|
66661
|
-
}
|
|
66662
66724
|
// A type [P in S]: X is related to a type [Q in T]: Y if T is related to S and X' is
|
|
66663
66725
|
// related to Y, where X' is an instantiation of X in which P is replaced with Q. Notice
|
|
66664
66726
|
// that S and T are contra-variant whereas X and Y are co-variant.
|
|
@@ -66668,7 +66730,7 @@ var ts;
|
|
|
66668
66730
|
if (modifiersRelated) {
|
|
66669
66731
|
var result_10;
|
|
66670
66732
|
var targetConstraint = getConstraintTypeFromMappedType(target);
|
|
66671
|
-
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source),
|
|
66733
|
+
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMapper : reportUnreliableMapper);
|
|
66672
66734
|
if (result_10 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
|
|
66673
66735
|
var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
|
|
66674
66736
|
if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
|
|
@@ -66722,11 +66784,11 @@ var ts;
|
|
|
66722
66784
|
// constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
|
|
66723
66785
|
var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
|
|
66724
66786
|
var matchingTypes = [];
|
|
66725
|
-
var
|
|
66787
|
+
var _loop_21 = function (combination) {
|
|
66726
66788
|
var hasMatch = false;
|
|
66727
66789
|
outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
|
|
66728
66790
|
var type = _d[_c];
|
|
66729
|
-
var
|
|
66791
|
+
var _loop_22 = function (i) {
|
|
66730
66792
|
var sourceProperty = sourcePropertiesFiltered[i];
|
|
66731
66793
|
var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
|
|
66732
66794
|
if (!targetProperty)
|
|
@@ -66742,7 +66804,7 @@ var ts;
|
|
|
66742
66804
|
}
|
|
66743
66805
|
};
|
|
66744
66806
|
for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
|
|
66745
|
-
var state_8 =
|
|
66807
|
+
var state_8 = _loop_22(i);
|
|
66746
66808
|
switch (state_8) {
|
|
66747
66809
|
case "continue-outer": continue outer;
|
|
66748
66810
|
}
|
|
@@ -66756,7 +66818,7 @@ var ts;
|
|
|
66756
66818
|
};
|
|
66757
66819
|
for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
|
|
66758
66820
|
var combination = discriminantCombinations_1[_a];
|
|
66759
|
-
var state_7 =
|
|
66821
|
+
var state_7 = _loop_21(combination);
|
|
66760
66822
|
if (typeof state_7 === "object")
|
|
66761
66823
|
return state_7.value;
|
|
66762
66824
|
}
|
|
@@ -67204,7 +67266,7 @@ var ts;
|
|
|
67204
67266
|
* See signatureAssignableTo, compareSignaturesIdentical
|
|
67205
67267
|
*/
|
|
67206
67268
|
function signatureRelatedTo(source, target, erase, reportErrors, incompatibleReporter) {
|
|
67207
|
-
return compareSignaturesRelated(erase ? getErasedSignature(source) : source, erase ? getErasedSignature(target) : target, relation === strictSubtypeRelation ? 8 /* StrictArity */ : 0, reportErrors, reportError, incompatibleReporter, isRelatedToWorker,
|
|
67269
|
+
return compareSignaturesRelated(erase ? getErasedSignature(source) : source, erase ? getErasedSignature(target) : target, relation === strictSubtypeRelation ? 8 /* StrictArity */ : 0, reportErrors, reportError, incompatibleReporter, isRelatedToWorker, reportUnreliableMapper);
|
|
67208
67270
|
}
|
|
67209
67271
|
function signaturesIdenticalTo(source, target, kind) {
|
|
67210
67272
|
var sourceSignatures = getSignaturesOfType(source, kind);
|
|
@@ -67463,7 +67525,7 @@ var ts;
|
|
|
67463
67525
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
|
|
67464
67526
|
links.variances = ts.emptyArray;
|
|
67465
67527
|
var variances = [];
|
|
67466
|
-
var
|
|
67528
|
+
var _loop_23 = function (tp) {
|
|
67467
67529
|
var modifiers = getVarianceModifiers(tp);
|
|
67468
67530
|
var variance = modifiers & 65536 /* Out */ ?
|
|
67469
67531
|
modifiers & 32768 /* In */ ? 0 /* Invariant */ : 1 /* Covariant */ :
|
|
@@ -67499,12 +67561,12 @@ var ts;
|
|
|
67499
67561
|
}
|
|
67500
67562
|
variances.push(variance);
|
|
67501
67563
|
};
|
|
67502
|
-
for (var _i = 0,
|
|
67503
|
-
var tp =
|
|
67504
|
-
|
|
67564
|
+
for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
|
|
67565
|
+
var tp = typeParameters_2[_i];
|
|
67566
|
+
_loop_23(tp);
|
|
67505
67567
|
}
|
|
67506
67568
|
links.variances = variances;
|
|
67507
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
67569
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
|
|
67508
67570
|
}
|
|
67509
67571
|
return links.variances;
|
|
67510
67572
|
}
|
|
@@ -68496,27 +68558,29 @@ var ts;
|
|
|
68496
68558
|
signature: signature,
|
|
68497
68559
|
flags: flags,
|
|
68498
68560
|
compareTypes: compareTypes,
|
|
68499
|
-
mapper:
|
|
68500
|
-
nonFixingMapper:
|
|
68561
|
+
mapper: reportUnmeasurableMapper,
|
|
68562
|
+
nonFixingMapper: reportUnmeasurableMapper,
|
|
68501
68563
|
};
|
|
68564
|
+
context.mapper = makeFixingMapperForContext(context);
|
|
68565
|
+
context.nonFixingMapper = makeNonFixingMapperForContext(context);
|
|
68502
68566
|
return context;
|
|
68503
68567
|
}
|
|
68504
|
-
function
|
|
68505
|
-
|
|
68506
|
-
|
|
68507
|
-
|
|
68508
|
-
|
|
68509
|
-
|
|
68510
|
-
|
|
68511
|
-
|
|
68512
|
-
inferFromIntraExpressionSites(context);
|
|
68513
|
-
clearCachedInferences(inferences);
|
|
68514
|
-
inference.isFixed = true;
|
|
68515
|
-
}
|
|
68516
|
-
return getInferredType(context, i);
|
|
68568
|
+
function makeFixingMapperForContext(context) {
|
|
68569
|
+
return makeDeferredTypeMapper(ts.map(context.inferences, function (i) { return i.typeParameter; }), ts.map(context.inferences, function (inference, i) { return function () {
|
|
68570
|
+
if (!inference.isFixed) {
|
|
68571
|
+
// Before we commit to a particular inference (and thus lock out any further inferences),
|
|
68572
|
+
// we infer from any intra-expression inference sites we have collected.
|
|
68573
|
+
inferFromIntraExpressionSites(context);
|
|
68574
|
+
clearCachedInferences(context.inferences);
|
|
68575
|
+
inference.isFixed = true;
|
|
68517
68576
|
}
|
|
68518
|
-
|
|
68519
|
-
|
|
68577
|
+
return getInferredType(context, i);
|
|
68578
|
+
}; }));
|
|
68579
|
+
}
|
|
68580
|
+
function makeNonFixingMapperForContext(context) {
|
|
68581
|
+
return makeDeferredTypeMapper(ts.map(context.inferences, function (i) { return i.typeParameter; }), ts.map(context.inferences, function (_, i) { return function () {
|
|
68582
|
+
return getInferredType(context, i);
|
|
68583
|
+
}; }));
|
|
68520
68584
|
}
|
|
68521
68585
|
function clearCachedInferences(inferences) {
|
|
68522
68586
|
for (var _i = 0, inferences_1 = inferences; _i < inferences_1.length; _i++) {
|
|
@@ -69436,7 +69500,7 @@ var ts;
|
|
|
69436
69500
|
// upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
|
|
69437
69501
|
// succeed. That would be a pointless and confusing outcome.
|
|
69438
69502
|
if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
|
|
69439
|
-
var
|
|
69503
|
+
var _loop_24 = function (i) {
|
|
69440
69504
|
var source_1 = matches ? matches[i] : neverType;
|
|
69441
69505
|
var target_3 = types[i];
|
|
69442
69506
|
// If we are inferring from a string literal type to a type variable whose constraint includes one of the
|
|
@@ -69486,7 +69550,7 @@ var ts;
|
|
|
69486
69550
|
inferFromTypes(source_1, target_3);
|
|
69487
69551
|
};
|
|
69488
69552
|
for (var i = 0; i < types.length; i++) {
|
|
69489
|
-
|
|
69553
|
+
_loop_24(i);
|
|
69490
69554
|
}
|
|
69491
69555
|
}
|
|
69492
69556
|
}
|
|
@@ -70004,7 +70068,7 @@ var ts;
|
|
|
70004
70068
|
function mapTypesByKeyProperty(types, name) {
|
|
70005
70069
|
var map = new ts.Map();
|
|
70006
70070
|
var count = 0;
|
|
70007
|
-
var
|
|
70071
|
+
var _loop_25 = function (type) {
|
|
70008
70072
|
if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
70009
70073
|
var discriminant = getTypeOfPropertyOfType(type, name);
|
|
70010
70074
|
if (discriminant) {
|
|
@@ -70030,7 +70094,7 @@ var ts;
|
|
|
70030
70094
|
};
|
|
70031
70095
|
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
|
|
70032
70096
|
var type = types_15[_i];
|
|
70033
|
-
var state_9 =
|
|
70097
|
+
var state_9 = _loop_25(type);
|
|
70034
70098
|
if (typeof state_9 === "object")
|
|
70035
70099
|
return state_9.value;
|
|
70036
70100
|
}
|
|
@@ -76379,7 +76443,7 @@ var ts;
|
|
|
76379
76443
|
if (spreadIndex >= 0) {
|
|
76380
76444
|
// Create synthetic arguments from spreads of tuple types.
|
|
76381
76445
|
var effectiveArgs_1 = args.slice(0, spreadIndex);
|
|
76382
|
-
var
|
|
76446
|
+
var _loop_26 = function (i) {
|
|
76383
76447
|
var arg = args[i];
|
|
76384
76448
|
// We can call checkExpressionCached because spread expressions never have a contextual type.
|
|
76385
76449
|
var spreadType = arg.kind === 225 /* SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
|
|
@@ -76396,7 +76460,7 @@ var ts;
|
|
|
76396
76460
|
}
|
|
76397
76461
|
};
|
|
76398
76462
|
for (var i = spreadIndex; i < args.length; i++) {
|
|
76399
|
-
|
|
76463
|
+
_loop_26(i);
|
|
76400
76464
|
}
|
|
76401
76465
|
return effectiveArgs_1;
|
|
76402
76466
|
}
|
|
@@ -76725,7 +76789,7 @@ var ts;
|
|
|
76725
76789
|
var min_3 = Number.MAX_VALUE;
|
|
76726
76790
|
var minIndex = 0;
|
|
76727
76791
|
var i_1 = 0;
|
|
76728
|
-
var
|
|
76792
|
+
var _loop_27 = function (c) {
|
|
76729
76793
|
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)); };
|
|
76730
76794
|
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2);
|
|
76731
76795
|
if (diags_2) {
|
|
@@ -76743,7 +76807,7 @@ var ts;
|
|
|
76743
76807
|
};
|
|
76744
76808
|
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
|
|
76745
76809
|
var c = candidatesForArgumentError_1[_a];
|
|
76746
|
-
|
|
76810
|
+
_loop_27(c);
|
|
76747
76811
|
}
|
|
76748
76812
|
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
|
|
76749
76813
|
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
|
|
@@ -76901,7 +76965,7 @@ var ts;
|
|
|
76901
76965
|
}
|
|
76902
76966
|
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
|
|
76903
76967
|
var parameters = [];
|
|
76904
|
-
var
|
|
76968
|
+
var _loop_28 = function (i) {
|
|
76905
76969
|
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
|
|
76906
76970
|
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
|
|
76907
76971
|
i < s.parameters.length ? s.parameters[i] : undefined; });
|
|
@@ -76909,7 +76973,7 @@ var ts;
|
|
|
76909
76973
|
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
|
|
76910
76974
|
};
|
|
76911
76975
|
for (var i = 0; i < maxNonRestParam; i++) {
|
|
76912
|
-
|
|
76976
|
+
_loop_28(i);
|
|
76913
76977
|
}
|
|
76914
76978
|
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
|
|
76915
76979
|
var flags = 0 /* None */;
|
|
@@ -80262,8 +80326,8 @@ var ts;
|
|
|
80262
80326
|
var result = [];
|
|
80263
80327
|
var oldTypeParameters;
|
|
80264
80328
|
var newTypeParameters;
|
|
80265
|
-
for (var _i = 0,
|
|
80266
|
-
var tp =
|
|
80329
|
+
for (var _i = 0, typeParameters_3 = typeParameters; _i < typeParameters_3.length; _i++) {
|
|
80330
|
+
var tp = typeParameters_3[_i];
|
|
80267
80331
|
var name = tp.symbol.escapedName;
|
|
80268
80332
|
if (hasTypeParameterByName(context.inferredTypeParameters, name) || hasTypeParameterByName(result, name)) {
|
|
80269
80333
|
var newName = getUniqueTypeParameterName(ts.concatenate(context.inferredTypeParameters, result), name);
|
|
@@ -80585,12 +80649,14 @@ var ts;
|
|
|
80585
80649
|
error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
80586
80650
|
}
|
|
80587
80651
|
else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
80652
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
80588
80653
|
var source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck);
|
|
80589
80654
|
var target = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSuperTypeForCheck : markerSubTypeForCheck);
|
|
80590
80655
|
var saveVarianceTypeParameter = typeParameter;
|
|
80591
80656
|
varianceTypeParameter = typeParameter;
|
|
80592
80657
|
checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
|
|
80593
80658
|
varianceTypeParameter = saveVarianceTypeParameter;
|
|
80659
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
80594
80660
|
}
|
|
80595
80661
|
}
|
|
80596
80662
|
}
|
|
@@ -80940,7 +81006,7 @@ var ts;
|
|
|
80940
81006
|
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
|
|
80941
81007
|
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
|
|
80942
81008
|
var indexSignatureMap_1 = new ts.Map();
|
|
80943
|
-
var
|
|
81009
|
+
var _loop_29 = function (declaration) {
|
|
80944
81010
|
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
|
|
80945
81011
|
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
|
|
80946
81012
|
var entry = indexSignatureMap_1.get(getTypeId(type));
|
|
@@ -80955,7 +81021,7 @@ var ts;
|
|
|
80955
81021
|
};
|
|
80956
81022
|
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
|
|
80957
81023
|
var declaration = _a[_i];
|
|
80958
|
-
|
|
81024
|
+
_loop_29(declaration);
|
|
80959
81025
|
}
|
|
80960
81026
|
indexSignatureMap_1.forEach(function (entry) {
|
|
80961
81027
|
if (entry.declarations.length > 1) {
|
|
@@ -81178,6 +81244,12 @@ var ts;
|
|
|
81178
81244
|
function checkMissingDeclaration(node) {
|
|
81179
81245
|
checkDecorators(node);
|
|
81180
81246
|
}
|
|
81247
|
+
function getEffectiveTypeArgumentAtIndex(node, typeParameters, index) {
|
|
81248
|
+
if (index < typeParameters.length) {
|
|
81249
|
+
return getTypeFromTypeNode(node.typeArguments[index]);
|
|
81250
|
+
}
|
|
81251
|
+
return getEffectiveTypeArguments(node, typeParameters)[index];
|
|
81252
|
+
}
|
|
81181
81253
|
function getEffectiveTypeArguments(node, typeParameters) {
|
|
81182
81254
|
return fillMissingTypeArguments(ts.map(node.typeArguments, getTypeFromTypeNode), typeParameters, getMinTypeArgumentCount(typeParameters), ts.isInJSFile(node));
|
|
81183
81255
|
}
|
|
@@ -81919,6 +81991,32 @@ var ts;
|
|
|
81919
81991
|
isAwaitedTypeInstantiation(type) ? type.aliasTypeArguments[0] :
|
|
81920
81992
|
type;
|
|
81921
81993
|
}
|
|
81994
|
+
function isAwaitedTypeNeeded(type) {
|
|
81995
|
+
// If this is already an `Awaited<T>`, we shouldn't wrap it. This helps to avoid `Awaited<Awaited<T>>` in higher-order.
|
|
81996
|
+
if (isTypeAny(type) || isAwaitedTypeInstantiation(type)) {
|
|
81997
|
+
return false;
|
|
81998
|
+
}
|
|
81999
|
+
// We only need `Awaited<T>` if `T` contains possibly non-primitive types.
|
|
82000
|
+
if (isGenericObjectType(type)) {
|
|
82001
|
+
var baseConstraint = getBaseConstraintOfType(type);
|
|
82002
|
+
// We only need `Awaited<T>` if `T` has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
|
|
82003
|
+
// or is promise-like.
|
|
82004
|
+
if (!baseConstraint || (baseConstraint.flags & 3 /* AnyOrUnknown */) || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint)) {
|
|
82005
|
+
return true;
|
|
82006
|
+
}
|
|
82007
|
+
}
|
|
82008
|
+
return false;
|
|
82009
|
+
}
|
|
82010
|
+
function tryCreateAwaitedType(type) {
|
|
82011
|
+
// Nothing to do if `Awaited<T>` doesn't exist
|
|
82012
|
+
var awaitedSymbol = getGlobalAwaitedSymbol(/*reportErrors*/ true);
|
|
82013
|
+
if (awaitedSymbol) {
|
|
82014
|
+
// Unwrap unions that may contain `Awaited<T>`, otherwise its possible to manufacture an `Awaited<Awaited<T> | U>` where
|
|
82015
|
+
// an `Awaited<T | U>` would suffice.
|
|
82016
|
+
return getTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
|
|
82017
|
+
}
|
|
82018
|
+
return undefined;
|
|
82019
|
+
}
|
|
81922
82020
|
function createAwaitedTypeIfNeeded(type) {
|
|
81923
82021
|
// We wrap type `T` in `Awaited<T>` based on the following conditions:
|
|
81924
82022
|
// - `T` is not already an `Awaited<U>`, and
|
|
@@ -81927,26 +82025,10 @@ var ts;
|
|
|
81927
82025
|
// - `T` has no base constraint, or
|
|
81928
82026
|
// - The base constraint of `T` is `any`, `unknown`, `object`, or `{}`, or
|
|
81929
82027
|
// - The base constraint of `T` is an object type with a callable `then` method.
|
|
81930
|
-
if (
|
|
81931
|
-
|
|
81932
|
-
|
|
81933
|
-
|
|
81934
|
-
if (isAwaitedTypeInstantiation(type)) {
|
|
81935
|
-
return type;
|
|
81936
|
-
}
|
|
81937
|
-
// Only instantiate `Awaited<T>` if `T` contains possibly non-primitive types.
|
|
81938
|
-
if (isGenericObjectType(type)) {
|
|
81939
|
-
var baseConstraint = getBaseConstraintOfType(type);
|
|
81940
|
-
// Only instantiate `Awaited<T>` if `T` has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
|
|
81941
|
-
// or is promise-like.
|
|
81942
|
-
if (!baseConstraint || (baseConstraint.flags & 3 /* AnyOrUnknown */) || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint)) {
|
|
81943
|
-
// Nothing to do if `Awaited<T>` doesn't exist
|
|
81944
|
-
var awaitedSymbol = getGlobalAwaitedSymbol(/*reportErrors*/ true);
|
|
81945
|
-
if (awaitedSymbol) {
|
|
81946
|
-
// Unwrap unions that may contain `Awaited<T>`, otherwise its possible to manufacture an `Awaited<Awaited<T> | U>` where
|
|
81947
|
-
// an `Awaited<T | U>` would suffice.
|
|
81948
|
-
return getTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
|
|
81949
|
-
}
|
|
82028
|
+
if (isAwaitedTypeNeeded(type)) {
|
|
82029
|
+
var awaitedType = tryCreateAwaitedType(type);
|
|
82030
|
+
if (awaitedType) {
|
|
82031
|
+
return awaitedType;
|
|
81950
82032
|
}
|
|
81951
82033
|
}
|
|
81952
82034
|
ts.Debug.assert(getPromisedTypeOfPromise(type) === undefined, "type provided should not be a non-generic 'promise'-like.");
|
|
@@ -81986,8 +82068,21 @@ var ts;
|
|
|
81986
82068
|
}
|
|
81987
82069
|
// For a union, get a union of the awaited types of each constituent.
|
|
81988
82070
|
if (type.flags & 1048576 /* Union */) {
|
|
82071
|
+
if (awaitedTypeStack.lastIndexOf(type.id) >= 0) {
|
|
82072
|
+
if (errorNode) {
|
|
82073
|
+
error(errorNode, ts.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
82074
|
+
}
|
|
82075
|
+
return undefined;
|
|
82076
|
+
}
|
|
81989
82077
|
var mapper = errorNode ? function (constituentType) { return getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0); } : getAwaitedTypeNoAlias;
|
|
81990
|
-
|
|
82078
|
+
awaitedTypeStack.push(type.id);
|
|
82079
|
+
var mapped = mapType(type, mapper);
|
|
82080
|
+
awaitedTypeStack.pop();
|
|
82081
|
+
return typeAsAwaitable.awaitedTypeOfType = mapped;
|
|
82082
|
+
}
|
|
82083
|
+
// If `type` is generic and should be wrapped in `Awaited<T>`, return it.
|
|
82084
|
+
if (isAwaitedTypeNeeded(type)) {
|
|
82085
|
+
return typeAsAwaitable.awaitedTypeOfType = type;
|
|
81991
82086
|
}
|
|
81992
82087
|
var thisTypeForErrorOut = { value: undefined };
|
|
81993
82088
|
var promisedType = getPromisedTypeOfPromise(type, /*errorNode*/ undefined, thisTypeForErrorOut);
|
|
@@ -82636,8 +82731,8 @@ var ts;
|
|
|
82636
82731
|
return;
|
|
82637
82732
|
var typeParameters = ts.getEffectiveTypeParameterDeclarations(node);
|
|
82638
82733
|
var seenParentsWithEveryUnused = new ts.Set();
|
|
82639
|
-
for (var _i = 0,
|
|
82640
|
-
var typeParameter =
|
|
82734
|
+
for (var _i = 0, typeParameters_4 = typeParameters; _i < typeParameters_4.length; _i++) {
|
|
82735
|
+
var typeParameter = typeParameters_4[_i];
|
|
82641
82736
|
if (!isTypeParameterUnused(typeParameter))
|
|
82642
82737
|
continue;
|
|
82643
82738
|
var name = ts.idText(typeParameter.name);
|
|
@@ -84456,7 +84551,7 @@ var ts;
|
|
|
84456
84551
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84457
84552
|
var localPropDeclaration = declaration && declaration.kind === 221 /* BinaryExpression */ ||
|
|
84458
84553
|
name && name.kind === 162 /* ComputedPropertyName */ || getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
84459
|
-
var
|
|
84554
|
+
var _loop_30 = function (info) {
|
|
84460
84555
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
84461
84556
|
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
|
|
84462
84557
|
// in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
|
|
@@ -84469,7 +84564,7 @@ var ts;
|
|
|
84469
84564
|
};
|
|
84470
84565
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
84471
84566
|
var info = indexInfos_9[_i];
|
|
84472
|
-
|
|
84567
|
+
_loop_30(info);
|
|
84473
84568
|
}
|
|
84474
84569
|
}
|
|
84475
84570
|
function checkIndexConstraintForIndexSignature(type, checkInfo) {
|
|
@@ -84477,7 +84572,7 @@ var ts;
|
|
|
84477
84572
|
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
|
|
84478
84573
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84479
84574
|
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
|
|
84480
|
-
var
|
|
84575
|
+
var _loop_31 = function (info) {
|
|
84481
84576
|
if (info === checkInfo)
|
|
84482
84577
|
return "continue";
|
|
84483
84578
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
@@ -84492,7 +84587,7 @@ var ts;
|
|
|
84492
84587
|
};
|
|
84493
84588
|
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
84494
84589
|
var info = indexInfos_10[_i];
|
|
84495
|
-
|
|
84590
|
+
_loop_31(info);
|
|
84496
84591
|
}
|
|
84497
84592
|
}
|
|
84498
84593
|
function checkTypeNameIsReserved(name, message) {
|
|
@@ -84812,7 +84907,7 @@ var ts;
|
|
|
84812
84907
|
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
84813
84908
|
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
84814
84909
|
var baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
84815
|
-
var
|
|
84910
|
+
var _loop_32 = function (member) {
|
|
84816
84911
|
if (ts.hasAmbientModifier(member)) {
|
|
84817
84912
|
return "continue";
|
|
84818
84913
|
}
|
|
@@ -84829,7 +84924,7 @@ var ts;
|
|
|
84829
84924
|
};
|
|
84830
84925
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
84831
84926
|
var member = _a[_i];
|
|
84832
|
-
|
|
84927
|
+
_loop_32(member);
|
|
84833
84928
|
}
|
|
84834
84929
|
}
|
|
84835
84930
|
/**
|
|
@@ -84917,7 +85012,7 @@ var ts;
|
|
|
84917
85012
|
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
|
|
84918
85013
|
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
|
|
84919
85014
|
var issuedMemberError = false;
|
|
84920
|
-
var
|
|
85015
|
+
var _loop_33 = function (member) {
|
|
84921
85016
|
if (ts.isStatic(member)) {
|
|
84922
85017
|
return "continue";
|
|
84923
85018
|
}
|
|
@@ -84936,7 +85031,7 @@ var ts;
|
|
|
84936
85031
|
};
|
|
84937
85032
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
84938
85033
|
var member = _a[_i];
|
|
84939
|
-
|
|
85034
|
+
_loop_33(member);
|
|
84940
85035
|
}
|
|
84941
85036
|
if (!issuedMemberError) {
|
|
84942
85037
|
// check again with diagnostics to generate a less-specific error
|
|
@@ -85007,7 +85102,7 @@ var ts;
|
|
|
85007
85102
|
var _a, _b, _c, _d;
|
|
85008
85103
|
// NOTE: assignability is checked in checkClassDeclaration
|
|
85009
85104
|
var baseProperties = getPropertiesOfType(baseType);
|
|
85010
|
-
var
|
|
85105
|
+
var _loop_34 = function (baseProperty) {
|
|
85011
85106
|
var base = getTargetSymbol(baseProperty);
|
|
85012
85107
|
if (base.flags & 4194304 /* Prototype */) {
|
|
85013
85108
|
return "continue";
|
|
@@ -85117,7 +85212,7 @@ var ts;
|
|
|
85117
85212
|
};
|
|
85118
85213
|
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
|
|
85119
85214
|
var baseProperty = baseProperties_1[_i];
|
|
85120
|
-
var state_10 =
|
|
85215
|
+
var state_10 = _loop_34(baseProperty);
|
|
85121
85216
|
switch (state_10) {
|
|
85122
85217
|
case "continue-basePropertyCheck": continue basePropertyCheck;
|
|
85123
85218
|
}
|
|
@@ -111632,7 +111727,6 @@ var ts;
|
|
|
111632
111727
|
if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
|
|
111633
111728
|
// Update the output signature
|
|
111634
111729
|
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, createHash, changedDtsData);
|
|
111635
|
-
newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
|
|
111636
111730
|
}
|
|
111637
111731
|
// Update sourceFileInfo
|
|
111638
111732
|
var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
|
|
@@ -121019,7 +121113,7 @@ var ts;
|
|
|
121019
121113
|
state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
|
|
121020
121114
|
}
|
|
121021
121115
|
state.changedFilesSet = new ts.Set();
|
|
121022
|
-
state.
|
|
121116
|
+
state.latestChangedDtsFile = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.latestChangedDtsFile : undefined;
|
|
121023
121117
|
var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
|
|
121024
121118
|
var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
|
|
121025
121119
|
var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
|
|
@@ -121143,7 +121237,7 @@ var ts;
|
|
|
121143
121237
|
programEmitComplete: state.programEmitComplete,
|
|
121144
121238
|
emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
|
|
121145
121239
|
outSignature: state.outSignature,
|
|
121146
|
-
|
|
121240
|
+
latestChangedDtsFile: state.latestChangedDtsFile,
|
|
121147
121241
|
hasChangedEmitSignature: state.hasChangedEmitSignature,
|
|
121148
121242
|
changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
|
|
121149
121243
|
};
|
|
@@ -121156,7 +121250,7 @@ var ts;
|
|
|
121156
121250
|
state.programEmitComplete = savedEmitState.programEmitComplete;
|
|
121157
121251
|
state.emitSignatures = savedEmitState.emitSignatures;
|
|
121158
121252
|
state.outSignature = savedEmitState.outSignature;
|
|
121159
|
-
state.
|
|
121253
|
+
state.latestChangedDtsFile = savedEmitState.latestChangedDtsFile;
|
|
121160
121254
|
state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
|
|
121161
121255
|
if (savedEmitState.changedFilesSet)
|
|
121162
121256
|
state.changedFilesSet = savedEmitState.changedFilesSet;
|
|
@@ -121470,14 +121564,14 @@ var ts;
|
|
|
121470
121564
|
/**
|
|
121471
121565
|
* Gets the program information to be emitted in buildInfo so that we can use it to create new program
|
|
121472
121566
|
*/
|
|
121473
|
-
function getProgramBuildInfo(state, getCanonicalFileName
|
|
121567
|
+
function getProgramBuildInfo(state, getCanonicalFileName) {
|
|
121474
121568
|
var outFilePath = ts.outFile(state.compilerOptions);
|
|
121475
121569
|
if (outFilePath && !state.compilerOptions.composite)
|
|
121476
121570
|
return;
|
|
121477
121571
|
var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
|
|
121478
121572
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
|
|
121479
|
-
//
|
|
121480
|
-
|
|
121573
|
+
// 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
|
|
121574
|
+
var latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : undefined;
|
|
121481
121575
|
if (outFilePath) {
|
|
121482
121576
|
var fileNames_1 = [];
|
|
121483
121577
|
var fileInfos_1 = [];
|
|
@@ -121493,7 +121587,7 @@ var ts;
|
|
|
121493
121587
|
fileInfos: fileInfos_1,
|
|
121494
121588
|
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
|
|
121495
121589
|
outSignature: state.outSignature,
|
|
121496
|
-
|
|
121590
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
121497
121591
|
};
|
|
121498
121592
|
return result_15;
|
|
121499
121593
|
}
|
|
@@ -121595,7 +121689,7 @@ var ts;
|
|
|
121595
121689
|
affectedFilesPendingEmit: affectedFilesPendingEmit,
|
|
121596
121690
|
changeFileSet: changeFileSet,
|
|
121597
121691
|
emitSignatures: emitSignatures,
|
|
121598
|
-
|
|
121692
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
121599
121693
|
};
|
|
121600
121694
|
return result;
|
|
121601
121695
|
function relativeToBuildInfoEnsuringAbsolutePath(path) {
|
|
@@ -121763,7 +121857,7 @@ var ts;
|
|
|
121763
121857
|
*/
|
|
121764
121858
|
var computeHash = ts.maybeBind(host, host.createHash);
|
|
121765
121859
|
var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
|
|
121766
|
-
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName
|
|
121860
|
+
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
|
|
121767
121861
|
// To ensure that we arent storing any references to old program or new program without state
|
|
121768
121862
|
newProgram = undefined; // TODO: GH#18217
|
|
121769
121863
|
oldProgram = undefined;
|
|
@@ -121773,6 +121867,7 @@ var ts;
|
|
|
121773
121867
|
builderProgram.getState = getState;
|
|
121774
121868
|
builderProgram.saveEmitState = function () { return backupBuilderProgramEmitState(state); };
|
|
121775
121869
|
builderProgram.restoreEmitState = function (saved) { return restoreBuilderProgramEmitState(state, saved); };
|
|
121870
|
+
builderProgram.hasChangedEmitSignature = function () { return !!state.hasChangedEmitSignature; };
|
|
121776
121871
|
builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
|
|
121777
121872
|
builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
|
|
121778
121873
|
builderProgram.emit = emit;
|
|
@@ -121880,18 +121975,22 @@ var ts;
|
|
|
121880
121975
|
var filePath = sourceFiles[0].resolvedPath;
|
|
121881
121976
|
var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath);
|
|
121882
121977
|
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text, computeHash, data));
|
|
121883
|
-
if
|
|
121884
|
-
|
|
121885
|
-
|
|
121886
|
-
|
|
121978
|
+
// Dont write dts files if they didn't change
|
|
121979
|
+
if (emitSignature === oldSignature)
|
|
121980
|
+
return;
|
|
121981
|
+
((_g = state.emitSignatures) !== null && _g !== void 0 ? _g : (state.emitSignatures = new ts.Map())).set(filePath, emitSignature);
|
|
121982
|
+
state.hasChangedEmitSignature = true;
|
|
121983
|
+
state.latestChangedDtsFile = fileName;
|
|
121887
121984
|
}
|
|
121888
121985
|
}
|
|
121889
121986
|
else if (state.compilerOptions.composite) {
|
|
121890
121987
|
var newSignature = computeSignature(text, computeHash, data);
|
|
121891
|
-
if
|
|
121892
|
-
|
|
121893
|
-
|
|
121894
|
-
|
|
121988
|
+
// Dont write dts files if they didn't change
|
|
121989
|
+
if (newSignature === state.outSignature)
|
|
121990
|
+
return;
|
|
121991
|
+
state.outSignature = newSignature;
|
|
121992
|
+
state.hasChangedEmitSignature = true;
|
|
121993
|
+
state.latestChangedDtsFile = fileName;
|
|
121895
121994
|
}
|
|
121896
121995
|
}
|
|
121897
121996
|
if (writeFile)
|
|
@@ -122054,11 +122153,12 @@ var ts;
|
|
|
122054
122153
|
var state;
|
|
122055
122154
|
var filePaths;
|
|
122056
122155
|
var filePathsSetList;
|
|
122156
|
+
var latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : undefined;
|
|
122057
122157
|
if (isProgramBundleEmitBuildInfo(program)) {
|
|
122058
122158
|
state = {
|
|
122059
122159
|
fileInfos: new ts.Map(),
|
|
122060
122160
|
compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
|
|
122061
|
-
|
|
122161
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
122062
122162
|
outSignature: program.outSignature,
|
|
122063
122163
|
};
|
|
122064
122164
|
}
|
|
@@ -122091,7 +122191,7 @@ var ts;
|
|
|
122091
122191
|
affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
|
|
122092
122192
|
affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
|
|
122093
122193
|
changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
|
|
122094
|
-
|
|
122194
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
122095
122195
|
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
|
122096
122196
|
};
|
|
122097
122197
|
}
|
|
@@ -122118,6 +122218,7 @@ var ts;
|
|
|
122118
122218
|
getSemanticDiagnosticsOfNextAffectedFile: ts.notImplemented,
|
|
122119
122219
|
emitBuildInfo: ts.notImplemented,
|
|
122120
122220
|
close: ts.noop,
|
|
122221
|
+
hasChangedEmitSignature: ts.returnFalse,
|
|
122121
122222
|
};
|
|
122122
122223
|
function toPath(path) {
|
|
122123
122224
|
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
@@ -123432,7 +123533,7 @@ var ts;
|
|
|
123432
123533
|
});
|
|
123433
123534
|
// Sort by paths closest to importing file Name directory
|
|
123434
123535
|
var sortedPaths = [];
|
|
123435
|
-
var
|
|
123536
|
+
var _loop_35 = function (directory) {
|
|
123436
123537
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
123437
123538
|
var pathsInDirectory;
|
|
123438
123539
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -123456,7 +123557,7 @@ var ts;
|
|
|
123456
123557
|
};
|
|
123457
123558
|
var out_directory_1;
|
|
123458
123559
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
123459
|
-
var state_11 =
|
|
123560
|
+
var state_11 = _loop_35(directory);
|
|
123460
123561
|
directory = out_directory_1;
|
|
123461
123562
|
if (state_11 === "break")
|
|
123462
123563
|
break;
|
|
@@ -124300,7 +124401,6 @@ var ts;
|
|
|
124300
124401
|
readDirectory: ts.maybeBind(host, host.readDirectory),
|
|
124301
124402
|
disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
|
|
124302
124403
|
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
|
|
124303
|
-
now: ts.maybeBind(host, host.now),
|
|
124304
124404
|
};
|
|
124305
124405
|
function writeFile(fileName, text, writeByteOrderMark, onError) {
|
|
124306
124406
|
try {
|
|
@@ -124458,7 +124558,6 @@ var ts;
|
|
|
124458
124558
|
host.createHash = ts.maybeBind(system, system.createHash);
|
|
124459
124559
|
host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
|
|
124460
124560
|
host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
|
|
124461
|
-
host.now = ts.maybeBind(system, system.now);
|
|
124462
124561
|
ts.setGetSourceFileAsHashVersioned(host, system);
|
|
124463
124562
|
ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
|
|
124464
124563
|
return host;
|
|
@@ -125786,8 +125885,7 @@ var ts;
|
|
|
125786
125885
|
}
|
|
125787
125886
|
// Actual Emit
|
|
125788
125887
|
var host = state.host, compilerHost = state.compilerHost;
|
|
125789
|
-
var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
|
|
125790
|
-
var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
|
|
125888
|
+
var resultFlags = ((_d = program.hasChangedEmitSignature) === null || _d === void 0 ? void 0 : _d.call(program)) ? BuildResultFlags.None : BuildResultFlags.DeclarationOutputUnchanged;
|
|
125791
125889
|
var emitterDiagnostics = ts.createDiagnosticCollection();
|
|
125792
125890
|
var emittedOutputs = new ts.Map();
|
|
125793
125891
|
var options = program.getCompilerOptions();
|
|
@@ -125795,17 +125893,11 @@ var ts;
|
|
|
125795
125893
|
var outputTimeStampMap;
|
|
125796
125894
|
var now;
|
|
125797
125895
|
outputFiles.forEach(function (_a) {
|
|
125798
|
-
var _b, _c;
|
|
125799
125896
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
125800
125897
|
var path = toPath(state, name);
|
|
125801
125898
|
emittedOutputs.set(toPath(state, name), name);
|
|
125802
|
-
if (buildInfo)
|
|
125803
|
-
setBuildInfo(state, buildInfo, projectPath, options);
|
|
125804
|
-
// Buildinfo has information on when last dts change time
|
|
125805
|
-
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)) {
|
|
125806
|
-
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
|
125807
|
-
}
|
|
125808
|
-
}
|
|
125899
|
+
if (buildInfo)
|
|
125900
|
+
setBuildInfo(state, buildInfo, projectPath, options, resultFlags);
|
|
125809
125901
|
ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
|
|
125810
125902
|
if (!isIncremental && state.watch) {
|
|
125811
125903
|
(outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
|
|
@@ -125819,7 +125911,7 @@ var ts;
|
|
|
125819
125911
|
ts.Debug.assert(step === BuildStep.EmitBuildInfo);
|
|
125820
125912
|
var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
|
|
125821
125913
|
if (data === null || data === void 0 ? void 0 : data.buildInfo)
|
|
125822
|
-
setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
|
|
125914
|
+
setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions(), BuildResultFlags.DeclarationOutputUnchanged);
|
|
125823
125915
|
if (writeFileCallback)
|
|
125824
125916
|
writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
125825
125917
|
else
|
|
@@ -125852,7 +125944,6 @@ var ts;
|
|
|
125852
125944
|
state.diagnostics.delete(projectPath);
|
|
125853
125945
|
state.projectStatus.set(projectPath, {
|
|
125854
125946
|
type: ts.UpToDateStatusType.UpToDate,
|
|
125855
|
-
newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
|
|
125856
125947
|
oldestOutputFileName: oldestOutputFileName
|
|
125857
125948
|
});
|
|
125858
125949
|
afterProgramDone(state, program, config);
|
|
@@ -125894,10 +125985,10 @@ var ts;
|
|
|
125894
125985
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
125895
125986
|
emittedOutputs.set(toPath(state, name), name);
|
|
125896
125987
|
if (buildInfo) {
|
|
125897
|
-
|
|
125898
|
-
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
|
|
125988
|
+
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) {
|
|
125899
125989
|
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
|
125900
125990
|
}
|
|
125991
|
+
setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags);
|
|
125901
125992
|
}
|
|
125902
125993
|
ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
|
|
125903
125994
|
});
|
|
@@ -126156,15 +126247,23 @@ var ts;
|
|
|
126156
126247
|
state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
|
|
126157
126248
|
return result;
|
|
126158
126249
|
}
|
|
126159
|
-
function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
|
|
126250
|
+
function setBuildInfo(state, buildInfo, resolvedConfigPath, options, resultFlags) {
|
|
126160
126251
|
var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
|
|
126161
126252
|
var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
|
|
126253
|
+
var modifiedTime = getCurrentTime(state.host);
|
|
126162
126254
|
if (existing) {
|
|
126163
126255
|
existing.buildInfo = buildInfo;
|
|
126164
|
-
existing.modifiedTime =
|
|
126256
|
+
existing.modifiedTime = modifiedTime;
|
|
126257
|
+
if (!(resultFlags & BuildResultFlags.DeclarationOutputUnchanged))
|
|
126258
|
+
existing.latestChangedDtsTime = modifiedTime;
|
|
126165
126259
|
}
|
|
126166
126260
|
else {
|
|
126167
|
-
state.buildInfoCache.set(resolvedConfigPath, {
|
|
126261
|
+
state.buildInfoCache.set(resolvedConfigPath, {
|
|
126262
|
+
path: toPath(state, buildInfoPath),
|
|
126263
|
+
buildInfo: buildInfo,
|
|
126264
|
+
modifiedTime: modifiedTime,
|
|
126265
|
+
latestChangedDtsTime: resultFlags & BuildResultFlags.DeclarationOutputUnchanged ? undefined : modifiedTime,
|
|
126266
|
+
});
|
|
126168
126267
|
}
|
|
126169
126268
|
}
|
|
126170
126269
|
function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
|
|
@@ -126196,7 +126295,7 @@ var ts;
|
|
|
126196
126295
|
}
|
|
126197
126296
|
}
|
|
126198
126297
|
function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
126199
|
-
var _a, _b
|
|
126298
|
+
var _a, _b;
|
|
126200
126299
|
// Container if no files are specified in the project
|
|
126201
126300
|
if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
|
|
126202
126301
|
return {
|
|
@@ -126208,8 +126307,8 @@ var ts;
|
|
|
126208
126307
|
var force = !!state.options.force;
|
|
126209
126308
|
if (project.projectReferences) {
|
|
126210
126309
|
state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
|
|
126211
|
-
for (var _i = 0,
|
|
126212
|
-
var ref =
|
|
126310
|
+
for (var _i = 0, _c = project.projectReferences; _i < _c.length; _i++) {
|
|
126311
|
+
var ref = _c[_i];
|
|
126213
126312
|
var resolvedRef = ts.resolveProjectReferencePath(ref);
|
|
126214
126313
|
var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
|
|
126215
126314
|
var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
|
|
@@ -126249,7 +126348,6 @@ var ts;
|
|
|
126249
126348
|
var buildInfoTime;
|
|
126250
126349
|
var buildInfoProgram;
|
|
126251
126350
|
var buildInfoVersionMap;
|
|
126252
|
-
var newestDeclarationFileContentChangedTime;
|
|
126253
126351
|
if (buildInfoPath) {
|
|
126254
126352
|
var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
|
|
126255
126353
|
buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
|
|
@@ -126286,8 +126384,6 @@ var ts;
|
|
|
126286
126384
|
}
|
|
126287
126385
|
oldestOutputFileTime = buildInfoTime;
|
|
126288
126386
|
oldestOutputFileName = buildInfoPath;
|
|
126289
|
-
// Get the last dtsChange time from build info
|
|
126290
|
-
newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
|
|
126291
126387
|
}
|
|
126292
126388
|
// Check input files
|
|
126293
126389
|
var newestInputFileName = undefined;
|
|
@@ -126295,8 +126391,8 @@ var ts;
|
|
|
126295
126391
|
/** 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 */
|
|
126296
126392
|
var pseudoInputUpToDate = false;
|
|
126297
126393
|
// Get timestamps of input files
|
|
126298
|
-
for (var
|
|
126299
|
-
var inputFile =
|
|
126394
|
+
for (var _d = 0, _e = project.fileNames; _d < _e.length; _d++) {
|
|
126395
|
+
var inputFile = _e[_d];
|
|
126300
126396
|
var inputTime = getModifiedTime(state, inputFile);
|
|
126301
126397
|
if (inputTime === ts.missingFileModifiedTime) {
|
|
126302
126398
|
return {
|
|
@@ -126337,8 +126433,8 @@ var ts;
|
|
|
126337
126433
|
// Collect the expected outputs of this project
|
|
126338
126434
|
var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
|
|
126339
126435
|
var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
|
|
126340
|
-
for (var
|
|
126341
|
-
var output = outputs_1[
|
|
126436
|
+
for (var _f = 0, outputs_1 = outputs; _f < outputs_1.length; _f++) {
|
|
126437
|
+
var output = outputs_1[_f];
|
|
126342
126438
|
var path = toPath(state, output);
|
|
126343
126439
|
// Output is missing; can stop checking
|
|
126344
126440
|
var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
|
|
@@ -126376,8 +126472,8 @@ var ts;
|
|
|
126376
126472
|
var usesPrepend = false;
|
|
126377
126473
|
var upstreamChangedProject;
|
|
126378
126474
|
if (referenceStatuses) {
|
|
126379
|
-
for (var
|
|
126380
|
-
var
|
|
126475
|
+
for (var _g = 0, referenceStatuses_1 = referenceStatuses; _g < referenceStatuses_1.length; _g++) {
|
|
126476
|
+
var _h = referenceStatuses_1[_g], ref = _h.ref, refStatus = _h.refStatus, resolvedConfig = _h.resolvedConfig, resolvedRefPath = _h.resolvedRefPath;
|
|
126381
126477
|
usesPrepend = usesPrepend || !!(ref.prepend);
|
|
126382
126478
|
// If the upstream project's newest file is older than our oldest output, we
|
|
126383
126479
|
// can't be out of date because of it
|
|
@@ -126394,7 +126490,8 @@ var ts;
|
|
|
126394
126490
|
}
|
|
126395
126491
|
// If the upstream project has only change .d.ts files, and we've built
|
|
126396
126492
|
// *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
|
|
126397
|
-
|
|
126493
|
+
var newestDeclarationFileContentChangedTime = getLatestChangedDtsTime(state, resolvedConfig.options, resolvedRefPath);
|
|
126494
|
+
if (newestDeclarationFileContentChangedTime && newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
|
|
126398
126495
|
pseudoUpToDate = true;
|
|
126399
126496
|
upstreamChangedProject = ref.path;
|
|
126400
126497
|
continue;
|
|
@@ -126437,7 +126534,6 @@ var ts;
|
|
|
126437
126534
|
pseudoInputUpToDate ?
|
|
126438
126535
|
ts.UpToDateStatusType.UpToDateWithInputFileText :
|
|
126439
126536
|
ts.UpToDateStatusType.UpToDate,
|
|
126440
|
-
newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
|
|
126441
126537
|
newestInputFileTime: newestInputFileTime,
|
|
126442
126538
|
newestInputFileName: newestInputFileName,
|
|
126443
126539
|
oldestOutputFileName: oldestOutputFileName
|
|
@@ -126521,13 +126617,17 @@ var ts;
|
|
|
126521
126617
|
outputTimeStampMap.delete(key);
|
|
126522
126618
|
});
|
|
126523
126619
|
}
|
|
126524
|
-
function
|
|
126525
|
-
var _a;
|
|
126620
|
+
function getLatestChangedDtsTime(state, options, resolvedConfigPath) {
|
|
126526
126621
|
if (!options.composite)
|
|
126527
126622
|
return undefined;
|
|
126528
|
-
var
|
|
126529
|
-
|
|
126530
|
-
|
|
126623
|
+
var entry = ts.Debug.checkDefined(state.buildInfoCache.get(resolvedConfigPath));
|
|
126624
|
+
if (entry.latestChangedDtsTime !== undefined)
|
|
126625
|
+
return entry.latestChangedDtsTime || undefined;
|
|
126626
|
+
var latestChangedDtsTime = entry.buildInfo && entry.buildInfo.program && entry.buildInfo.program.latestChangedDtsFile ?
|
|
126627
|
+
state.host.getModifiedTime(ts.getNormalizedAbsolutePath(entry.buildInfo.program.latestChangedDtsFile, ts.getDirectoryPath(entry.path))) :
|
|
126628
|
+
undefined;
|
|
126629
|
+
entry.latestChangedDtsTime = latestChangedDtsTime || false;
|
|
126630
|
+
return latestChangedDtsTime;
|
|
126531
126631
|
}
|
|
126532
126632
|
function updateOutputTimestamps(state, proj, resolvedPath) {
|
|
126533
126633
|
if (state.options.dry) {
|
|
@@ -126536,7 +126636,6 @@ var ts;
|
|
|
126536
126636
|
updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
|
|
126537
126637
|
state.projectStatus.set(resolvedPath, {
|
|
126538
126638
|
type: ts.UpToDateStatusType.UpToDate,
|
|
126539
|
-
newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
|
|
126540
126639
|
oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
|
|
126541
126640
|
});
|
|
126542
126641
|
}
|
|
@@ -133362,37 +133461,36 @@ var ts;
|
|
|
133362
133461
|
}
|
|
133363
133462
|
}
|
|
133364
133463
|
var entries = ts.createSortedArray();
|
|
133365
|
-
|
|
133366
|
-
|
|
133367
|
-
|
|
133368
|
-
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries);
|
|
133369
|
-
}
|
|
133370
|
-
else {
|
|
133371
|
-
if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
|
|
133372
|
-
return undefined;
|
|
133373
|
-
}
|
|
133374
|
-
getCompletionEntriesFromSymbols(symbols, entries,
|
|
133375
|
-
/*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);
|
|
133464
|
+
var isChecked = isCheckedFile(sourceFile, compilerOptions);
|
|
133465
|
+
if (isChecked && !isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
|
|
133466
|
+
return undefined;
|
|
133376
133467
|
}
|
|
133468
|
+
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
|
|
133469
|
+
/*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);
|
|
133377
133470
|
if (keywordFilters !== 0 /* None */) {
|
|
133378
|
-
var entryNames_1 = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
133379
133471
|
for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
|
|
133380
133472
|
var keywordEntry = _a[_i];
|
|
133381
|
-
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !
|
|
133473
|
+
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !uniqueNames.has(keywordEntry.name)) {
|
|
133474
|
+
uniqueNames.add(keywordEntry.name);
|
|
133382
133475
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
133383
133476
|
}
|
|
133384
133477
|
}
|
|
133385
133478
|
}
|
|
133386
|
-
var entryNames = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
133387
133479
|
for (var _b = 0, _c = getContextualKeywords(contextToken, position); _b < _c.length; _b++) {
|
|
133388
133480
|
var keywordEntry = _c[_b];
|
|
133389
|
-
if (!
|
|
133481
|
+
if (!uniqueNames.has(keywordEntry.name)) {
|
|
133482
|
+
uniqueNames.add(keywordEntry.name);
|
|
133390
133483
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
133391
133484
|
}
|
|
133392
133485
|
}
|
|
133393
133486
|
for (var _d = 0, literals_1 = literals; _d < literals_1.length; _d++) {
|
|
133394
133487
|
var literal = literals_1[_d];
|
|
133395
|
-
|
|
133488
|
+
var literalEntry = createCompletionEntryForLiteral(sourceFile, preferences, literal);
|
|
133489
|
+
uniqueNames.add(literalEntry.name);
|
|
133490
|
+
ts.insertSorted(entries, literalEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
133491
|
+
}
|
|
133492
|
+
if (!isChecked) {
|
|
133493
|
+
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries);
|
|
133396
133494
|
}
|
|
133397
133495
|
return {
|
|
133398
133496
|
flags: completionData.flags,
|
|
@@ -133404,8 +133502,8 @@ var ts;
|
|
|
133404
133502
|
entries: entries,
|
|
133405
133503
|
};
|
|
133406
133504
|
}
|
|
133407
|
-
function
|
|
133408
|
-
return ts.isSourceFileJS(sourceFile)
|
|
133505
|
+
function isCheckedFile(sourceFile, compilerOptions) {
|
|
133506
|
+
return !ts.isSourceFileJS(sourceFile) || !!ts.isCheckJsEnabledForFile(sourceFile, compilerOptions);
|
|
133409
133507
|
}
|
|
133410
133508
|
function isMemberCompletionKind(kind) {
|
|
133411
133509
|
switch (kind) {
|
|
@@ -134363,7 +134461,7 @@ var ts;
|
|
|
134363
134461
|
}
|
|
134364
134462
|
function getCompletionData(program, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) {
|
|
134365
134463
|
var typeChecker = program.getTypeChecker();
|
|
134366
|
-
var
|
|
134464
|
+
var inCheckedFile = isCheckedFile(sourceFile, compilerOptions);
|
|
134367
134465
|
var start = ts.timestamp();
|
|
134368
134466
|
var currentToken = ts.getTokenAtPosition(sourceFile, position); // TODO: GH#15853
|
|
134369
134467
|
// We will check for jsdoc comments with insideComment and getJsDocTagAtPosition. (TODO: that seems rather inefficient to check the same thing so many times.)
|
|
@@ -134779,15 +134877,7 @@ var ts;
|
|
|
134779
134877
|
isNewIdentifierLocation = true;
|
|
134780
134878
|
}
|
|
134781
134879
|
var propertyAccess = node.kind === 200 /* ImportType */ ? node : node.parent;
|
|
134782
|
-
if (
|
|
134783
|
-
// In javascript files, for union types, we don't just get the members that
|
|
134784
|
-
// the individual types have in common, we also include all the members that
|
|
134785
|
-
// each individual type has. This is because we're going to add all identifiers
|
|
134786
|
-
// anyways. So we might as well elevate the members that were at least part
|
|
134787
|
-
// of the individual types to a higher status since we know what they are.
|
|
134788
|
-
symbols.push.apply(symbols, ts.filter(getPropertiesForCompletion(type, typeChecker), function (s) { return typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, s); }));
|
|
134789
|
-
}
|
|
134790
|
-
else {
|
|
134880
|
+
if (inCheckedFile) {
|
|
134791
134881
|
for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) {
|
|
134792
134882
|
var symbol = _a[_i];
|
|
134793
134883
|
if (typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, symbol)) {
|
|
@@ -134795,6 +134885,14 @@ var ts;
|
|
|
134795
134885
|
}
|
|
134796
134886
|
}
|
|
134797
134887
|
}
|
|
134888
|
+
else {
|
|
134889
|
+
// In javascript files, for union types, we don't just get the members that
|
|
134890
|
+
// the individual types have in common, we also include all the members that
|
|
134891
|
+
// each individual type has. This is because we're going to add all identifiers
|
|
134892
|
+
// anyways. So we might as well elevate the members that were at least part
|
|
134893
|
+
// of the individual types to a higher status since we know what they are.
|
|
134894
|
+
symbols.push.apply(symbols, ts.filter(getPropertiesForCompletion(type, typeChecker), function (s) { return typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, s); }));
|
|
134895
|
+
}
|
|
134798
134896
|
if (insertAwait && preferences.includeCompletionsWithInsertText) {
|
|
134799
134897
|
var promiseType = typeChecker.getPromisedTypeOfPromise(type);
|
|
134800
134898
|
if (promiseType) {
|
|
@@ -155157,7 +155255,7 @@ var ts;
|
|
|
155157
155255
|
if (!newConstraint)
|
|
155158
155256
|
return;
|
|
155159
155257
|
var newConstraintText = newConstraint[1];
|
|
155160
|
-
changes.insertText(related.file,
|
|
155258
|
+
changes.insertText(related.file, decl.name.end, " extends " + newConstraintText);
|
|
155161
155259
|
}
|
|
155162
155260
|
function findAncestorMatchingSpan(sourceFile, span) {
|
|
155163
155261
|
var token = ts.getTokenAtPosition(sourceFile, span.start);
|