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/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220703";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -3104,6 +3104,22 @@ var ts;
|
|
|
3104
3104
|
return wrapFunction(deprecation, func);
|
|
3105
3105
|
}
|
|
3106
3106
|
Debug.deprecate = deprecate;
|
|
3107
|
+
function formatVariance(varianceFlags) {
|
|
3108
|
+
var variance = varianceFlags & 7 /* VarianceMask */;
|
|
3109
|
+
var result = variance === 0 /* Invariant */ ? "in out" :
|
|
3110
|
+
variance === 3 /* Bivariant */ ? "[bivariant]" :
|
|
3111
|
+
variance === 2 /* Contravariant */ ? "in" :
|
|
3112
|
+
variance === 1 /* Covariant */ ? "out" :
|
|
3113
|
+
variance === 4 /* Independent */ ? "[independent]" : "";
|
|
3114
|
+
if (varianceFlags & 8 /* Unmeasurable */) {
|
|
3115
|
+
result += " (unmeasurable)";
|
|
3116
|
+
}
|
|
3117
|
+
else if (varianceFlags & 16 /* Unreliable */) {
|
|
3118
|
+
result += " (unreliable)";
|
|
3119
|
+
}
|
|
3120
|
+
return result;
|
|
3121
|
+
}
|
|
3122
|
+
Debug.formatVariance = formatVariance;
|
|
3107
3123
|
})(Debug = ts.Debug || (ts.Debug = {}));
|
|
3108
3124
|
})(ts || (ts = {}));
|
|
3109
3125
|
/* @internal */
|
|
@@ -3845,9 +3861,9 @@ var ts;
|
|
|
3845
3861
|
eventStack.push({ phase: phase, name: name, args: args, time: 1000 * ts.timestamp(), separateBeginAndEnd: separateBeginAndEnd });
|
|
3846
3862
|
}
|
|
3847
3863
|
tracingEnabled.push = push;
|
|
3848
|
-
function pop() {
|
|
3864
|
+
function pop(results) {
|
|
3849
3865
|
ts.Debug.assert(eventStack.length > 0);
|
|
3850
|
-
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp());
|
|
3866
|
+
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp(), results);
|
|
3851
3867
|
eventStack.length--;
|
|
3852
3868
|
}
|
|
3853
3869
|
tracingEnabled.pop = pop;
|
|
@@ -3861,14 +3877,15 @@ var ts;
|
|
|
3861
3877
|
tracingEnabled.popAll = popAll;
|
|
3862
3878
|
// sample every 10ms
|
|
3863
3879
|
var sampleInterval = 1000 * 10;
|
|
3864
|
-
function writeStackEvent(index, endTime) {
|
|
3880
|
+
function writeStackEvent(index, endTime, results) {
|
|
3865
3881
|
var _a = eventStack[index], phase = _a.phase, name = _a.name, args = _a.args, time = _a.time, separateBeginAndEnd = _a.separateBeginAndEnd;
|
|
3866
3882
|
if (separateBeginAndEnd) {
|
|
3883
|
+
ts.Debug.assert(!results, "`results` are not supported for events with `separateBeginAndEnd`");
|
|
3867
3884
|
writeEvent("E", phase, name, args, /*extras*/ undefined, endTime);
|
|
3868
3885
|
}
|
|
3869
3886
|
// test if [time,endTime) straddles a sampling point
|
|
3870
3887
|
else if (sampleInterval - (time % sampleInterval) <= endTime - time) {
|
|
3871
|
-
writeEvent("X", phase, name, args, "\"dur\":" + (endTime - time), time);
|
|
3888
|
+
writeEvent("X", phase, name, __assign(__assign({}, args), { results: results }), "\"dur\":" + (endTime - time), time);
|
|
3872
3889
|
}
|
|
3873
3890
|
}
|
|
3874
3891
|
function writeEvent(eventType, phase, name, args, extras, time) {
|
|
@@ -5239,9 +5256,10 @@ var ts;
|
|
|
5239
5256
|
(function (TypeMapKind) {
|
|
5240
5257
|
TypeMapKind[TypeMapKind["Simple"] = 0] = "Simple";
|
|
5241
5258
|
TypeMapKind[TypeMapKind["Array"] = 1] = "Array";
|
|
5242
|
-
TypeMapKind[TypeMapKind["
|
|
5243
|
-
TypeMapKind[TypeMapKind["
|
|
5244
|
-
TypeMapKind[TypeMapKind["
|
|
5259
|
+
TypeMapKind[TypeMapKind["Deferred"] = 2] = "Deferred";
|
|
5260
|
+
TypeMapKind[TypeMapKind["Function"] = 3] = "Function";
|
|
5261
|
+
TypeMapKind[TypeMapKind["Composite"] = 4] = "Composite";
|
|
5262
|
+
TypeMapKind[TypeMapKind["Merged"] = 5] = "Merged";
|
|
5245
5263
|
})(TypeMapKind = ts.TypeMapKind || (ts.TypeMapKind = {}));
|
|
5246
5264
|
var InferencePriority;
|
|
5247
5265
|
(function (InferencePriority) {
|
|
@@ -48644,6 +48662,24 @@ var ts;
|
|
|
48644
48662
|
var Symbol = ts.objectAllocator.getSymbolConstructor();
|
|
48645
48663
|
var Type = ts.objectAllocator.getTypeConstructor();
|
|
48646
48664
|
var Signature = ts.objectAllocator.getSignatureConstructor();
|
|
48665
|
+
var DebugTypeMapper = /** @class */ (function () {
|
|
48666
|
+
function DebugTypeMapper() {
|
|
48667
|
+
}
|
|
48668
|
+
DebugTypeMapper.prototype.__debugToString = function () {
|
|
48669
|
+
var _a;
|
|
48670
|
+
ts.Debug.type(this);
|
|
48671
|
+
switch (this.kind) {
|
|
48672
|
+
case 3 /* Function */: return ((_a = this.debugInfo) === null || _a === void 0 ? void 0 : _a.call(this)) || "(function mapper)";
|
|
48673
|
+
case 0 /* Simple */: return this.source.__debugTypeToString() + " -> " + this.target.__debugTypeToString();
|
|
48674
|
+
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(", ");
|
|
48675
|
+
case 2 /* Deferred */: return ts.zipWith(this.sources, this.targets, function (s, t) { return s.__debugTypeToString() + " -> " + t().__debugTypeToString(); }).join(", ");
|
|
48676
|
+
case 5 /* Merged */:
|
|
48677
|
+
case 4 /* Composite */: return "m1: " + this.mapper1.__debugToString().split("\n").join("\n ") + "\nm2: " + this.mapper2.__debugToString().split("\n").join("\n ");
|
|
48678
|
+
default: return ts.Debug.assertNever(this);
|
|
48679
|
+
}
|
|
48680
|
+
};
|
|
48681
|
+
return DebugTypeMapper;
|
|
48682
|
+
}());
|
|
48647
48683
|
var typeCount = 0;
|
|
48648
48684
|
var symbolCount = 0;
|
|
48649
48685
|
var enumCount = 0;
|
|
@@ -49104,10 +49140,23 @@ var ts;
|
|
|
49104
49140
|
var numberOrBigIntType = getUnionType([numberType, bigintType]);
|
|
49105
49141
|
var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
|
|
49106
49142
|
var numericStringType = getTemplateLiteralType(["", ""], [numberType]); // The `${number}` type
|
|
49107
|
-
var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; });
|
|
49108
|
-
var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? wildcardType : t; });
|
|
49143
|
+
var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; }, function () { return "(restrictive mapper)"; });
|
|
49144
|
+
var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? wildcardType : t; }, function () { return "(permissive mapper)"; });
|
|
49109
49145
|
var uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never"); // `uniqueLiteralType` is a special `never` flagged by union reduction to behave as a literal
|
|
49110
|
-
var uniqueLiteralMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? uniqueLiteralType : t; }); // replace all type parameters with the unique literal type (disregarding constraints)
|
|
49146
|
+
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)
|
|
49147
|
+
var outofbandVarianceMarkerHandler;
|
|
49148
|
+
var reportUnreliableMapper = makeFunctionTypeMapper(function (t) {
|
|
49149
|
+
if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
|
|
49150
|
+
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ true);
|
|
49151
|
+
}
|
|
49152
|
+
return t;
|
|
49153
|
+
}, function () { return "(unmeasurable reporter)"; });
|
|
49154
|
+
var reportUnmeasurableMapper = makeFunctionTypeMapper(function (t) {
|
|
49155
|
+
if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
|
|
49156
|
+
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ false);
|
|
49157
|
+
}
|
|
49158
|
+
return t;
|
|
49159
|
+
}, function () { return "(unreliable reporter)"; });
|
|
49111
49160
|
var emptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49112
49161
|
var emptyJsxObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49113
49162
|
emptyJsxObjectType.objectFlags |= 2048 /* JsxAttributes */;
|
|
@@ -49267,7 +49316,6 @@ var ts;
|
|
|
49267
49316
|
var typeofType = createTypeofType();
|
|
49268
49317
|
var _jsxNamespace;
|
|
49269
49318
|
var _jsxFactoryEntity;
|
|
49270
|
-
var outofbandVarianceMarkerHandler;
|
|
49271
49319
|
var subtypeRelation = new ts.Map();
|
|
49272
49320
|
var strictSubtypeRelation = new ts.Map();
|
|
49273
49321
|
var assignableRelation = new ts.Map();
|
|
@@ -53034,7 +53082,7 @@ var ts;
|
|
|
53034
53082
|
var name = typeParameterToName(newParam, context);
|
|
53035
53083
|
var newTypeVariable = ts.factory.createTypeReferenceNode(name);
|
|
53036
53084
|
context.approximateLength += 37; // 15 each for two added conditionals, 7 for an added infer type
|
|
53037
|
-
var newMapper = prependTypeMapping(type.root.checkType, newParam, type.
|
|
53085
|
+
var newMapper = prependTypeMapping(type.root.checkType, newParam, type.mapper);
|
|
53038
53086
|
var saveInferTypeParameters_1 = context.inferTypeParameters;
|
|
53039
53087
|
context.inferTypeParameters = type.root.inferTypeParameters;
|
|
53040
53088
|
var extendsTypeNode_1 = typeToTypeNodeHelper(instantiateType(type.root.extendsType, newMapper), context);
|
|
@@ -60445,8 +60493,7 @@ var ts;
|
|
|
60445
60493
|
var _a;
|
|
60446
60494
|
var inferences;
|
|
60447
60495
|
if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
|
|
60448
|
-
|
|
60449
|
-
var declaration = _b[_i];
|
|
60496
|
+
var _loop_15 = function (declaration) {
|
|
60450
60497
|
if (declaration.parent.kind === 190 /* InferType */) {
|
|
60451
60498
|
// When an 'infer T' declaration is immediately contained in a type reference node
|
|
60452
60499
|
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
|
|
@@ -60454,12 +60501,12 @@ var ts;
|
|
|
60454
60501
|
// present, we form an intersection of the inferred constraint types.
|
|
60455
60502
|
var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1];
|
|
60456
60503
|
if (grandParent.kind === 178 /* TypeReference */ && !omitTypeReferences) {
|
|
60457
|
-
var
|
|
60458
|
-
var
|
|
60459
|
-
if (
|
|
60460
|
-
var index =
|
|
60461
|
-
if (index <
|
|
60462
|
-
var declaredConstraint = getConstraintOfTypeParameter(
|
|
60504
|
+
var typeReference_1 = grandParent;
|
|
60505
|
+
var typeParameters_1 = getTypeParametersForTypeReference(typeReference_1);
|
|
60506
|
+
if (typeParameters_1) {
|
|
60507
|
+
var index = typeReference_1.typeArguments.indexOf(childTypeParameter);
|
|
60508
|
+
if (index < typeParameters_1.length) {
|
|
60509
|
+
var declaredConstraint = getConstraintOfTypeParameter(typeParameters_1[index]);
|
|
60463
60510
|
if (declaredConstraint) {
|
|
60464
60511
|
// Type parameter constraints can reference other type parameters so
|
|
60465
60512
|
// constraints need to be instantiated. If instantiation produces the
|
|
@@ -60467,7 +60514,9 @@ var ts;
|
|
|
60467
60514
|
// type Foo<T extends string, U extends T> = [T, U];
|
|
60468
60515
|
// type Bar<T> = T extends Foo<infer X, infer X> ? Foo<X, X> : T;
|
|
60469
60516
|
// the instantiated constraint for U is X, so we discard that inference.
|
|
60470
|
-
var mapper =
|
|
60517
|
+
var mapper = makeDeferredTypeMapper(typeParameters_1, typeParameters_1.map(function (_, index) { return function () {
|
|
60518
|
+
return getEffectiveTypeArgumentAtIndex(typeReference_1, typeParameters_1, index);
|
|
60519
|
+
}; }));
|
|
60471
60520
|
var constraint = instantiateType(declaredConstraint, mapper);
|
|
60472
60521
|
if (constraint !== typeParameter) {
|
|
60473
60522
|
inferences = ts.append(inferences, constraint);
|
|
@@ -60505,6 +60554,10 @@ var ts;
|
|
|
60505
60554
|
inferences = ts.append(inferences, instantiateType(nodeType, makeUnaryTypeMapper(getDeclaredTypeOfTypeParameter(getSymbolOfNode(checkMappedType_1.typeParameter)), checkMappedType_1.typeParameter.constraint ? getTypeFromTypeNode(checkMappedType_1.typeParameter.constraint) : keyofConstraintType)));
|
|
60506
60555
|
}
|
|
60507
60556
|
}
|
|
60557
|
+
};
|
|
60558
|
+
for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
|
|
60559
|
+
var declaration = _b[_i];
|
|
60560
|
+
_loop_15(declaration);
|
|
60508
60561
|
}
|
|
60509
60562
|
}
|
|
60510
60563
|
return inferences && getIntersectionType(inferences);
|
|
@@ -61393,7 +61446,7 @@ var ts;
|
|
|
61393
61446
|
var lastRequiredIndex = -1;
|
|
61394
61447
|
var firstRestIndex = -1;
|
|
61395
61448
|
var lastOptionalOrRestIndex = -1;
|
|
61396
|
-
var
|
|
61449
|
+
var _loop_16 = function (i) {
|
|
61397
61450
|
var type = elementTypes[i];
|
|
61398
61451
|
var flags = target.elementFlags[i];
|
|
61399
61452
|
if (flags & 8 /* Variadic */) {
|
|
@@ -61423,7 +61476,7 @@ var ts;
|
|
|
61423
61476
|
}
|
|
61424
61477
|
};
|
|
61425
61478
|
for (var i = 0; i < elementTypes.length; i++) {
|
|
61426
|
-
var state_4 =
|
|
61479
|
+
var state_4 = _loop_16(i);
|
|
61427
61480
|
if (typeof state_4 === "object")
|
|
61428
61481
|
return state_4.value;
|
|
61429
61482
|
}
|
|
@@ -61619,7 +61672,7 @@ var ts;
|
|
|
61619
61672
|
var templates = ts.filter(types, isPatternLiteralType);
|
|
61620
61673
|
if (templates.length) {
|
|
61621
61674
|
var i = types.length;
|
|
61622
|
-
var
|
|
61675
|
+
var _loop_17 = function () {
|
|
61623
61676
|
i--;
|
|
61624
61677
|
var t = types[i];
|
|
61625
61678
|
if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
|
|
@@ -61627,7 +61680,7 @@ var ts;
|
|
|
61627
61680
|
}
|
|
61628
61681
|
};
|
|
61629
61682
|
while (i > 0) {
|
|
61630
|
-
|
|
61683
|
+
_loop_17();
|
|
61631
61684
|
}
|
|
61632
61685
|
}
|
|
61633
61686
|
}
|
|
@@ -61704,14 +61757,14 @@ var ts;
|
|
|
61704
61757
|
var namedUnions = [];
|
|
61705
61758
|
addNamedUnions(namedUnions, types);
|
|
61706
61759
|
var reducedTypes = [];
|
|
61707
|
-
var
|
|
61760
|
+
var _loop_18 = function (t) {
|
|
61708
61761
|
if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
|
|
61709
61762
|
reducedTypes.push(t);
|
|
61710
61763
|
}
|
|
61711
61764
|
};
|
|
61712
61765
|
for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
|
|
61713
61766
|
var t = typeSet_1[_i];
|
|
61714
|
-
|
|
61767
|
+
_loop_18(t);
|
|
61715
61768
|
}
|
|
61716
61769
|
if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
|
|
61717
61770
|
return namedUnions[0];
|
|
@@ -62935,7 +62988,7 @@ var ts;
|
|
|
62935
62988
|
var result;
|
|
62936
62989
|
var extraTypes;
|
|
62937
62990
|
var tailCount = 0;
|
|
62938
|
-
var
|
|
62991
|
+
var _loop_19 = function () {
|
|
62939
62992
|
if (tailCount === 1000) {
|
|
62940
62993
|
error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
62941
62994
|
result = errorType;
|
|
@@ -63056,7 +63109,7 @@ var ts;
|
|
|
63056
63109
|
// another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
|
|
63057
63110
|
// cases we increment the tail recursion counter and stop after 1000 iterations.
|
|
63058
63111
|
while (true) {
|
|
63059
|
-
var state_5 =
|
|
63112
|
+
var state_5 = _loop_19();
|
|
63060
63113
|
if (typeof state_5 === "object")
|
|
63061
63114
|
return state_5.value;
|
|
63062
63115
|
if (state_5 === "break")
|
|
@@ -63686,7 +63739,7 @@ var ts;
|
|
|
63686
63739
|
switch (mapper.kind) {
|
|
63687
63740
|
case 0 /* Simple */:
|
|
63688
63741
|
return type === mapper.source ? mapper.target : type;
|
|
63689
|
-
case 1 /* Array */:
|
|
63742
|
+
case 1 /* Array */: {
|
|
63690
63743
|
var sources = mapper.sources;
|
|
63691
63744
|
var targets = mapper.targets;
|
|
63692
63745
|
for (var i = 0; i < sources.length; i++) {
|
|
@@ -63695,25 +63748,45 @@ var ts;
|
|
|
63695
63748
|
}
|
|
63696
63749
|
}
|
|
63697
63750
|
return type;
|
|
63698
|
-
|
|
63751
|
+
}
|
|
63752
|
+
case 2 /* Deferred */: {
|
|
63753
|
+
var sources = mapper.sources;
|
|
63754
|
+
var targets = mapper.targets;
|
|
63755
|
+
for (var i = 0; i < sources.length; i++) {
|
|
63756
|
+
if (type === sources[i]) {
|
|
63757
|
+
return targets[i]();
|
|
63758
|
+
}
|
|
63759
|
+
}
|
|
63760
|
+
return type;
|
|
63761
|
+
}
|
|
63762
|
+
case 3 /* Function */:
|
|
63699
63763
|
return mapper.func(type);
|
|
63700
|
-
case
|
|
63701
|
-
case
|
|
63764
|
+
case 4 /* Composite */:
|
|
63765
|
+
case 5 /* Merged */:
|
|
63702
63766
|
var t1 = getMappedType(type, mapper.mapper1);
|
|
63703
|
-
return t1 !== type && mapper.kind ===
|
|
63767
|
+
return t1 !== type && mapper.kind === 4 /* Composite */ ? instantiateType(t1, mapper.mapper2) : getMappedType(t1, mapper.mapper2);
|
|
63768
|
+
}
|
|
63769
|
+
}
|
|
63770
|
+
function attachDebugPrototypeIfDebug(mapper) {
|
|
63771
|
+
if (ts.Debug.isDebugging) {
|
|
63772
|
+
return Object.setPrototypeOf(mapper, DebugTypeMapper.prototype);
|
|
63704
63773
|
}
|
|
63774
|
+
return mapper;
|
|
63705
63775
|
}
|
|
63706
63776
|
function makeUnaryTypeMapper(source, target) {
|
|
63707
|
-
return { kind: 0 /* Simple */, source: source, target: target };
|
|
63777
|
+
return attachDebugPrototypeIfDebug({ kind: 0 /* Simple */, source: source, target: target });
|
|
63708
63778
|
}
|
|
63709
63779
|
function makeArrayTypeMapper(sources, targets) {
|
|
63710
|
-
return { kind: 1 /* Array */, sources: sources, targets: targets };
|
|
63780
|
+
return attachDebugPrototypeIfDebug({ kind: 1 /* Array */, sources: sources, targets: targets });
|
|
63781
|
+
}
|
|
63782
|
+
function makeFunctionTypeMapper(func, debugInfo) {
|
|
63783
|
+
return attachDebugPrototypeIfDebug({ kind: 3 /* Function */, func: func, debugInfo: ts.Debug.isDebugging ? debugInfo : undefined });
|
|
63711
63784
|
}
|
|
63712
|
-
function
|
|
63713
|
-
return { kind: 2 /*
|
|
63785
|
+
function makeDeferredTypeMapper(sources, targets) {
|
|
63786
|
+
return attachDebugPrototypeIfDebug({ kind: 2 /* Deferred */, sources: sources, targets: targets });
|
|
63714
63787
|
}
|
|
63715
63788
|
function makeCompositeTypeMapper(kind, mapper1, mapper2) {
|
|
63716
|
-
return { kind: kind, mapper1: mapper1, mapper2: mapper2 };
|
|
63789
|
+
return attachDebugPrototypeIfDebug({ kind: kind, mapper1: mapper1, mapper2: mapper2 });
|
|
63717
63790
|
}
|
|
63718
63791
|
function createTypeEraser(sources) {
|
|
63719
63792
|
return createTypeMapper(sources, /*targets*/ undefined);
|
|
@@ -63723,19 +63796,20 @@ var ts;
|
|
|
63723
63796
|
* This is used during inference when instantiating type parameter defaults.
|
|
63724
63797
|
*/
|
|
63725
63798
|
function createBackreferenceMapper(context, index) {
|
|
63726
|
-
|
|
63799
|
+
var forwardInferences = context.inferences.slice(index);
|
|
63800
|
+
return createTypeMapper(ts.map(forwardInferences, function (i) { return i.typeParameter; }), ts.map(forwardInferences, function () { return unknownType; }));
|
|
63727
63801
|
}
|
|
63728
63802
|
function combineTypeMappers(mapper1, mapper2) {
|
|
63729
|
-
return mapper1 ? makeCompositeTypeMapper(
|
|
63803
|
+
return mapper1 ? makeCompositeTypeMapper(4 /* Composite */, mapper1, mapper2) : mapper2;
|
|
63730
63804
|
}
|
|
63731
63805
|
function mergeTypeMappers(mapper1, mapper2) {
|
|
63732
|
-
return mapper1 ? makeCompositeTypeMapper(
|
|
63806
|
+
return mapper1 ? makeCompositeTypeMapper(5 /* Merged */, mapper1, mapper2) : mapper2;
|
|
63733
63807
|
}
|
|
63734
63808
|
function prependTypeMapping(source, target, mapper) {
|
|
63735
|
-
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(
|
|
63809
|
+
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* Merged */, makeUnaryTypeMapper(source, target), mapper);
|
|
63736
63810
|
}
|
|
63737
63811
|
function appendTypeMapping(mapper, source, target) {
|
|
63738
|
-
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(
|
|
63812
|
+
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* Merged */, mapper, makeUnaryTypeMapper(source, target));
|
|
63739
63813
|
}
|
|
63740
63814
|
function getRestrictiveTypeParameter(tp) {
|
|
63741
63815
|
return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol),
|
|
@@ -65631,7 +65705,7 @@ var ts;
|
|
|
65631
65705
|
reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
|
|
65632
65706
|
checkTypes = reducedTarget.flags & 1048576 /* Union */ ? reducedTarget.types : [reducedTarget];
|
|
65633
65707
|
}
|
|
65634
|
-
var
|
|
65708
|
+
var _loop_20 = function (prop) {
|
|
65635
65709
|
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
|
|
65636
65710
|
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
|
|
65637
65711
|
if (reportErrors) {
|
|
@@ -65694,7 +65768,7 @@ var ts;
|
|
|
65694
65768
|
};
|
|
65695
65769
|
for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
|
|
65696
65770
|
var prop = _b[_i];
|
|
65697
|
-
var state_6 =
|
|
65771
|
+
var state_6 = _loop_20(prop);
|
|
65698
65772
|
if (typeof state_6 === "object")
|
|
65699
65773
|
return state_6.value;
|
|
65700
65774
|
}
|
|
@@ -65926,10 +66000,10 @@ var ts;
|
|
|
65926
66000
|
// We're in the middle of variance checking - integrate any unmeasurable/unreliable flags from this cached component
|
|
65927
66001
|
var saved = entry & 24 /* ReportsMask */;
|
|
65928
66002
|
if (saved & 8 /* ReportsUnmeasurable */) {
|
|
65929
|
-
instantiateType(source,
|
|
66003
|
+
instantiateType(source, reportUnmeasurableMapper);
|
|
65930
66004
|
}
|
|
65931
66005
|
if (saved & 16 /* ReportsUnreliable */) {
|
|
65932
|
-
instantiateType(source,
|
|
66006
|
+
instantiateType(source, reportUnreliableMapper);
|
|
65933
66007
|
}
|
|
65934
66008
|
}
|
|
65935
66009
|
return entry & 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */;
|
|
@@ -66355,7 +66429,7 @@ var ts;
|
|
|
66355
66429
|
}
|
|
66356
66430
|
// Report unreliable variance for type variables referenced in template literal type placeholders.
|
|
66357
66431
|
// For example, `foo-${number}` is related to `foo-${string}` even though number isn't related to string.
|
|
66358
|
-
instantiateType(source,
|
|
66432
|
+
instantiateType(source, reportUnreliableMapper);
|
|
66359
66433
|
}
|
|
66360
66434
|
if (isTypeMatchedByTemplateLiteralType(source, target)) {
|
|
66361
66435
|
return -1 /* True */;
|
|
@@ -66627,18 +66701,6 @@ var ts;
|
|
|
66627
66701
|
}
|
|
66628
66702
|
}
|
|
66629
66703
|
}
|
|
66630
|
-
function reportUnmeasurableMarkers(p) {
|
|
66631
|
-
if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
|
|
66632
|
-
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ false);
|
|
66633
|
-
}
|
|
66634
|
-
return p;
|
|
66635
|
-
}
|
|
66636
|
-
function reportUnreliableMarkers(p) {
|
|
66637
|
-
if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
|
|
66638
|
-
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ true);
|
|
66639
|
-
}
|
|
66640
|
-
return p;
|
|
66641
|
-
}
|
|
66642
66704
|
// A type [P in S]: X is related to a type [Q in T]: Y if T is related to S and X' is
|
|
66643
66705
|
// related to Y, where X' is an instantiation of X in which P is replaced with Q. Notice
|
|
66644
66706
|
// that S and T are contra-variant whereas X and Y are co-variant.
|
|
@@ -66648,7 +66710,7 @@ var ts;
|
|
|
66648
66710
|
if (modifiersRelated) {
|
|
66649
66711
|
var result_10;
|
|
66650
66712
|
var targetConstraint = getConstraintTypeFromMappedType(target);
|
|
66651
|
-
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source),
|
|
66713
|
+
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMapper : reportUnreliableMapper);
|
|
66652
66714
|
if (result_10 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
|
|
66653
66715
|
var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
|
|
66654
66716
|
if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
|
|
@@ -66702,11 +66764,11 @@ var ts;
|
|
|
66702
66764
|
// constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
|
|
66703
66765
|
var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
|
|
66704
66766
|
var matchingTypes = [];
|
|
66705
|
-
var
|
|
66767
|
+
var _loop_21 = function (combination) {
|
|
66706
66768
|
var hasMatch = false;
|
|
66707
66769
|
outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
|
|
66708
66770
|
var type = _d[_c];
|
|
66709
|
-
var
|
|
66771
|
+
var _loop_22 = function (i) {
|
|
66710
66772
|
var sourceProperty = sourcePropertiesFiltered[i];
|
|
66711
66773
|
var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
|
|
66712
66774
|
if (!targetProperty)
|
|
@@ -66722,7 +66784,7 @@ var ts;
|
|
|
66722
66784
|
}
|
|
66723
66785
|
};
|
|
66724
66786
|
for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
|
|
66725
|
-
var state_8 =
|
|
66787
|
+
var state_8 = _loop_22(i);
|
|
66726
66788
|
switch (state_8) {
|
|
66727
66789
|
case "continue-outer": continue outer;
|
|
66728
66790
|
}
|
|
@@ -66736,7 +66798,7 @@ var ts;
|
|
|
66736
66798
|
};
|
|
66737
66799
|
for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
|
|
66738
66800
|
var combination = discriminantCombinations_1[_a];
|
|
66739
|
-
var state_7 =
|
|
66801
|
+
var state_7 = _loop_21(combination);
|
|
66740
66802
|
if (typeof state_7 === "object")
|
|
66741
66803
|
return state_7.value;
|
|
66742
66804
|
}
|
|
@@ -67184,7 +67246,7 @@ var ts;
|
|
|
67184
67246
|
* See signatureAssignableTo, compareSignaturesIdentical
|
|
67185
67247
|
*/
|
|
67186
67248
|
function signatureRelatedTo(source, target, erase, reportErrors, incompatibleReporter) {
|
|
67187
|
-
return compareSignaturesRelated(erase ? getErasedSignature(source) : source, erase ? getErasedSignature(target) : target, relation === strictSubtypeRelation ? 8 /* StrictArity */ : 0, reportErrors, reportError, incompatibleReporter, isRelatedToWorker,
|
|
67249
|
+
return compareSignaturesRelated(erase ? getErasedSignature(source) : source, erase ? getErasedSignature(target) : target, relation === strictSubtypeRelation ? 8 /* StrictArity */ : 0, reportErrors, reportError, incompatibleReporter, isRelatedToWorker, reportUnreliableMapper);
|
|
67188
67250
|
}
|
|
67189
67251
|
function signaturesIdenticalTo(source, target, kind) {
|
|
67190
67252
|
var sourceSignatures = getSignaturesOfType(source, kind);
|
|
@@ -67443,7 +67505,7 @@ var ts;
|
|
|
67443
67505
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
|
|
67444
67506
|
links.variances = ts.emptyArray;
|
|
67445
67507
|
var variances = [];
|
|
67446
|
-
var
|
|
67508
|
+
var _loop_23 = function (tp) {
|
|
67447
67509
|
var modifiers = getVarianceModifiers(tp);
|
|
67448
67510
|
var variance = modifiers & 65536 /* Out */ ?
|
|
67449
67511
|
modifiers & 32768 /* In */ ? 0 /* Invariant */ : 1 /* Covariant */ :
|
|
@@ -67479,12 +67541,12 @@ var ts;
|
|
|
67479
67541
|
}
|
|
67480
67542
|
variances.push(variance);
|
|
67481
67543
|
};
|
|
67482
|
-
for (var _i = 0,
|
|
67483
|
-
var tp =
|
|
67484
|
-
|
|
67544
|
+
for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
|
|
67545
|
+
var tp = typeParameters_2[_i];
|
|
67546
|
+
_loop_23(tp);
|
|
67485
67547
|
}
|
|
67486
67548
|
links.variances = variances;
|
|
67487
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
67549
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
|
|
67488
67550
|
}
|
|
67489
67551
|
return links.variances;
|
|
67490
67552
|
}
|
|
@@ -68476,27 +68538,29 @@ var ts;
|
|
|
68476
68538
|
signature: signature,
|
|
68477
68539
|
flags: flags,
|
|
68478
68540
|
compareTypes: compareTypes,
|
|
68479
|
-
mapper:
|
|
68480
|
-
nonFixingMapper:
|
|
68541
|
+
mapper: reportUnmeasurableMapper,
|
|
68542
|
+
nonFixingMapper: reportUnmeasurableMapper,
|
|
68481
68543
|
};
|
|
68544
|
+
context.mapper = makeFixingMapperForContext(context);
|
|
68545
|
+
context.nonFixingMapper = makeNonFixingMapperForContext(context);
|
|
68482
68546
|
return context;
|
|
68483
68547
|
}
|
|
68484
|
-
function
|
|
68485
|
-
|
|
68486
|
-
|
|
68487
|
-
|
|
68488
|
-
|
|
68489
|
-
|
|
68490
|
-
|
|
68491
|
-
|
|
68492
|
-
inferFromIntraExpressionSites(context);
|
|
68493
|
-
clearCachedInferences(inferences);
|
|
68494
|
-
inference.isFixed = true;
|
|
68495
|
-
}
|
|
68496
|
-
return getInferredType(context, i);
|
|
68548
|
+
function makeFixingMapperForContext(context) {
|
|
68549
|
+
return makeDeferredTypeMapper(ts.map(context.inferences, function (i) { return i.typeParameter; }), ts.map(context.inferences, function (inference, i) { return function () {
|
|
68550
|
+
if (!inference.isFixed) {
|
|
68551
|
+
// Before we commit to a particular inference (and thus lock out any further inferences),
|
|
68552
|
+
// we infer from any intra-expression inference sites we have collected.
|
|
68553
|
+
inferFromIntraExpressionSites(context);
|
|
68554
|
+
clearCachedInferences(context.inferences);
|
|
68555
|
+
inference.isFixed = true;
|
|
68497
68556
|
}
|
|
68498
|
-
|
|
68499
|
-
|
|
68557
|
+
return getInferredType(context, i);
|
|
68558
|
+
}; }));
|
|
68559
|
+
}
|
|
68560
|
+
function makeNonFixingMapperForContext(context) {
|
|
68561
|
+
return makeDeferredTypeMapper(ts.map(context.inferences, function (i) { return i.typeParameter; }), ts.map(context.inferences, function (_, i) { return function () {
|
|
68562
|
+
return getInferredType(context, i);
|
|
68563
|
+
}; }));
|
|
68500
68564
|
}
|
|
68501
68565
|
function clearCachedInferences(inferences) {
|
|
68502
68566
|
for (var _i = 0, inferences_1 = inferences; _i < inferences_1.length; _i++) {
|
|
@@ -69416,7 +69480,7 @@ var ts;
|
|
|
69416
69480
|
// upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
|
|
69417
69481
|
// succeed. That would be a pointless and confusing outcome.
|
|
69418
69482
|
if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
|
|
69419
|
-
var
|
|
69483
|
+
var _loop_24 = function (i) {
|
|
69420
69484
|
var source_1 = matches ? matches[i] : neverType;
|
|
69421
69485
|
var target_3 = types[i];
|
|
69422
69486
|
// If we are inferring from a string literal type to a type variable whose constraint includes one of the
|
|
@@ -69466,7 +69530,7 @@ var ts;
|
|
|
69466
69530
|
inferFromTypes(source_1, target_3);
|
|
69467
69531
|
};
|
|
69468
69532
|
for (var i = 0; i < types.length; i++) {
|
|
69469
|
-
|
|
69533
|
+
_loop_24(i);
|
|
69470
69534
|
}
|
|
69471
69535
|
}
|
|
69472
69536
|
}
|
|
@@ -69984,7 +70048,7 @@ var ts;
|
|
|
69984
70048
|
function mapTypesByKeyProperty(types, name) {
|
|
69985
70049
|
var map = new ts.Map();
|
|
69986
70050
|
var count = 0;
|
|
69987
|
-
var
|
|
70051
|
+
var _loop_25 = function (type) {
|
|
69988
70052
|
if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
69989
70053
|
var discriminant = getTypeOfPropertyOfType(type, name);
|
|
69990
70054
|
if (discriminant) {
|
|
@@ -70010,7 +70074,7 @@ var ts;
|
|
|
70010
70074
|
};
|
|
70011
70075
|
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
|
|
70012
70076
|
var type = types_15[_i];
|
|
70013
|
-
var state_9 =
|
|
70077
|
+
var state_9 = _loop_25(type);
|
|
70014
70078
|
if (typeof state_9 === "object")
|
|
70015
70079
|
return state_9.value;
|
|
70016
70080
|
}
|
|
@@ -76359,7 +76423,7 @@ var ts;
|
|
|
76359
76423
|
if (spreadIndex >= 0) {
|
|
76360
76424
|
// Create synthetic arguments from spreads of tuple types.
|
|
76361
76425
|
var effectiveArgs_1 = args.slice(0, spreadIndex);
|
|
76362
|
-
var
|
|
76426
|
+
var _loop_26 = function (i) {
|
|
76363
76427
|
var arg = args[i];
|
|
76364
76428
|
// We can call checkExpressionCached because spread expressions never have a contextual type.
|
|
76365
76429
|
var spreadType = arg.kind === 225 /* SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
|
|
@@ -76376,7 +76440,7 @@ var ts;
|
|
|
76376
76440
|
}
|
|
76377
76441
|
};
|
|
76378
76442
|
for (var i = spreadIndex; i < args.length; i++) {
|
|
76379
|
-
|
|
76443
|
+
_loop_26(i);
|
|
76380
76444
|
}
|
|
76381
76445
|
return effectiveArgs_1;
|
|
76382
76446
|
}
|
|
@@ -76705,7 +76769,7 @@ var ts;
|
|
|
76705
76769
|
var min_3 = Number.MAX_VALUE;
|
|
76706
76770
|
var minIndex = 0;
|
|
76707
76771
|
var i_1 = 0;
|
|
76708
|
-
var
|
|
76772
|
+
var _loop_27 = function (c) {
|
|
76709
76773
|
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)); };
|
|
76710
76774
|
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2);
|
|
76711
76775
|
if (diags_2) {
|
|
@@ -76723,7 +76787,7 @@ var ts;
|
|
|
76723
76787
|
};
|
|
76724
76788
|
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
|
|
76725
76789
|
var c = candidatesForArgumentError_1[_a];
|
|
76726
|
-
|
|
76790
|
+
_loop_27(c);
|
|
76727
76791
|
}
|
|
76728
76792
|
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
|
|
76729
76793
|
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
|
|
@@ -76881,7 +76945,7 @@ var ts;
|
|
|
76881
76945
|
}
|
|
76882
76946
|
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
|
|
76883
76947
|
var parameters = [];
|
|
76884
|
-
var
|
|
76948
|
+
var _loop_28 = function (i) {
|
|
76885
76949
|
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
|
|
76886
76950
|
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
|
|
76887
76951
|
i < s.parameters.length ? s.parameters[i] : undefined; });
|
|
@@ -76889,7 +76953,7 @@ var ts;
|
|
|
76889
76953
|
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
|
|
76890
76954
|
};
|
|
76891
76955
|
for (var i = 0; i < maxNonRestParam; i++) {
|
|
76892
|
-
|
|
76956
|
+
_loop_28(i);
|
|
76893
76957
|
}
|
|
76894
76958
|
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
|
|
76895
76959
|
var flags = 0 /* None */;
|
|
@@ -80242,8 +80306,8 @@ var ts;
|
|
|
80242
80306
|
var result = [];
|
|
80243
80307
|
var oldTypeParameters;
|
|
80244
80308
|
var newTypeParameters;
|
|
80245
|
-
for (var _i = 0,
|
|
80246
|
-
var tp =
|
|
80309
|
+
for (var _i = 0, typeParameters_3 = typeParameters; _i < typeParameters_3.length; _i++) {
|
|
80310
|
+
var tp = typeParameters_3[_i];
|
|
80247
80311
|
var name = tp.symbol.escapedName;
|
|
80248
80312
|
if (hasTypeParameterByName(context.inferredTypeParameters, name) || hasTypeParameterByName(result, name)) {
|
|
80249
80313
|
var newName = getUniqueTypeParameterName(ts.concatenate(context.inferredTypeParameters, result), name);
|
|
@@ -80565,12 +80629,14 @@ var ts;
|
|
|
80565
80629
|
error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
80566
80630
|
}
|
|
80567
80631
|
else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
80632
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
80568
80633
|
var source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck);
|
|
80569
80634
|
var target = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSuperTypeForCheck : markerSubTypeForCheck);
|
|
80570
80635
|
var saveVarianceTypeParameter = typeParameter;
|
|
80571
80636
|
varianceTypeParameter = typeParameter;
|
|
80572
80637
|
checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
|
|
80573
80638
|
varianceTypeParameter = saveVarianceTypeParameter;
|
|
80639
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
80574
80640
|
}
|
|
80575
80641
|
}
|
|
80576
80642
|
}
|
|
@@ -80920,7 +80986,7 @@ var ts;
|
|
|
80920
80986
|
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
|
|
80921
80987
|
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
|
|
80922
80988
|
var indexSignatureMap_1 = new ts.Map();
|
|
80923
|
-
var
|
|
80989
|
+
var _loop_29 = function (declaration) {
|
|
80924
80990
|
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
|
|
80925
80991
|
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
|
|
80926
80992
|
var entry = indexSignatureMap_1.get(getTypeId(type));
|
|
@@ -80935,7 +81001,7 @@ var ts;
|
|
|
80935
81001
|
};
|
|
80936
81002
|
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
|
|
80937
81003
|
var declaration = _a[_i];
|
|
80938
|
-
|
|
81004
|
+
_loop_29(declaration);
|
|
80939
81005
|
}
|
|
80940
81006
|
indexSignatureMap_1.forEach(function (entry) {
|
|
80941
81007
|
if (entry.declarations.length > 1) {
|
|
@@ -81158,6 +81224,12 @@ var ts;
|
|
|
81158
81224
|
function checkMissingDeclaration(node) {
|
|
81159
81225
|
checkDecorators(node);
|
|
81160
81226
|
}
|
|
81227
|
+
function getEffectiveTypeArgumentAtIndex(node, typeParameters, index) {
|
|
81228
|
+
if (index < typeParameters.length) {
|
|
81229
|
+
return getTypeFromTypeNode(node.typeArguments[index]);
|
|
81230
|
+
}
|
|
81231
|
+
return getEffectiveTypeArguments(node, typeParameters)[index];
|
|
81232
|
+
}
|
|
81161
81233
|
function getEffectiveTypeArguments(node, typeParameters) {
|
|
81162
81234
|
return fillMissingTypeArguments(ts.map(node.typeArguments, getTypeFromTypeNode), typeParameters, getMinTypeArgumentCount(typeParameters), ts.isInJSFile(node));
|
|
81163
81235
|
}
|
|
@@ -81899,6 +81971,32 @@ var ts;
|
|
|
81899
81971
|
isAwaitedTypeInstantiation(type) ? type.aliasTypeArguments[0] :
|
|
81900
81972
|
type;
|
|
81901
81973
|
}
|
|
81974
|
+
function isAwaitedTypeNeeded(type) {
|
|
81975
|
+
// If this is already an `Awaited<T>`, we shouldn't wrap it. This helps to avoid `Awaited<Awaited<T>>` in higher-order.
|
|
81976
|
+
if (isTypeAny(type) || isAwaitedTypeInstantiation(type)) {
|
|
81977
|
+
return false;
|
|
81978
|
+
}
|
|
81979
|
+
// We only need `Awaited<T>` if `T` contains possibly non-primitive types.
|
|
81980
|
+
if (isGenericObjectType(type)) {
|
|
81981
|
+
var baseConstraint = getBaseConstraintOfType(type);
|
|
81982
|
+
// We only need `Awaited<T>` if `T` has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
|
|
81983
|
+
// or is promise-like.
|
|
81984
|
+
if (!baseConstraint || (baseConstraint.flags & 3 /* AnyOrUnknown */) || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint)) {
|
|
81985
|
+
return true;
|
|
81986
|
+
}
|
|
81987
|
+
}
|
|
81988
|
+
return false;
|
|
81989
|
+
}
|
|
81990
|
+
function tryCreateAwaitedType(type) {
|
|
81991
|
+
// Nothing to do if `Awaited<T>` doesn't exist
|
|
81992
|
+
var awaitedSymbol = getGlobalAwaitedSymbol(/*reportErrors*/ true);
|
|
81993
|
+
if (awaitedSymbol) {
|
|
81994
|
+
// Unwrap unions that may contain `Awaited<T>`, otherwise its possible to manufacture an `Awaited<Awaited<T> | U>` where
|
|
81995
|
+
// an `Awaited<T | U>` would suffice.
|
|
81996
|
+
return getTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
|
|
81997
|
+
}
|
|
81998
|
+
return undefined;
|
|
81999
|
+
}
|
|
81902
82000
|
function createAwaitedTypeIfNeeded(type) {
|
|
81903
82001
|
// We wrap type `T` in `Awaited<T>` based on the following conditions:
|
|
81904
82002
|
// - `T` is not already an `Awaited<U>`, and
|
|
@@ -81907,26 +82005,10 @@ var ts;
|
|
|
81907
82005
|
// - `T` has no base constraint, or
|
|
81908
82006
|
// - The base constraint of `T` is `any`, `unknown`, `object`, or `{}`, or
|
|
81909
82007
|
// - The base constraint of `T` is an object type with a callable `then` method.
|
|
81910
|
-
if (
|
|
81911
|
-
|
|
81912
|
-
|
|
81913
|
-
|
|
81914
|
-
if (isAwaitedTypeInstantiation(type)) {
|
|
81915
|
-
return type;
|
|
81916
|
-
}
|
|
81917
|
-
// Only instantiate `Awaited<T>` if `T` contains possibly non-primitive types.
|
|
81918
|
-
if (isGenericObjectType(type)) {
|
|
81919
|
-
var baseConstraint = getBaseConstraintOfType(type);
|
|
81920
|
-
// Only instantiate `Awaited<T>` if `T` has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
|
|
81921
|
-
// or is promise-like.
|
|
81922
|
-
if (!baseConstraint || (baseConstraint.flags & 3 /* AnyOrUnknown */) || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint)) {
|
|
81923
|
-
// Nothing to do if `Awaited<T>` doesn't exist
|
|
81924
|
-
var awaitedSymbol = getGlobalAwaitedSymbol(/*reportErrors*/ true);
|
|
81925
|
-
if (awaitedSymbol) {
|
|
81926
|
-
// Unwrap unions that may contain `Awaited<T>`, otherwise its possible to manufacture an `Awaited<Awaited<T> | U>` where
|
|
81927
|
-
// an `Awaited<T | U>` would suffice.
|
|
81928
|
-
return getTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
|
|
81929
|
-
}
|
|
82008
|
+
if (isAwaitedTypeNeeded(type)) {
|
|
82009
|
+
var awaitedType = tryCreateAwaitedType(type);
|
|
82010
|
+
if (awaitedType) {
|
|
82011
|
+
return awaitedType;
|
|
81930
82012
|
}
|
|
81931
82013
|
}
|
|
81932
82014
|
ts.Debug.assert(getPromisedTypeOfPromise(type) === undefined, "type provided should not be a non-generic 'promise'-like.");
|
|
@@ -81966,8 +82048,21 @@ var ts;
|
|
|
81966
82048
|
}
|
|
81967
82049
|
// For a union, get a union of the awaited types of each constituent.
|
|
81968
82050
|
if (type.flags & 1048576 /* Union */) {
|
|
82051
|
+
if (awaitedTypeStack.lastIndexOf(type.id) >= 0) {
|
|
82052
|
+
if (errorNode) {
|
|
82053
|
+
error(errorNode, ts.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
82054
|
+
}
|
|
82055
|
+
return undefined;
|
|
82056
|
+
}
|
|
81969
82057
|
var mapper = errorNode ? function (constituentType) { return getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0); } : getAwaitedTypeNoAlias;
|
|
81970
|
-
|
|
82058
|
+
awaitedTypeStack.push(type.id);
|
|
82059
|
+
var mapped = mapType(type, mapper);
|
|
82060
|
+
awaitedTypeStack.pop();
|
|
82061
|
+
return typeAsAwaitable.awaitedTypeOfType = mapped;
|
|
82062
|
+
}
|
|
82063
|
+
// If `type` is generic and should be wrapped in `Awaited<T>`, return it.
|
|
82064
|
+
if (isAwaitedTypeNeeded(type)) {
|
|
82065
|
+
return typeAsAwaitable.awaitedTypeOfType = type;
|
|
81971
82066
|
}
|
|
81972
82067
|
var thisTypeForErrorOut = { value: undefined };
|
|
81973
82068
|
var promisedType = getPromisedTypeOfPromise(type, /*errorNode*/ undefined, thisTypeForErrorOut);
|
|
@@ -82616,8 +82711,8 @@ var ts;
|
|
|
82616
82711
|
return;
|
|
82617
82712
|
var typeParameters = ts.getEffectiveTypeParameterDeclarations(node);
|
|
82618
82713
|
var seenParentsWithEveryUnused = new ts.Set();
|
|
82619
|
-
for (var _i = 0,
|
|
82620
|
-
var typeParameter =
|
|
82714
|
+
for (var _i = 0, typeParameters_4 = typeParameters; _i < typeParameters_4.length; _i++) {
|
|
82715
|
+
var typeParameter = typeParameters_4[_i];
|
|
82621
82716
|
if (!isTypeParameterUnused(typeParameter))
|
|
82622
82717
|
continue;
|
|
82623
82718
|
var name = ts.idText(typeParameter.name);
|
|
@@ -84436,7 +84531,7 @@ var ts;
|
|
|
84436
84531
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84437
84532
|
var localPropDeclaration = declaration && declaration.kind === 221 /* BinaryExpression */ ||
|
|
84438
84533
|
name && name.kind === 162 /* ComputedPropertyName */ || getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
84439
|
-
var
|
|
84534
|
+
var _loop_30 = function (info) {
|
|
84440
84535
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
84441
84536
|
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
|
|
84442
84537
|
// in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
|
|
@@ -84449,7 +84544,7 @@ var ts;
|
|
|
84449
84544
|
};
|
|
84450
84545
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
84451
84546
|
var info = indexInfos_9[_i];
|
|
84452
|
-
|
|
84547
|
+
_loop_30(info);
|
|
84453
84548
|
}
|
|
84454
84549
|
}
|
|
84455
84550
|
function checkIndexConstraintForIndexSignature(type, checkInfo) {
|
|
@@ -84457,7 +84552,7 @@ var ts;
|
|
|
84457
84552
|
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
|
|
84458
84553
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84459
84554
|
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
|
|
84460
|
-
var
|
|
84555
|
+
var _loop_31 = function (info) {
|
|
84461
84556
|
if (info === checkInfo)
|
|
84462
84557
|
return "continue";
|
|
84463
84558
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
@@ -84472,7 +84567,7 @@ var ts;
|
|
|
84472
84567
|
};
|
|
84473
84568
|
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
84474
84569
|
var info = indexInfos_10[_i];
|
|
84475
|
-
|
|
84570
|
+
_loop_31(info);
|
|
84476
84571
|
}
|
|
84477
84572
|
}
|
|
84478
84573
|
function checkTypeNameIsReserved(name, message) {
|
|
@@ -84792,7 +84887,7 @@ var ts;
|
|
|
84792
84887
|
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
84793
84888
|
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
84794
84889
|
var baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
84795
|
-
var
|
|
84890
|
+
var _loop_32 = function (member) {
|
|
84796
84891
|
if (ts.hasAmbientModifier(member)) {
|
|
84797
84892
|
return "continue";
|
|
84798
84893
|
}
|
|
@@ -84809,7 +84904,7 @@ var ts;
|
|
|
84809
84904
|
};
|
|
84810
84905
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
84811
84906
|
var member = _a[_i];
|
|
84812
|
-
|
|
84907
|
+
_loop_32(member);
|
|
84813
84908
|
}
|
|
84814
84909
|
}
|
|
84815
84910
|
/**
|
|
@@ -84897,7 +84992,7 @@ var ts;
|
|
|
84897
84992
|
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
|
|
84898
84993
|
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
|
|
84899
84994
|
var issuedMemberError = false;
|
|
84900
|
-
var
|
|
84995
|
+
var _loop_33 = function (member) {
|
|
84901
84996
|
if (ts.isStatic(member)) {
|
|
84902
84997
|
return "continue";
|
|
84903
84998
|
}
|
|
@@ -84916,7 +85011,7 @@ var ts;
|
|
|
84916
85011
|
};
|
|
84917
85012
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
84918
85013
|
var member = _a[_i];
|
|
84919
|
-
|
|
85014
|
+
_loop_33(member);
|
|
84920
85015
|
}
|
|
84921
85016
|
if (!issuedMemberError) {
|
|
84922
85017
|
// check again with diagnostics to generate a less-specific error
|
|
@@ -84987,7 +85082,7 @@ var ts;
|
|
|
84987
85082
|
var _a, _b, _c, _d;
|
|
84988
85083
|
// NOTE: assignability is checked in checkClassDeclaration
|
|
84989
85084
|
var baseProperties = getPropertiesOfType(baseType);
|
|
84990
|
-
var
|
|
85085
|
+
var _loop_34 = function (baseProperty) {
|
|
84991
85086
|
var base = getTargetSymbol(baseProperty);
|
|
84992
85087
|
if (base.flags & 4194304 /* Prototype */) {
|
|
84993
85088
|
return "continue";
|
|
@@ -85097,7 +85192,7 @@ var ts;
|
|
|
85097
85192
|
};
|
|
85098
85193
|
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
|
|
85099
85194
|
var baseProperty = baseProperties_1[_i];
|
|
85100
|
-
var state_10 =
|
|
85195
|
+
var state_10 = _loop_34(baseProperty);
|
|
85101
85196
|
switch (state_10) {
|
|
85102
85197
|
case "continue-basePropertyCheck": continue basePropertyCheck;
|
|
85103
85198
|
}
|
|
@@ -111612,7 +111707,6 @@ var ts;
|
|
|
111612
111707
|
if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
|
|
111613
111708
|
// Update the output signature
|
|
111614
111709
|
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, createHash, changedDtsData);
|
|
111615
|
-
newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
|
|
111616
111710
|
}
|
|
111617
111711
|
// Update sourceFileInfo
|
|
111618
111712
|
var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
|
|
@@ -120999,7 +121093,7 @@ var ts;
|
|
|
120999
121093
|
state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
|
|
121000
121094
|
}
|
|
121001
121095
|
state.changedFilesSet = new ts.Set();
|
|
121002
|
-
state.
|
|
121096
|
+
state.latestChangedDtsFile = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.latestChangedDtsFile : undefined;
|
|
121003
121097
|
var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
|
|
121004
121098
|
var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
|
|
121005
121099
|
var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
|
|
@@ -121123,7 +121217,7 @@ var ts;
|
|
|
121123
121217
|
programEmitComplete: state.programEmitComplete,
|
|
121124
121218
|
emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
|
|
121125
121219
|
outSignature: state.outSignature,
|
|
121126
|
-
|
|
121220
|
+
latestChangedDtsFile: state.latestChangedDtsFile,
|
|
121127
121221
|
hasChangedEmitSignature: state.hasChangedEmitSignature,
|
|
121128
121222
|
changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
|
|
121129
121223
|
};
|
|
@@ -121136,7 +121230,7 @@ var ts;
|
|
|
121136
121230
|
state.programEmitComplete = savedEmitState.programEmitComplete;
|
|
121137
121231
|
state.emitSignatures = savedEmitState.emitSignatures;
|
|
121138
121232
|
state.outSignature = savedEmitState.outSignature;
|
|
121139
|
-
state.
|
|
121233
|
+
state.latestChangedDtsFile = savedEmitState.latestChangedDtsFile;
|
|
121140
121234
|
state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
|
|
121141
121235
|
if (savedEmitState.changedFilesSet)
|
|
121142
121236
|
state.changedFilesSet = savedEmitState.changedFilesSet;
|
|
@@ -121450,14 +121544,14 @@ var ts;
|
|
|
121450
121544
|
/**
|
|
121451
121545
|
* Gets the program information to be emitted in buildInfo so that we can use it to create new program
|
|
121452
121546
|
*/
|
|
121453
|
-
function getProgramBuildInfo(state, getCanonicalFileName
|
|
121547
|
+
function getProgramBuildInfo(state, getCanonicalFileName) {
|
|
121454
121548
|
var outFilePath = ts.outFile(state.compilerOptions);
|
|
121455
121549
|
if (outFilePath && !state.compilerOptions.composite)
|
|
121456
121550
|
return;
|
|
121457
121551
|
var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
|
|
121458
121552
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
|
|
121459
|
-
//
|
|
121460
|
-
|
|
121553
|
+
// 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
|
|
121554
|
+
var latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : undefined;
|
|
121461
121555
|
if (outFilePath) {
|
|
121462
121556
|
var fileNames_1 = [];
|
|
121463
121557
|
var fileInfos_1 = [];
|
|
@@ -121473,7 +121567,7 @@ var ts;
|
|
|
121473
121567
|
fileInfos: fileInfos_1,
|
|
121474
121568
|
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
|
|
121475
121569
|
outSignature: state.outSignature,
|
|
121476
|
-
|
|
121570
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
121477
121571
|
};
|
|
121478
121572
|
return result_15;
|
|
121479
121573
|
}
|
|
@@ -121575,7 +121669,7 @@ var ts;
|
|
|
121575
121669
|
affectedFilesPendingEmit: affectedFilesPendingEmit,
|
|
121576
121670
|
changeFileSet: changeFileSet,
|
|
121577
121671
|
emitSignatures: emitSignatures,
|
|
121578
|
-
|
|
121672
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
121579
121673
|
};
|
|
121580
121674
|
return result;
|
|
121581
121675
|
function relativeToBuildInfoEnsuringAbsolutePath(path) {
|
|
@@ -121743,7 +121837,7 @@ var ts;
|
|
|
121743
121837
|
*/
|
|
121744
121838
|
var computeHash = ts.maybeBind(host, host.createHash);
|
|
121745
121839
|
var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
|
|
121746
|
-
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName
|
|
121840
|
+
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
|
|
121747
121841
|
// To ensure that we arent storing any references to old program or new program without state
|
|
121748
121842
|
newProgram = undefined; // TODO: GH#18217
|
|
121749
121843
|
oldProgram = undefined;
|
|
@@ -121753,6 +121847,7 @@ var ts;
|
|
|
121753
121847
|
builderProgram.getState = getState;
|
|
121754
121848
|
builderProgram.saveEmitState = function () { return backupBuilderProgramEmitState(state); };
|
|
121755
121849
|
builderProgram.restoreEmitState = function (saved) { return restoreBuilderProgramEmitState(state, saved); };
|
|
121850
|
+
builderProgram.hasChangedEmitSignature = function () { return !!state.hasChangedEmitSignature; };
|
|
121756
121851
|
builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
|
|
121757
121852
|
builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
|
|
121758
121853
|
builderProgram.emit = emit;
|
|
@@ -121860,18 +121955,22 @@ var ts;
|
|
|
121860
121955
|
var filePath = sourceFiles[0].resolvedPath;
|
|
121861
121956
|
var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath);
|
|
121862
121957
|
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text, computeHash, data));
|
|
121863
|
-
if
|
|
121864
|
-
|
|
121865
|
-
|
|
121866
|
-
|
|
121958
|
+
// Dont write dts files if they didn't change
|
|
121959
|
+
if (emitSignature === oldSignature)
|
|
121960
|
+
return;
|
|
121961
|
+
((_g = state.emitSignatures) !== null && _g !== void 0 ? _g : (state.emitSignatures = new ts.Map())).set(filePath, emitSignature);
|
|
121962
|
+
state.hasChangedEmitSignature = true;
|
|
121963
|
+
state.latestChangedDtsFile = fileName;
|
|
121867
121964
|
}
|
|
121868
121965
|
}
|
|
121869
121966
|
else if (state.compilerOptions.composite) {
|
|
121870
121967
|
var newSignature = computeSignature(text, computeHash, data);
|
|
121871
|
-
if
|
|
121872
|
-
|
|
121873
|
-
|
|
121874
|
-
|
|
121968
|
+
// Dont write dts files if they didn't change
|
|
121969
|
+
if (newSignature === state.outSignature)
|
|
121970
|
+
return;
|
|
121971
|
+
state.outSignature = newSignature;
|
|
121972
|
+
state.hasChangedEmitSignature = true;
|
|
121973
|
+
state.latestChangedDtsFile = fileName;
|
|
121875
121974
|
}
|
|
121876
121975
|
}
|
|
121877
121976
|
if (writeFile)
|
|
@@ -122034,11 +122133,12 @@ var ts;
|
|
|
122034
122133
|
var state;
|
|
122035
122134
|
var filePaths;
|
|
122036
122135
|
var filePathsSetList;
|
|
122136
|
+
var latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : undefined;
|
|
122037
122137
|
if (isProgramBundleEmitBuildInfo(program)) {
|
|
122038
122138
|
state = {
|
|
122039
122139
|
fileInfos: new ts.Map(),
|
|
122040
122140
|
compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
|
|
122041
|
-
|
|
122141
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
122042
122142
|
outSignature: program.outSignature,
|
|
122043
122143
|
};
|
|
122044
122144
|
}
|
|
@@ -122071,7 +122171,7 @@ var ts;
|
|
|
122071
122171
|
affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
|
|
122072
122172
|
affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
|
|
122073
122173
|
changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
|
|
122074
|
-
|
|
122174
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
122075
122175
|
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
|
122076
122176
|
};
|
|
122077
122177
|
}
|
|
@@ -122098,6 +122198,7 @@ var ts;
|
|
|
122098
122198
|
getSemanticDiagnosticsOfNextAffectedFile: ts.notImplemented,
|
|
122099
122199
|
emitBuildInfo: ts.notImplemented,
|
|
122100
122200
|
close: ts.noop,
|
|
122201
|
+
hasChangedEmitSignature: ts.returnFalse,
|
|
122101
122202
|
};
|
|
122102
122203
|
function toPath(path) {
|
|
122103
122204
|
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
@@ -123412,7 +123513,7 @@ var ts;
|
|
|
123412
123513
|
});
|
|
123413
123514
|
// Sort by paths closest to importing file Name directory
|
|
123414
123515
|
var sortedPaths = [];
|
|
123415
|
-
var
|
|
123516
|
+
var _loop_35 = function (directory) {
|
|
123416
123517
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
123417
123518
|
var pathsInDirectory;
|
|
123418
123519
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -123436,7 +123537,7 @@ var ts;
|
|
|
123436
123537
|
};
|
|
123437
123538
|
var out_directory_1;
|
|
123438
123539
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
123439
|
-
var state_11 =
|
|
123540
|
+
var state_11 = _loop_35(directory);
|
|
123440
123541
|
directory = out_directory_1;
|
|
123441
123542
|
if (state_11 === "break")
|
|
123442
123543
|
break;
|
|
@@ -124280,7 +124381,6 @@ var ts;
|
|
|
124280
124381
|
readDirectory: ts.maybeBind(host, host.readDirectory),
|
|
124281
124382
|
disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
|
|
124282
124383
|
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
|
|
124283
|
-
now: ts.maybeBind(host, host.now),
|
|
124284
124384
|
};
|
|
124285
124385
|
function writeFile(fileName, text, writeByteOrderMark, onError) {
|
|
124286
124386
|
try {
|
|
@@ -124438,7 +124538,6 @@ var ts;
|
|
|
124438
124538
|
host.createHash = ts.maybeBind(system, system.createHash);
|
|
124439
124539
|
host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
|
|
124440
124540
|
host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
|
|
124441
|
-
host.now = ts.maybeBind(system, system.now);
|
|
124442
124541
|
ts.setGetSourceFileAsHashVersioned(host, system);
|
|
124443
124542
|
ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
|
|
124444
124543
|
return host;
|
|
@@ -125766,8 +125865,7 @@ var ts;
|
|
|
125766
125865
|
}
|
|
125767
125866
|
// Actual Emit
|
|
125768
125867
|
var host = state.host, compilerHost = state.compilerHost;
|
|
125769
|
-
var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
|
|
125770
|
-
var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
|
|
125868
|
+
var resultFlags = ((_d = program.hasChangedEmitSignature) === null || _d === void 0 ? void 0 : _d.call(program)) ? BuildResultFlags.None : BuildResultFlags.DeclarationOutputUnchanged;
|
|
125771
125869
|
var emitterDiagnostics = ts.createDiagnosticCollection();
|
|
125772
125870
|
var emittedOutputs = new ts.Map();
|
|
125773
125871
|
var options = program.getCompilerOptions();
|
|
@@ -125775,17 +125873,11 @@ var ts;
|
|
|
125775
125873
|
var outputTimeStampMap;
|
|
125776
125874
|
var now;
|
|
125777
125875
|
outputFiles.forEach(function (_a) {
|
|
125778
|
-
var _b, _c;
|
|
125779
125876
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
125780
125877
|
var path = toPath(state, name);
|
|
125781
125878
|
emittedOutputs.set(toPath(state, name), name);
|
|
125782
|
-
if (buildInfo)
|
|
125783
|
-
setBuildInfo(state, buildInfo, projectPath, options);
|
|
125784
|
-
// Buildinfo has information on when last dts change time
|
|
125785
|
-
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)) {
|
|
125786
|
-
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
|
125787
|
-
}
|
|
125788
|
-
}
|
|
125879
|
+
if (buildInfo)
|
|
125880
|
+
setBuildInfo(state, buildInfo, projectPath, options, resultFlags);
|
|
125789
125881
|
ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
|
|
125790
125882
|
if (!isIncremental && state.watch) {
|
|
125791
125883
|
(outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
|
|
@@ -125799,7 +125891,7 @@ var ts;
|
|
|
125799
125891
|
ts.Debug.assert(step === BuildStep.EmitBuildInfo);
|
|
125800
125892
|
var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
|
|
125801
125893
|
if (data === null || data === void 0 ? void 0 : data.buildInfo)
|
|
125802
|
-
setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
|
|
125894
|
+
setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions(), BuildResultFlags.DeclarationOutputUnchanged);
|
|
125803
125895
|
if (writeFileCallback)
|
|
125804
125896
|
writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
125805
125897
|
else
|
|
@@ -125832,7 +125924,6 @@ var ts;
|
|
|
125832
125924
|
state.diagnostics.delete(projectPath);
|
|
125833
125925
|
state.projectStatus.set(projectPath, {
|
|
125834
125926
|
type: ts.UpToDateStatusType.UpToDate,
|
|
125835
|
-
newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
|
|
125836
125927
|
oldestOutputFileName: oldestOutputFileName
|
|
125837
125928
|
});
|
|
125838
125929
|
afterProgramDone(state, program, config);
|
|
@@ -125874,10 +125965,10 @@ var ts;
|
|
|
125874
125965
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
125875
125966
|
emittedOutputs.set(toPath(state, name), name);
|
|
125876
125967
|
if (buildInfo) {
|
|
125877
|
-
|
|
125878
|
-
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
|
|
125968
|
+
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) {
|
|
125879
125969
|
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
|
125880
125970
|
}
|
|
125971
|
+
setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags);
|
|
125881
125972
|
}
|
|
125882
125973
|
ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
|
|
125883
125974
|
});
|
|
@@ -126136,15 +126227,23 @@ var ts;
|
|
|
126136
126227
|
state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
|
|
126137
126228
|
return result;
|
|
126138
126229
|
}
|
|
126139
|
-
function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
|
|
126230
|
+
function setBuildInfo(state, buildInfo, resolvedConfigPath, options, resultFlags) {
|
|
126140
126231
|
var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
|
|
126141
126232
|
var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
|
|
126233
|
+
var modifiedTime = getCurrentTime(state.host);
|
|
126142
126234
|
if (existing) {
|
|
126143
126235
|
existing.buildInfo = buildInfo;
|
|
126144
|
-
existing.modifiedTime =
|
|
126236
|
+
existing.modifiedTime = modifiedTime;
|
|
126237
|
+
if (!(resultFlags & BuildResultFlags.DeclarationOutputUnchanged))
|
|
126238
|
+
existing.latestChangedDtsTime = modifiedTime;
|
|
126145
126239
|
}
|
|
126146
126240
|
else {
|
|
126147
|
-
state.buildInfoCache.set(resolvedConfigPath, {
|
|
126241
|
+
state.buildInfoCache.set(resolvedConfigPath, {
|
|
126242
|
+
path: toPath(state, buildInfoPath),
|
|
126243
|
+
buildInfo: buildInfo,
|
|
126244
|
+
modifiedTime: modifiedTime,
|
|
126245
|
+
latestChangedDtsTime: resultFlags & BuildResultFlags.DeclarationOutputUnchanged ? undefined : modifiedTime,
|
|
126246
|
+
});
|
|
126148
126247
|
}
|
|
126149
126248
|
}
|
|
126150
126249
|
function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
|
|
@@ -126176,7 +126275,7 @@ var ts;
|
|
|
126176
126275
|
}
|
|
126177
126276
|
}
|
|
126178
126277
|
function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
126179
|
-
var _a, _b
|
|
126278
|
+
var _a, _b;
|
|
126180
126279
|
// Container if no files are specified in the project
|
|
126181
126280
|
if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
|
|
126182
126281
|
return {
|
|
@@ -126188,8 +126287,8 @@ var ts;
|
|
|
126188
126287
|
var force = !!state.options.force;
|
|
126189
126288
|
if (project.projectReferences) {
|
|
126190
126289
|
state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
|
|
126191
|
-
for (var _i = 0,
|
|
126192
|
-
var ref =
|
|
126290
|
+
for (var _i = 0, _c = project.projectReferences; _i < _c.length; _i++) {
|
|
126291
|
+
var ref = _c[_i];
|
|
126193
126292
|
var resolvedRef = ts.resolveProjectReferencePath(ref);
|
|
126194
126293
|
var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
|
|
126195
126294
|
var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
|
|
@@ -126229,7 +126328,6 @@ var ts;
|
|
|
126229
126328
|
var buildInfoTime;
|
|
126230
126329
|
var buildInfoProgram;
|
|
126231
126330
|
var buildInfoVersionMap;
|
|
126232
|
-
var newestDeclarationFileContentChangedTime;
|
|
126233
126331
|
if (buildInfoPath) {
|
|
126234
126332
|
var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
|
|
126235
126333
|
buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
|
|
@@ -126266,8 +126364,6 @@ var ts;
|
|
|
126266
126364
|
}
|
|
126267
126365
|
oldestOutputFileTime = buildInfoTime;
|
|
126268
126366
|
oldestOutputFileName = buildInfoPath;
|
|
126269
|
-
// Get the last dtsChange time from build info
|
|
126270
|
-
newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
|
|
126271
126367
|
}
|
|
126272
126368
|
// Check input files
|
|
126273
126369
|
var newestInputFileName = undefined;
|
|
@@ -126275,8 +126371,8 @@ var ts;
|
|
|
126275
126371
|
/** 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 */
|
|
126276
126372
|
var pseudoInputUpToDate = false;
|
|
126277
126373
|
// Get timestamps of input files
|
|
126278
|
-
for (var
|
|
126279
|
-
var inputFile =
|
|
126374
|
+
for (var _d = 0, _e = project.fileNames; _d < _e.length; _d++) {
|
|
126375
|
+
var inputFile = _e[_d];
|
|
126280
126376
|
var inputTime = getModifiedTime(state, inputFile);
|
|
126281
126377
|
if (inputTime === ts.missingFileModifiedTime) {
|
|
126282
126378
|
return {
|
|
@@ -126317,8 +126413,8 @@ var ts;
|
|
|
126317
126413
|
// Collect the expected outputs of this project
|
|
126318
126414
|
var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
|
|
126319
126415
|
var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
|
|
126320
|
-
for (var
|
|
126321
|
-
var output = outputs_1[
|
|
126416
|
+
for (var _f = 0, outputs_1 = outputs; _f < outputs_1.length; _f++) {
|
|
126417
|
+
var output = outputs_1[_f];
|
|
126322
126418
|
var path = toPath(state, output);
|
|
126323
126419
|
// Output is missing; can stop checking
|
|
126324
126420
|
var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
|
|
@@ -126356,8 +126452,8 @@ var ts;
|
|
|
126356
126452
|
var usesPrepend = false;
|
|
126357
126453
|
var upstreamChangedProject;
|
|
126358
126454
|
if (referenceStatuses) {
|
|
126359
|
-
for (var
|
|
126360
|
-
var
|
|
126455
|
+
for (var _g = 0, referenceStatuses_1 = referenceStatuses; _g < referenceStatuses_1.length; _g++) {
|
|
126456
|
+
var _h = referenceStatuses_1[_g], ref = _h.ref, refStatus = _h.refStatus, resolvedConfig = _h.resolvedConfig, resolvedRefPath = _h.resolvedRefPath;
|
|
126361
126457
|
usesPrepend = usesPrepend || !!(ref.prepend);
|
|
126362
126458
|
// If the upstream project's newest file is older than our oldest output, we
|
|
126363
126459
|
// can't be out of date because of it
|
|
@@ -126374,7 +126470,8 @@ var ts;
|
|
|
126374
126470
|
}
|
|
126375
126471
|
// If the upstream project has only change .d.ts files, and we've built
|
|
126376
126472
|
// *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
|
|
126377
|
-
|
|
126473
|
+
var newestDeclarationFileContentChangedTime = getLatestChangedDtsTime(state, resolvedConfig.options, resolvedRefPath);
|
|
126474
|
+
if (newestDeclarationFileContentChangedTime && newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
|
|
126378
126475
|
pseudoUpToDate = true;
|
|
126379
126476
|
upstreamChangedProject = ref.path;
|
|
126380
126477
|
continue;
|
|
@@ -126417,7 +126514,6 @@ var ts;
|
|
|
126417
126514
|
pseudoInputUpToDate ?
|
|
126418
126515
|
ts.UpToDateStatusType.UpToDateWithInputFileText :
|
|
126419
126516
|
ts.UpToDateStatusType.UpToDate,
|
|
126420
|
-
newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
|
|
126421
126517
|
newestInputFileTime: newestInputFileTime,
|
|
126422
126518
|
newestInputFileName: newestInputFileName,
|
|
126423
126519
|
oldestOutputFileName: oldestOutputFileName
|
|
@@ -126501,13 +126597,17 @@ var ts;
|
|
|
126501
126597
|
outputTimeStampMap.delete(key);
|
|
126502
126598
|
});
|
|
126503
126599
|
}
|
|
126504
|
-
function
|
|
126505
|
-
var _a;
|
|
126600
|
+
function getLatestChangedDtsTime(state, options, resolvedConfigPath) {
|
|
126506
126601
|
if (!options.composite)
|
|
126507
126602
|
return undefined;
|
|
126508
|
-
var
|
|
126509
|
-
|
|
126510
|
-
|
|
126603
|
+
var entry = ts.Debug.checkDefined(state.buildInfoCache.get(resolvedConfigPath));
|
|
126604
|
+
if (entry.latestChangedDtsTime !== undefined)
|
|
126605
|
+
return entry.latestChangedDtsTime || undefined;
|
|
126606
|
+
var latestChangedDtsTime = entry.buildInfo && entry.buildInfo.program && entry.buildInfo.program.latestChangedDtsFile ?
|
|
126607
|
+
state.host.getModifiedTime(ts.getNormalizedAbsolutePath(entry.buildInfo.program.latestChangedDtsFile, ts.getDirectoryPath(entry.path))) :
|
|
126608
|
+
undefined;
|
|
126609
|
+
entry.latestChangedDtsTime = latestChangedDtsTime || false;
|
|
126610
|
+
return latestChangedDtsTime;
|
|
126511
126611
|
}
|
|
126512
126612
|
function updateOutputTimestamps(state, proj, resolvedPath) {
|
|
126513
126613
|
if (state.options.dry) {
|
|
@@ -126516,7 +126616,6 @@ var ts;
|
|
|
126516
126616
|
updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
|
|
126517
126617
|
state.projectStatus.set(resolvedPath, {
|
|
126518
126618
|
type: ts.UpToDateStatusType.UpToDate,
|
|
126519
|
-
newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
|
|
126520
126619
|
oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
|
|
126521
126620
|
});
|
|
126522
126621
|
}
|