typescript 4.8.0-dev.20220630 → 4.8.0-dev.20220704
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 +242 -173
- package/lib/tsserver.js +263 -192
- package/lib/tsserverlibrary.js +263 -192
- package/lib/typescript.js +263 -192
- package/lib/typescriptServices.js +263 -192
- package/lib/typingsInstaller.js +263 -192
- 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.20220704";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -5256,9 +5256,10 @@ var ts;
|
|
|
5256
5256
|
(function (TypeMapKind) {
|
|
5257
5257
|
TypeMapKind[TypeMapKind["Simple"] = 0] = "Simple";
|
|
5258
5258
|
TypeMapKind[TypeMapKind["Array"] = 1] = "Array";
|
|
5259
|
-
TypeMapKind[TypeMapKind["
|
|
5260
|
-
TypeMapKind[TypeMapKind["
|
|
5261
|
-
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";
|
|
5262
5263
|
})(TypeMapKind = ts.TypeMapKind || (ts.TypeMapKind = {}));
|
|
5263
5264
|
var InferencePriority;
|
|
5264
5265
|
(function (InferencePriority) {
|
|
@@ -48661,6 +48662,24 @@ var ts;
|
|
|
48661
48662
|
var Symbol = ts.objectAllocator.getSymbolConstructor();
|
|
48662
48663
|
var Type = ts.objectAllocator.getTypeConstructor();
|
|
48663
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
|
+
}());
|
|
48664
48683
|
var typeCount = 0;
|
|
48665
48684
|
var symbolCount = 0;
|
|
48666
48685
|
var enumCount = 0;
|
|
@@ -49121,10 +49140,23 @@ var ts;
|
|
|
49121
49140
|
var numberOrBigIntType = getUnionType([numberType, bigintType]);
|
|
49122
49141
|
var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
|
|
49123
49142
|
var numericStringType = getTemplateLiteralType(["", ""], [numberType]); // The `${number}` type
|
|
49124
|
-
var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; });
|
|
49125
|
-
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)"; });
|
|
49126
49145
|
var uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never"); // `uniqueLiteralType` is a special `never` flagged by union reduction to behave as a literal
|
|
49127
|
-
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)"; });
|
|
49128
49160
|
var emptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49129
49161
|
var emptyJsxObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49130
49162
|
emptyJsxObjectType.objectFlags |= 2048 /* JsxAttributes */;
|
|
@@ -49284,7 +49316,6 @@ var ts;
|
|
|
49284
49316
|
var typeofType = createTypeofType();
|
|
49285
49317
|
var _jsxNamespace;
|
|
49286
49318
|
var _jsxFactoryEntity;
|
|
49287
|
-
var outofbandVarianceMarkerHandler;
|
|
49288
49319
|
var subtypeRelation = new ts.Map();
|
|
49289
49320
|
var strictSubtypeRelation = new ts.Map();
|
|
49290
49321
|
var assignableRelation = new ts.Map();
|
|
@@ -53051,7 +53082,7 @@ var ts;
|
|
|
53051
53082
|
var name = typeParameterToName(newParam, context);
|
|
53052
53083
|
var newTypeVariable = ts.factory.createTypeReferenceNode(name);
|
|
53053
53084
|
context.approximateLength += 37; // 15 each for two added conditionals, 7 for an added infer type
|
|
53054
|
-
var newMapper = prependTypeMapping(type.root.checkType, newParam, type.
|
|
53085
|
+
var newMapper = prependTypeMapping(type.root.checkType, newParam, type.mapper);
|
|
53055
53086
|
var saveInferTypeParameters_1 = context.inferTypeParameters;
|
|
53056
53087
|
context.inferTypeParameters = type.root.inferTypeParameters;
|
|
53057
53088
|
var extendsTypeNode_1 = typeToTypeNodeHelper(instantiateType(type.root.extendsType, newMapper), context);
|
|
@@ -60462,8 +60493,7 @@ var ts;
|
|
|
60462
60493
|
var _a;
|
|
60463
60494
|
var inferences;
|
|
60464
60495
|
if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
|
|
60465
|
-
|
|
60466
|
-
var declaration = _b[_i];
|
|
60496
|
+
var _loop_15 = function (declaration) {
|
|
60467
60497
|
if (declaration.parent.kind === 190 /* InferType */) {
|
|
60468
60498
|
// When an 'infer T' declaration is immediately contained in a type reference node
|
|
60469
60499
|
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
|
|
@@ -60471,12 +60501,12 @@ var ts;
|
|
|
60471
60501
|
// present, we form an intersection of the inferred constraint types.
|
|
60472
60502
|
var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1];
|
|
60473
60503
|
if (grandParent.kind === 178 /* TypeReference */ && !omitTypeReferences) {
|
|
60474
|
-
var
|
|
60475
|
-
var
|
|
60476
|
-
if (
|
|
60477
|
-
var index =
|
|
60478
|
-
if (index <
|
|
60479
|
-
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]);
|
|
60480
60510
|
if (declaredConstraint) {
|
|
60481
60511
|
// Type parameter constraints can reference other type parameters so
|
|
60482
60512
|
// constraints need to be instantiated. If instantiation produces the
|
|
@@ -60484,7 +60514,9 @@ var ts;
|
|
|
60484
60514
|
// type Foo<T extends string, U extends T> = [T, U];
|
|
60485
60515
|
// type Bar<T> = T extends Foo<infer X, infer X> ? Foo<X, X> : T;
|
|
60486
60516
|
// the instantiated constraint for U is X, so we discard that inference.
|
|
60487
|
-
var mapper =
|
|
60517
|
+
var mapper = makeDeferredTypeMapper(typeParameters_1, typeParameters_1.map(function (_, index) { return function () {
|
|
60518
|
+
return getEffectiveTypeArgumentAtIndex(typeReference_1, typeParameters_1, index);
|
|
60519
|
+
}; }));
|
|
60488
60520
|
var constraint = instantiateType(declaredConstraint, mapper);
|
|
60489
60521
|
if (constraint !== typeParameter) {
|
|
60490
60522
|
inferences = ts.append(inferences, constraint);
|
|
@@ -60522,6 +60554,10 @@ var ts;
|
|
|
60522
60554
|
inferences = ts.append(inferences, instantiateType(nodeType, makeUnaryTypeMapper(getDeclaredTypeOfTypeParameter(getSymbolOfNode(checkMappedType_1.typeParameter)), checkMappedType_1.typeParameter.constraint ? getTypeFromTypeNode(checkMappedType_1.typeParameter.constraint) : keyofConstraintType)));
|
|
60523
60555
|
}
|
|
60524
60556
|
}
|
|
60557
|
+
};
|
|
60558
|
+
for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
|
|
60559
|
+
var declaration = _b[_i];
|
|
60560
|
+
_loop_15(declaration);
|
|
60525
60561
|
}
|
|
60526
60562
|
}
|
|
60527
60563
|
return inferences && getIntersectionType(inferences);
|
|
@@ -61410,7 +61446,7 @@ var ts;
|
|
|
61410
61446
|
var lastRequiredIndex = -1;
|
|
61411
61447
|
var firstRestIndex = -1;
|
|
61412
61448
|
var lastOptionalOrRestIndex = -1;
|
|
61413
|
-
var
|
|
61449
|
+
var _loop_16 = function (i) {
|
|
61414
61450
|
var type = elementTypes[i];
|
|
61415
61451
|
var flags = target.elementFlags[i];
|
|
61416
61452
|
if (flags & 8 /* Variadic */) {
|
|
@@ -61440,7 +61476,7 @@ var ts;
|
|
|
61440
61476
|
}
|
|
61441
61477
|
};
|
|
61442
61478
|
for (var i = 0; i < elementTypes.length; i++) {
|
|
61443
|
-
var state_4 =
|
|
61479
|
+
var state_4 = _loop_16(i);
|
|
61444
61480
|
if (typeof state_4 === "object")
|
|
61445
61481
|
return state_4.value;
|
|
61446
61482
|
}
|
|
@@ -61636,7 +61672,7 @@ var ts;
|
|
|
61636
61672
|
var templates = ts.filter(types, isPatternLiteralType);
|
|
61637
61673
|
if (templates.length) {
|
|
61638
61674
|
var i = types.length;
|
|
61639
|
-
var
|
|
61675
|
+
var _loop_17 = function () {
|
|
61640
61676
|
i--;
|
|
61641
61677
|
var t = types[i];
|
|
61642
61678
|
if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
|
|
@@ -61644,7 +61680,7 @@ var ts;
|
|
|
61644
61680
|
}
|
|
61645
61681
|
};
|
|
61646
61682
|
while (i > 0) {
|
|
61647
|
-
|
|
61683
|
+
_loop_17();
|
|
61648
61684
|
}
|
|
61649
61685
|
}
|
|
61650
61686
|
}
|
|
@@ -61721,14 +61757,14 @@ var ts;
|
|
|
61721
61757
|
var namedUnions = [];
|
|
61722
61758
|
addNamedUnions(namedUnions, types);
|
|
61723
61759
|
var reducedTypes = [];
|
|
61724
|
-
var
|
|
61760
|
+
var _loop_18 = function (t) {
|
|
61725
61761
|
if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
|
|
61726
61762
|
reducedTypes.push(t);
|
|
61727
61763
|
}
|
|
61728
61764
|
};
|
|
61729
61765
|
for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
|
|
61730
61766
|
var t = typeSet_1[_i];
|
|
61731
|
-
|
|
61767
|
+
_loop_18(t);
|
|
61732
61768
|
}
|
|
61733
61769
|
if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
|
|
61734
61770
|
return namedUnions[0];
|
|
@@ -62952,7 +62988,7 @@ var ts;
|
|
|
62952
62988
|
var result;
|
|
62953
62989
|
var extraTypes;
|
|
62954
62990
|
var tailCount = 0;
|
|
62955
|
-
var
|
|
62991
|
+
var _loop_19 = function () {
|
|
62956
62992
|
if (tailCount === 1000) {
|
|
62957
62993
|
error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
62958
62994
|
result = errorType;
|
|
@@ -63073,7 +63109,7 @@ var ts;
|
|
|
63073
63109
|
// another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
|
|
63074
63110
|
// cases we increment the tail recursion counter and stop after 1000 iterations.
|
|
63075
63111
|
while (true) {
|
|
63076
|
-
var state_5 =
|
|
63112
|
+
var state_5 = _loop_19();
|
|
63077
63113
|
if (typeof state_5 === "object")
|
|
63078
63114
|
return state_5.value;
|
|
63079
63115
|
if (state_5 === "break")
|
|
@@ -63703,7 +63739,7 @@ var ts;
|
|
|
63703
63739
|
switch (mapper.kind) {
|
|
63704
63740
|
case 0 /* Simple */:
|
|
63705
63741
|
return type === mapper.source ? mapper.target : type;
|
|
63706
|
-
case 1 /* Array */:
|
|
63742
|
+
case 1 /* Array */: {
|
|
63707
63743
|
var sources = mapper.sources;
|
|
63708
63744
|
var targets = mapper.targets;
|
|
63709
63745
|
for (var i = 0; i < sources.length; i++) {
|
|
@@ -63712,25 +63748,45 @@ var ts;
|
|
|
63712
63748
|
}
|
|
63713
63749
|
}
|
|
63714
63750
|
return type;
|
|
63715
|
-
|
|
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 */:
|
|
63716
63763
|
return mapper.func(type);
|
|
63717
|
-
case
|
|
63718
|
-
case
|
|
63764
|
+
case 4 /* Composite */:
|
|
63765
|
+
case 5 /* Merged */:
|
|
63719
63766
|
var t1 = getMappedType(type, mapper.mapper1);
|
|
63720
|
-
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);
|
|
63721
63773
|
}
|
|
63774
|
+
return mapper;
|
|
63722
63775
|
}
|
|
63723
63776
|
function makeUnaryTypeMapper(source, target) {
|
|
63724
|
-
return { kind: 0 /* Simple */, source: source, target: target };
|
|
63777
|
+
return attachDebugPrototypeIfDebug({ kind: 0 /* Simple */, source: source, target: target });
|
|
63725
63778
|
}
|
|
63726
63779
|
function makeArrayTypeMapper(sources, targets) {
|
|
63727
|
-
return { kind: 1 /* Array */, sources: sources, targets: targets };
|
|
63780
|
+
return attachDebugPrototypeIfDebug({ kind: 1 /* Array */, sources: sources, targets: targets });
|
|
63728
63781
|
}
|
|
63729
|
-
function makeFunctionTypeMapper(func) {
|
|
63730
|
-
return { kind:
|
|
63782
|
+
function makeFunctionTypeMapper(func, debugInfo) {
|
|
63783
|
+
return attachDebugPrototypeIfDebug({ kind: 3 /* Function */, func: func, debugInfo: ts.Debug.isDebugging ? debugInfo : undefined });
|
|
63784
|
+
}
|
|
63785
|
+
function makeDeferredTypeMapper(sources, targets) {
|
|
63786
|
+
return attachDebugPrototypeIfDebug({ kind: 2 /* Deferred */, sources: sources, targets: targets });
|
|
63731
63787
|
}
|
|
63732
63788
|
function makeCompositeTypeMapper(kind, mapper1, mapper2) {
|
|
63733
|
-
return { kind: kind, mapper1: mapper1, mapper2: mapper2 };
|
|
63789
|
+
return attachDebugPrototypeIfDebug({ kind: kind, mapper1: mapper1, mapper2: mapper2 });
|
|
63734
63790
|
}
|
|
63735
63791
|
function createTypeEraser(sources) {
|
|
63736
63792
|
return createTypeMapper(sources, /*targets*/ undefined);
|
|
@@ -63740,19 +63796,20 @@ var ts;
|
|
|
63740
63796
|
* This is used during inference when instantiating type parameter defaults.
|
|
63741
63797
|
*/
|
|
63742
63798
|
function createBackreferenceMapper(context, index) {
|
|
63743
|
-
|
|
63799
|
+
var forwardInferences = context.inferences.slice(index);
|
|
63800
|
+
return createTypeMapper(ts.map(forwardInferences, function (i) { return i.typeParameter; }), ts.map(forwardInferences, function () { return unknownType; }));
|
|
63744
63801
|
}
|
|
63745
63802
|
function combineTypeMappers(mapper1, mapper2) {
|
|
63746
|
-
return mapper1 ? makeCompositeTypeMapper(
|
|
63803
|
+
return mapper1 ? makeCompositeTypeMapper(4 /* Composite */, mapper1, mapper2) : mapper2;
|
|
63747
63804
|
}
|
|
63748
63805
|
function mergeTypeMappers(mapper1, mapper2) {
|
|
63749
|
-
return mapper1 ? makeCompositeTypeMapper(
|
|
63806
|
+
return mapper1 ? makeCompositeTypeMapper(5 /* Merged */, mapper1, mapper2) : mapper2;
|
|
63750
63807
|
}
|
|
63751
63808
|
function prependTypeMapping(source, target, mapper) {
|
|
63752
|
-
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(
|
|
63809
|
+
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* Merged */, makeUnaryTypeMapper(source, target), mapper);
|
|
63753
63810
|
}
|
|
63754
63811
|
function appendTypeMapping(mapper, source, target) {
|
|
63755
|
-
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(
|
|
63812
|
+
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* Merged */, mapper, makeUnaryTypeMapper(source, target));
|
|
63756
63813
|
}
|
|
63757
63814
|
function getRestrictiveTypeParameter(tp) {
|
|
63758
63815
|
return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol),
|
|
@@ -65648,7 +65705,7 @@ var ts;
|
|
|
65648
65705
|
reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
|
|
65649
65706
|
checkTypes = reducedTarget.flags & 1048576 /* Union */ ? reducedTarget.types : [reducedTarget];
|
|
65650
65707
|
}
|
|
65651
|
-
var
|
|
65708
|
+
var _loop_20 = function (prop) {
|
|
65652
65709
|
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
|
|
65653
65710
|
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
|
|
65654
65711
|
if (reportErrors) {
|
|
@@ -65711,7 +65768,7 @@ var ts;
|
|
|
65711
65768
|
};
|
|
65712
65769
|
for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
|
|
65713
65770
|
var prop = _b[_i];
|
|
65714
|
-
var state_6 =
|
|
65771
|
+
var state_6 = _loop_20(prop);
|
|
65715
65772
|
if (typeof state_6 === "object")
|
|
65716
65773
|
return state_6.value;
|
|
65717
65774
|
}
|
|
@@ -65943,10 +66000,10 @@ var ts;
|
|
|
65943
66000
|
// We're in the middle of variance checking - integrate any unmeasurable/unreliable flags from this cached component
|
|
65944
66001
|
var saved = entry & 24 /* ReportsMask */;
|
|
65945
66002
|
if (saved & 8 /* ReportsUnmeasurable */) {
|
|
65946
|
-
instantiateType(source,
|
|
66003
|
+
instantiateType(source, reportUnmeasurableMapper);
|
|
65947
66004
|
}
|
|
65948
66005
|
if (saved & 16 /* ReportsUnreliable */) {
|
|
65949
|
-
instantiateType(source,
|
|
66006
|
+
instantiateType(source, reportUnreliableMapper);
|
|
65950
66007
|
}
|
|
65951
66008
|
}
|
|
65952
66009
|
return entry & 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */;
|
|
@@ -66372,7 +66429,7 @@ var ts;
|
|
|
66372
66429
|
}
|
|
66373
66430
|
// Report unreliable variance for type variables referenced in template literal type placeholders.
|
|
66374
66431
|
// For example, `foo-${number}` is related to `foo-${string}` even though number isn't related to string.
|
|
66375
|
-
instantiateType(source,
|
|
66432
|
+
instantiateType(source, reportUnreliableMapper);
|
|
66376
66433
|
}
|
|
66377
66434
|
if (isTypeMatchedByTemplateLiteralType(source, target)) {
|
|
66378
66435
|
return -1 /* True */;
|
|
@@ -66644,18 +66701,6 @@ var ts;
|
|
|
66644
66701
|
}
|
|
66645
66702
|
}
|
|
66646
66703
|
}
|
|
66647
|
-
function reportUnmeasurableMarkers(p) {
|
|
66648
|
-
if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
|
|
66649
|
-
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ false);
|
|
66650
|
-
}
|
|
66651
|
-
return p;
|
|
66652
|
-
}
|
|
66653
|
-
function reportUnreliableMarkers(p) {
|
|
66654
|
-
if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
|
|
66655
|
-
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ true);
|
|
66656
|
-
}
|
|
66657
|
-
return p;
|
|
66658
|
-
}
|
|
66659
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
|
|
66660
66705
|
// related to Y, where X' is an instantiation of X in which P is replaced with Q. Notice
|
|
66661
66706
|
// that S and T are contra-variant whereas X and Y are co-variant.
|
|
@@ -66665,7 +66710,7 @@ var ts;
|
|
|
66665
66710
|
if (modifiersRelated) {
|
|
66666
66711
|
var result_10;
|
|
66667
66712
|
var targetConstraint = getConstraintTypeFromMappedType(target);
|
|
66668
|
-
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source),
|
|
66713
|
+
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMapper : reportUnreliableMapper);
|
|
66669
66714
|
if (result_10 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
|
|
66670
66715
|
var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
|
|
66671
66716
|
if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
|
|
@@ -66719,11 +66764,11 @@ var ts;
|
|
|
66719
66764
|
// constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
|
|
66720
66765
|
var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
|
|
66721
66766
|
var matchingTypes = [];
|
|
66722
|
-
var
|
|
66767
|
+
var _loop_21 = function (combination) {
|
|
66723
66768
|
var hasMatch = false;
|
|
66724
66769
|
outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
|
|
66725
66770
|
var type = _d[_c];
|
|
66726
|
-
var
|
|
66771
|
+
var _loop_22 = function (i) {
|
|
66727
66772
|
var sourceProperty = sourcePropertiesFiltered[i];
|
|
66728
66773
|
var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
|
|
66729
66774
|
if (!targetProperty)
|
|
@@ -66739,7 +66784,7 @@ var ts;
|
|
|
66739
66784
|
}
|
|
66740
66785
|
};
|
|
66741
66786
|
for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
|
|
66742
|
-
var state_8 =
|
|
66787
|
+
var state_8 = _loop_22(i);
|
|
66743
66788
|
switch (state_8) {
|
|
66744
66789
|
case "continue-outer": continue outer;
|
|
66745
66790
|
}
|
|
@@ -66753,7 +66798,7 @@ var ts;
|
|
|
66753
66798
|
};
|
|
66754
66799
|
for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
|
|
66755
66800
|
var combination = discriminantCombinations_1[_a];
|
|
66756
|
-
var state_7 =
|
|
66801
|
+
var state_7 = _loop_21(combination);
|
|
66757
66802
|
if (typeof state_7 === "object")
|
|
66758
66803
|
return state_7.value;
|
|
66759
66804
|
}
|
|
@@ -67201,7 +67246,7 @@ var ts;
|
|
|
67201
67246
|
* See signatureAssignableTo, compareSignaturesIdentical
|
|
67202
67247
|
*/
|
|
67203
67248
|
function signatureRelatedTo(source, target, erase, reportErrors, incompatibleReporter) {
|
|
67204
|
-
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);
|
|
67205
67250
|
}
|
|
67206
67251
|
function signaturesIdenticalTo(source, target, kind) {
|
|
67207
67252
|
var sourceSignatures = getSignaturesOfType(source, kind);
|
|
@@ -67460,7 +67505,7 @@ var ts;
|
|
|
67460
67505
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
|
|
67461
67506
|
links.variances = ts.emptyArray;
|
|
67462
67507
|
var variances = [];
|
|
67463
|
-
var
|
|
67508
|
+
var _loop_23 = function (tp) {
|
|
67464
67509
|
var modifiers = getVarianceModifiers(tp);
|
|
67465
67510
|
var variance = modifiers & 65536 /* Out */ ?
|
|
67466
67511
|
modifiers & 32768 /* In */ ? 0 /* Invariant */ : 1 /* Covariant */ :
|
|
@@ -67496,9 +67541,9 @@ var ts;
|
|
|
67496
67541
|
}
|
|
67497
67542
|
variances.push(variance);
|
|
67498
67543
|
};
|
|
67499
|
-
for (var _i = 0,
|
|
67500
|
-
var tp =
|
|
67501
|
-
|
|
67544
|
+
for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
|
|
67545
|
+
var tp = typeParameters_2[_i];
|
|
67546
|
+
_loop_23(tp);
|
|
67502
67547
|
}
|
|
67503
67548
|
links.variances = variances;
|
|
67504
67549
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
|
|
@@ -68493,27 +68538,29 @@ var ts;
|
|
|
68493
68538
|
signature: signature,
|
|
68494
68539
|
flags: flags,
|
|
68495
68540
|
compareTypes: compareTypes,
|
|
68496
|
-
mapper:
|
|
68497
|
-
nonFixingMapper:
|
|
68541
|
+
mapper: reportUnmeasurableMapper,
|
|
68542
|
+
nonFixingMapper: reportUnmeasurableMapper,
|
|
68498
68543
|
};
|
|
68544
|
+
context.mapper = makeFixingMapperForContext(context);
|
|
68545
|
+
context.nonFixingMapper = makeNonFixingMapperForContext(context);
|
|
68499
68546
|
return context;
|
|
68500
68547
|
}
|
|
68501
|
-
function
|
|
68502
|
-
|
|
68503
|
-
|
|
68504
|
-
|
|
68505
|
-
|
|
68506
|
-
|
|
68507
|
-
|
|
68508
|
-
|
|
68509
|
-
inferFromIntraExpressionSites(context);
|
|
68510
|
-
clearCachedInferences(inferences);
|
|
68511
|
-
inference.isFixed = true;
|
|
68512
|
-
}
|
|
68513
|
-
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;
|
|
68514
68556
|
}
|
|
68515
|
-
|
|
68516
|
-
|
|
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
|
+
}; }));
|
|
68517
68564
|
}
|
|
68518
68565
|
function clearCachedInferences(inferences) {
|
|
68519
68566
|
for (var _i = 0, inferences_1 = inferences; _i < inferences_1.length; _i++) {
|
|
@@ -69433,7 +69480,7 @@ var ts;
|
|
|
69433
69480
|
// upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
|
|
69434
69481
|
// succeed. That would be a pointless and confusing outcome.
|
|
69435
69482
|
if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
|
|
69436
|
-
var
|
|
69483
|
+
var _loop_24 = function (i) {
|
|
69437
69484
|
var source_1 = matches ? matches[i] : neverType;
|
|
69438
69485
|
var target_3 = types[i];
|
|
69439
69486
|
// If we are inferring from a string literal type to a type variable whose constraint includes one of the
|
|
@@ -69483,7 +69530,7 @@ var ts;
|
|
|
69483
69530
|
inferFromTypes(source_1, target_3);
|
|
69484
69531
|
};
|
|
69485
69532
|
for (var i = 0; i < types.length; i++) {
|
|
69486
|
-
|
|
69533
|
+
_loop_24(i);
|
|
69487
69534
|
}
|
|
69488
69535
|
}
|
|
69489
69536
|
}
|
|
@@ -70001,7 +70048,7 @@ var ts;
|
|
|
70001
70048
|
function mapTypesByKeyProperty(types, name) {
|
|
70002
70049
|
var map = new ts.Map();
|
|
70003
70050
|
var count = 0;
|
|
70004
|
-
var
|
|
70051
|
+
var _loop_25 = function (type) {
|
|
70005
70052
|
if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
70006
70053
|
var discriminant = getTypeOfPropertyOfType(type, name);
|
|
70007
70054
|
if (discriminant) {
|
|
@@ -70027,7 +70074,7 @@ var ts;
|
|
|
70027
70074
|
};
|
|
70028
70075
|
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
|
|
70029
70076
|
var type = types_15[_i];
|
|
70030
|
-
var state_9 =
|
|
70077
|
+
var state_9 = _loop_25(type);
|
|
70031
70078
|
if (typeof state_9 === "object")
|
|
70032
70079
|
return state_9.value;
|
|
70033
70080
|
}
|
|
@@ -76376,7 +76423,7 @@ var ts;
|
|
|
76376
76423
|
if (spreadIndex >= 0) {
|
|
76377
76424
|
// Create synthetic arguments from spreads of tuple types.
|
|
76378
76425
|
var effectiveArgs_1 = args.slice(0, spreadIndex);
|
|
76379
|
-
var
|
|
76426
|
+
var _loop_26 = function (i) {
|
|
76380
76427
|
var arg = args[i];
|
|
76381
76428
|
// We can call checkExpressionCached because spread expressions never have a contextual type.
|
|
76382
76429
|
var spreadType = arg.kind === 225 /* SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
|
|
@@ -76393,7 +76440,7 @@ var ts;
|
|
|
76393
76440
|
}
|
|
76394
76441
|
};
|
|
76395
76442
|
for (var i = spreadIndex; i < args.length; i++) {
|
|
76396
|
-
|
|
76443
|
+
_loop_26(i);
|
|
76397
76444
|
}
|
|
76398
76445
|
return effectiveArgs_1;
|
|
76399
76446
|
}
|
|
@@ -76722,7 +76769,7 @@ var ts;
|
|
|
76722
76769
|
var min_3 = Number.MAX_VALUE;
|
|
76723
76770
|
var minIndex = 0;
|
|
76724
76771
|
var i_1 = 0;
|
|
76725
|
-
var
|
|
76772
|
+
var _loop_27 = function (c) {
|
|
76726
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)); };
|
|
76727
76774
|
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2);
|
|
76728
76775
|
if (diags_2) {
|
|
@@ -76740,7 +76787,7 @@ var ts;
|
|
|
76740
76787
|
};
|
|
76741
76788
|
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
|
|
76742
76789
|
var c = candidatesForArgumentError_1[_a];
|
|
76743
|
-
|
|
76790
|
+
_loop_27(c);
|
|
76744
76791
|
}
|
|
76745
76792
|
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
|
|
76746
76793
|
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
|
|
@@ -76898,7 +76945,7 @@ var ts;
|
|
|
76898
76945
|
}
|
|
76899
76946
|
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
|
|
76900
76947
|
var parameters = [];
|
|
76901
|
-
var
|
|
76948
|
+
var _loop_28 = function (i) {
|
|
76902
76949
|
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
|
|
76903
76950
|
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
|
|
76904
76951
|
i < s.parameters.length ? s.parameters[i] : undefined; });
|
|
@@ -76906,7 +76953,7 @@ var ts;
|
|
|
76906
76953
|
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
|
|
76907
76954
|
};
|
|
76908
76955
|
for (var i = 0; i < maxNonRestParam; i++) {
|
|
76909
|
-
|
|
76956
|
+
_loop_28(i);
|
|
76910
76957
|
}
|
|
76911
76958
|
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
|
|
76912
76959
|
var flags = 0 /* None */;
|
|
@@ -80259,8 +80306,8 @@ var ts;
|
|
|
80259
80306
|
var result = [];
|
|
80260
80307
|
var oldTypeParameters;
|
|
80261
80308
|
var newTypeParameters;
|
|
80262
|
-
for (var _i = 0,
|
|
80263
|
-
var tp =
|
|
80309
|
+
for (var _i = 0, typeParameters_3 = typeParameters; _i < typeParameters_3.length; _i++) {
|
|
80310
|
+
var tp = typeParameters_3[_i];
|
|
80264
80311
|
var name = tp.symbol.escapedName;
|
|
80265
80312
|
if (hasTypeParameterByName(context.inferredTypeParameters, name) || hasTypeParameterByName(result, name)) {
|
|
80266
80313
|
var newName = getUniqueTypeParameterName(ts.concatenate(context.inferredTypeParameters, result), name);
|
|
@@ -80939,7 +80986,7 @@ var ts;
|
|
|
80939
80986
|
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
|
|
80940
80987
|
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
|
|
80941
80988
|
var indexSignatureMap_1 = new ts.Map();
|
|
80942
|
-
var
|
|
80989
|
+
var _loop_29 = function (declaration) {
|
|
80943
80990
|
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
|
|
80944
80991
|
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
|
|
80945
80992
|
var entry = indexSignatureMap_1.get(getTypeId(type));
|
|
@@ -80954,7 +81001,7 @@ var ts;
|
|
|
80954
81001
|
};
|
|
80955
81002
|
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
|
|
80956
81003
|
var declaration = _a[_i];
|
|
80957
|
-
|
|
81004
|
+
_loop_29(declaration);
|
|
80958
81005
|
}
|
|
80959
81006
|
indexSignatureMap_1.forEach(function (entry) {
|
|
80960
81007
|
if (entry.declarations.length > 1) {
|
|
@@ -81177,6 +81224,12 @@ var ts;
|
|
|
81177
81224
|
function checkMissingDeclaration(node) {
|
|
81178
81225
|
checkDecorators(node);
|
|
81179
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
|
+
}
|
|
81180
81233
|
function getEffectiveTypeArguments(node, typeParameters) {
|
|
81181
81234
|
return fillMissingTypeArguments(ts.map(node.typeArguments, getTypeFromTypeNode), typeParameters, getMinTypeArgumentCount(typeParameters), ts.isInJSFile(node));
|
|
81182
81235
|
}
|
|
@@ -81918,6 +81971,32 @@ var ts;
|
|
|
81918
81971
|
isAwaitedTypeInstantiation(type) ? type.aliasTypeArguments[0] :
|
|
81919
81972
|
type;
|
|
81920
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
|
+
}
|
|
81921
82000
|
function createAwaitedTypeIfNeeded(type) {
|
|
81922
82001
|
// We wrap type `T` in `Awaited<T>` based on the following conditions:
|
|
81923
82002
|
// - `T` is not already an `Awaited<U>`, and
|
|
@@ -81926,26 +82005,10 @@ var ts;
|
|
|
81926
82005
|
// - `T` has no base constraint, or
|
|
81927
82006
|
// - The base constraint of `T` is `any`, `unknown`, `object`, or `{}`, or
|
|
81928
82007
|
// - The base constraint of `T` is an object type with a callable `then` method.
|
|
81929
|
-
if (
|
|
81930
|
-
|
|
81931
|
-
|
|
81932
|
-
|
|
81933
|
-
if (isAwaitedTypeInstantiation(type)) {
|
|
81934
|
-
return type;
|
|
81935
|
-
}
|
|
81936
|
-
// Only instantiate `Awaited<T>` if `T` contains possibly non-primitive types.
|
|
81937
|
-
if (isGenericObjectType(type)) {
|
|
81938
|
-
var baseConstraint = getBaseConstraintOfType(type);
|
|
81939
|
-
// Only instantiate `Awaited<T>` if `T` has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
|
|
81940
|
-
// or is promise-like.
|
|
81941
|
-
if (!baseConstraint || (baseConstraint.flags & 3 /* AnyOrUnknown */) || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint)) {
|
|
81942
|
-
// Nothing to do if `Awaited<T>` doesn't exist
|
|
81943
|
-
var awaitedSymbol = getGlobalAwaitedSymbol(/*reportErrors*/ true);
|
|
81944
|
-
if (awaitedSymbol) {
|
|
81945
|
-
// Unwrap unions that may contain `Awaited<T>`, otherwise its possible to manufacture an `Awaited<Awaited<T> | U>` where
|
|
81946
|
-
// an `Awaited<T | U>` would suffice.
|
|
81947
|
-
return getTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
|
|
81948
|
-
}
|
|
82008
|
+
if (isAwaitedTypeNeeded(type)) {
|
|
82009
|
+
var awaitedType = tryCreateAwaitedType(type);
|
|
82010
|
+
if (awaitedType) {
|
|
82011
|
+
return awaitedType;
|
|
81949
82012
|
}
|
|
81950
82013
|
}
|
|
81951
82014
|
ts.Debug.assert(getPromisedTypeOfPromise(type) === undefined, "type provided should not be a non-generic 'promise'-like.");
|
|
@@ -81997,6 +82060,10 @@ var ts;
|
|
|
81997
82060
|
awaitedTypeStack.pop();
|
|
81998
82061
|
return typeAsAwaitable.awaitedTypeOfType = mapped;
|
|
81999
82062
|
}
|
|
82063
|
+
// If `type` is generic and should be wrapped in `Awaited<T>`, return it.
|
|
82064
|
+
if (isAwaitedTypeNeeded(type)) {
|
|
82065
|
+
return typeAsAwaitable.awaitedTypeOfType = type;
|
|
82066
|
+
}
|
|
82000
82067
|
var thisTypeForErrorOut = { value: undefined };
|
|
82001
82068
|
var promisedType = getPromisedTypeOfPromise(type, /*errorNode*/ undefined, thisTypeForErrorOut);
|
|
82002
82069
|
if (promisedType) {
|
|
@@ -82644,8 +82711,8 @@ var ts;
|
|
|
82644
82711
|
return;
|
|
82645
82712
|
var typeParameters = ts.getEffectiveTypeParameterDeclarations(node);
|
|
82646
82713
|
var seenParentsWithEveryUnused = new ts.Set();
|
|
82647
|
-
for (var _i = 0,
|
|
82648
|
-
var typeParameter =
|
|
82714
|
+
for (var _i = 0, typeParameters_4 = typeParameters; _i < typeParameters_4.length; _i++) {
|
|
82715
|
+
var typeParameter = typeParameters_4[_i];
|
|
82649
82716
|
if (!isTypeParameterUnused(typeParameter))
|
|
82650
82717
|
continue;
|
|
82651
82718
|
var name = ts.idText(typeParameter.name);
|
|
@@ -84464,7 +84531,7 @@ var ts;
|
|
|
84464
84531
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84465
84532
|
var localPropDeclaration = declaration && declaration.kind === 221 /* BinaryExpression */ ||
|
|
84466
84533
|
name && name.kind === 162 /* ComputedPropertyName */ || getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
84467
|
-
var
|
|
84534
|
+
var _loop_30 = function (info) {
|
|
84468
84535
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
84469
84536
|
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
|
|
84470
84537
|
// in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
|
|
@@ -84477,7 +84544,7 @@ var ts;
|
|
|
84477
84544
|
};
|
|
84478
84545
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
84479
84546
|
var info = indexInfos_9[_i];
|
|
84480
|
-
|
|
84547
|
+
_loop_30(info);
|
|
84481
84548
|
}
|
|
84482
84549
|
}
|
|
84483
84550
|
function checkIndexConstraintForIndexSignature(type, checkInfo) {
|
|
@@ -84485,7 +84552,7 @@ var ts;
|
|
|
84485
84552
|
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
|
|
84486
84553
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84487
84554
|
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
|
|
84488
|
-
var
|
|
84555
|
+
var _loop_31 = function (info) {
|
|
84489
84556
|
if (info === checkInfo)
|
|
84490
84557
|
return "continue";
|
|
84491
84558
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
@@ -84500,7 +84567,7 @@ var ts;
|
|
|
84500
84567
|
};
|
|
84501
84568
|
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
84502
84569
|
var info = indexInfos_10[_i];
|
|
84503
|
-
|
|
84570
|
+
_loop_31(info);
|
|
84504
84571
|
}
|
|
84505
84572
|
}
|
|
84506
84573
|
function checkTypeNameIsReserved(name, message) {
|
|
@@ -84820,7 +84887,7 @@ var ts;
|
|
|
84820
84887
|
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
84821
84888
|
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
84822
84889
|
var baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
84823
|
-
var
|
|
84890
|
+
var _loop_32 = function (member) {
|
|
84824
84891
|
if (ts.hasAmbientModifier(member)) {
|
|
84825
84892
|
return "continue";
|
|
84826
84893
|
}
|
|
@@ -84837,7 +84904,7 @@ var ts;
|
|
|
84837
84904
|
};
|
|
84838
84905
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
84839
84906
|
var member = _a[_i];
|
|
84840
|
-
|
|
84907
|
+
_loop_32(member);
|
|
84841
84908
|
}
|
|
84842
84909
|
}
|
|
84843
84910
|
/**
|
|
@@ -84925,7 +84992,7 @@ var ts;
|
|
|
84925
84992
|
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
|
|
84926
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
|
|
84927
84994
|
var issuedMemberError = false;
|
|
84928
|
-
var
|
|
84995
|
+
var _loop_33 = function (member) {
|
|
84929
84996
|
if (ts.isStatic(member)) {
|
|
84930
84997
|
return "continue";
|
|
84931
84998
|
}
|
|
@@ -84944,7 +85011,7 @@ var ts;
|
|
|
84944
85011
|
};
|
|
84945
85012
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
84946
85013
|
var member = _a[_i];
|
|
84947
|
-
|
|
85014
|
+
_loop_33(member);
|
|
84948
85015
|
}
|
|
84949
85016
|
if (!issuedMemberError) {
|
|
84950
85017
|
// check again with diagnostics to generate a less-specific error
|
|
@@ -85015,7 +85082,7 @@ var ts;
|
|
|
85015
85082
|
var _a, _b, _c, _d;
|
|
85016
85083
|
// NOTE: assignability is checked in checkClassDeclaration
|
|
85017
85084
|
var baseProperties = getPropertiesOfType(baseType);
|
|
85018
|
-
var
|
|
85085
|
+
var _loop_34 = function (baseProperty) {
|
|
85019
85086
|
var base = getTargetSymbol(baseProperty);
|
|
85020
85087
|
if (base.flags & 4194304 /* Prototype */) {
|
|
85021
85088
|
return "continue";
|
|
@@ -85125,7 +85192,7 @@ var ts;
|
|
|
85125
85192
|
};
|
|
85126
85193
|
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
|
|
85127
85194
|
var baseProperty = baseProperties_1[_i];
|
|
85128
|
-
var state_10 =
|
|
85195
|
+
var state_10 = _loop_34(baseProperty);
|
|
85129
85196
|
switch (state_10) {
|
|
85130
85197
|
case "continue-basePropertyCheck": continue basePropertyCheck;
|
|
85131
85198
|
}
|
|
@@ -111640,7 +111707,6 @@ var ts;
|
|
|
111640
111707
|
if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
|
|
111641
111708
|
// Update the output signature
|
|
111642
111709
|
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, createHash, changedDtsData);
|
|
111643
|
-
newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
|
|
111644
111710
|
}
|
|
111645
111711
|
// Update sourceFileInfo
|
|
111646
111712
|
var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
|
|
@@ -121027,7 +121093,7 @@ var ts;
|
|
|
121027
121093
|
state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
|
|
121028
121094
|
}
|
|
121029
121095
|
state.changedFilesSet = new ts.Set();
|
|
121030
|
-
state.
|
|
121096
|
+
state.latestChangedDtsFile = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.latestChangedDtsFile : undefined;
|
|
121031
121097
|
var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
|
|
121032
121098
|
var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
|
|
121033
121099
|
var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
|
|
@@ -121151,7 +121217,7 @@ var ts;
|
|
|
121151
121217
|
programEmitComplete: state.programEmitComplete,
|
|
121152
121218
|
emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
|
|
121153
121219
|
outSignature: state.outSignature,
|
|
121154
|
-
|
|
121220
|
+
latestChangedDtsFile: state.latestChangedDtsFile,
|
|
121155
121221
|
hasChangedEmitSignature: state.hasChangedEmitSignature,
|
|
121156
121222
|
changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
|
|
121157
121223
|
};
|
|
@@ -121164,7 +121230,7 @@ var ts;
|
|
|
121164
121230
|
state.programEmitComplete = savedEmitState.programEmitComplete;
|
|
121165
121231
|
state.emitSignatures = savedEmitState.emitSignatures;
|
|
121166
121232
|
state.outSignature = savedEmitState.outSignature;
|
|
121167
|
-
state.
|
|
121233
|
+
state.latestChangedDtsFile = savedEmitState.latestChangedDtsFile;
|
|
121168
121234
|
state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
|
|
121169
121235
|
if (savedEmitState.changedFilesSet)
|
|
121170
121236
|
state.changedFilesSet = savedEmitState.changedFilesSet;
|
|
@@ -121478,14 +121544,14 @@ var ts;
|
|
|
121478
121544
|
/**
|
|
121479
121545
|
* Gets the program information to be emitted in buildInfo so that we can use it to create new program
|
|
121480
121546
|
*/
|
|
121481
|
-
function getProgramBuildInfo(state, getCanonicalFileName
|
|
121547
|
+
function getProgramBuildInfo(state, getCanonicalFileName) {
|
|
121482
121548
|
var outFilePath = ts.outFile(state.compilerOptions);
|
|
121483
121549
|
if (outFilePath && !state.compilerOptions.composite)
|
|
121484
121550
|
return;
|
|
121485
121551
|
var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
|
|
121486
121552
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
|
|
121487
|
-
//
|
|
121488
|
-
|
|
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;
|
|
121489
121555
|
if (outFilePath) {
|
|
121490
121556
|
var fileNames_1 = [];
|
|
121491
121557
|
var fileInfos_1 = [];
|
|
@@ -121501,7 +121567,7 @@ var ts;
|
|
|
121501
121567
|
fileInfos: fileInfos_1,
|
|
121502
121568
|
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
|
|
121503
121569
|
outSignature: state.outSignature,
|
|
121504
|
-
|
|
121570
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
121505
121571
|
};
|
|
121506
121572
|
return result_15;
|
|
121507
121573
|
}
|
|
@@ -121603,7 +121669,7 @@ var ts;
|
|
|
121603
121669
|
affectedFilesPendingEmit: affectedFilesPendingEmit,
|
|
121604
121670
|
changeFileSet: changeFileSet,
|
|
121605
121671
|
emitSignatures: emitSignatures,
|
|
121606
|
-
|
|
121672
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
121607
121673
|
};
|
|
121608
121674
|
return result;
|
|
121609
121675
|
function relativeToBuildInfoEnsuringAbsolutePath(path) {
|
|
@@ -121771,7 +121837,7 @@ var ts;
|
|
|
121771
121837
|
*/
|
|
121772
121838
|
var computeHash = ts.maybeBind(host, host.createHash);
|
|
121773
121839
|
var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
|
|
121774
|
-
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName
|
|
121840
|
+
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
|
|
121775
121841
|
// To ensure that we arent storing any references to old program or new program without state
|
|
121776
121842
|
newProgram = undefined; // TODO: GH#18217
|
|
121777
121843
|
oldProgram = undefined;
|
|
@@ -121781,6 +121847,7 @@ var ts;
|
|
|
121781
121847
|
builderProgram.getState = getState;
|
|
121782
121848
|
builderProgram.saveEmitState = function () { return backupBuilderProgramEmitState(state); };
|
|
121783
121849
|
builderProgram.restoreEmitState = function (saved) { return restoreBuilderProgramEmitState(state, saved); };
|
|
121850
|
+
builderProgram.hasChangedEmitSignature = function () { return !!state.hasChangedEmitSignature; };
|
|
121784
121851
|
builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
|
|
121785
121852
|
builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
|
|
121786
121853
|
builderProgram.emit = emit;
|
|
@@ -121888,18 +121955,22 @@ var ts;
|
|
|
121888
121955
|
var filePath = sourceFiles[0].resolvedPath;
|
|
121889
121956
|
var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath);
|
|
121890
121957
|
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text, computeHash, data));
|
|
121891
|
-
if
|
|
121892
|
-
|
|
121893
|
-
|
|
121894
|
-
|
|
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;
|
|
121895
121964
|
}
|
|
121896
121965
|
}
|
|
121897
121966
|
else if (state.compilerOptions.composite) {
|
|
121898
121967
|
var newSignature = computeSignature(text, computeHash, data);
|
|
121899
|
-
if
|
|
121900
|
-
|
|
121901
|
-
|
|
121902
|
-
|
|
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;
|
|
121903
121974
|
}
|
|
121904
121975
|
}
|
|
121905
121976
|
if (writeFile)
|
|
@@ -122062,11 +122133,12 @@ var ts;
|
|
|
122062
122133
|
var state;
|
|
122063
122134
|
var filePaths;
|
|
122064
122135
|
var filePathsSetList;
|
|
122136
|
+
var latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : undefined;
|
|
122065
122137
|
if (isProgramBundleEmitBuildInfo(program)) {
|
|
122066
122138
|
state = {
|
|
122067
122139
|
fileInfos: new ts.Map(),
|
|
122068
122140
|
compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
|
|
122069
|
-
|
|
122141
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
122070
122142
|
outSignature: program.outSignature,
|
|
122071
122143
|
};
|
|
122072
122144
|
}
|
|
@@ -122099,7 +122171,7 @@ var ts;
|
|
|
122099
122171
|
affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
|
|
122100
122172
|
affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
|
|
122101
122173
|
changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
|
|
122102
|
-
|
|
122174
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
122103
122175
|
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
|
122104
122176
|
};
|
|
122105
122177
|
}
|
|
@@ -122126,6 +122198,7 @@ var ts;
|
|
|
122126
122198
|
getSemanticDiagnosticsOfNextAffectedFile: ts.notImplemented,
|
|
122127
122199
|
emitBuildInfo: ts.notImplemented,
|
|
122128
122200
|
close: ts.noop,
|
|
122201
|
+
hasChangedEmitSignature: ts.returnFalse,
|
|
122129
122202
|
};
|
|
122130
122203
|
function toPath(path) {
|
|
122131
122204
|
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
@@ -123440,7 +123513,7 @@ var ts;
|
|
|
123440
123513
|
});
|
|
123441
123514
|
// Sort by paths closest to importing file Name directory
|
|
123442
123515
|
var sortedPaths = [];
|
|
123443
|
-
var
|
|
123516
|
+
var _loop_35 = function (directory) {
|
|
123444
123517
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
123445
123518
|
var pathsInDirectory;
|
|
123446
123519
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -123464,7 +123537,7 @@ var ts;
|
|
|
123464
123537
|
};
|
|
123465
123538
|
var out_directory_1;
|
|
123466
123539
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
123467
|
-
var state_11 =
|
|
123540
|
+
var state_11 = _loop_35(directory);
|
|
123468
123541
|
directory = out_directory_1;
|
|
123469
123542
|
if (state_11 === "break")
|
|
123470
123543
|
break;
|
|
@@ -124308,7 +124381,6 @@ var ts;
|
|
|
124308
124381
|
readDirectory: ts.maybeBind(host, host.readDirectory),
|
|
124309
124382
|
disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
|
|
124310
124383
|
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
|
|
124311
|
-
now: ts.maybeBind(host, host.now),
|
|
124312
124384
|
};
|
|
124313
124385
|
function writeFile(fileName, text, writeByteOrderMark, onError) {
|
|
124314
124386
|
try {
|
|
@@ -124466,7 +124538,6 @@ var ts;
|
|
|
124466
124538
|
host.createHash = ts.maybeBind(system, system.createHash);
|
|
124467
124539
|
host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
|
|
124468
124540
|
host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
|
|
124469
|
-
host.now = ts.maybeBind(system, system.now);
|
|
124470
124541
|
ts.setGetSourceFileAsHashVersioned(host, system);
|
|
124471
124542
|
ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
|
|
124472
124543
|
return host;
|
|
@@ -125794,8 +125865,7 @@ var ts;
|
|
|
125794
125865
|
}
|
|
125795
125866
|
// Actual Emit
|
|
125796
125867
|
var host = state.host, compilerHost = state.compilerHost;
|
|
125797
|
-
var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
|
|
125798
|
-
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;
|
|
125799
125869
|
var emitterDiagnostics = ts.createDiagnosticCollection();
|
|
125800
125870
|
var emittedOutputs = new ts.Map();
|
|
125801
125871
|
var options = program.getCompilerOptions();
|
|
@@ -125803,17 +125873,11 @@ var ts;
|
|
|
125803
125873
|
var outputTimeStampMap;
|
|
125804
125874
|
var now;
|
|
125805
125875
|
outputFiles.forEach(function (_a) {
|
|
125806
|
-
var _b, _c;
|
|
125807
125876
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
125808
125877
|
var path = toPath(state, name);
|
|
125809
125878
|
emittedOutputs.set(toPath(state, name), name);
|
|
125810
|
-
if (buildInfo)
|
|
125811
|
-
setBuildInfo(state, buildInfo, projectPath, options);
|
|
125812
|
-
// Buildinfo has information on when last dts change time
|
|
125813
|
-
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)) {
|
|
125814
|
-
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
|
125815
|
-
}
|
|
125816
|
-
}
|
|
125879
|
+
if (buildInfo)
|
|
125880
|
+
setBuildInfo(state, buildInfo, projectPath, options, resultFlags);
|
|
125817
125881
|
ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
|
|
125818
125882
|
if (!isIncremental && state.watch) {
|
|
125819
125883
|
(outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
|
|
@@ -125827,7 +125891,7 @@ var ts;
|
|
|
125827
125891
|
ts.Debug.assert(step === BuildStep.EmitBuildInfo);
|
|
125828
125892
|
var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
|
|
125829
125893
|
if (data === null || data === void 0 ? void 0 : data.buildInfo)
|
|
125830
|
-
setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
|
|
125894
|
+
setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions(), BuildResultFlags.DeclarationOutputUnchanged);
|
|
125831
125895
|
if (writeFileCallback)
|
|
125832
125896
|
writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
125833
125897
|
else
|
|
@@ -125860,7 +125924,6 @@ var ts;
|
|
|
125860
125924
|
state.diagnostics.delete(projectPath);
|
|
125861
125925
|
state.projectStatus.set(projectPath, {
|
|
125862
125926
|
type: ts.UpToDateStatusType.UpToDate,
|
|
125863
|
-
newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
|
|
125864
125927
|
oldestOutputFileName: oldestOutputFileName
|
|
125865
125928
|
});
|
|
125866
125929
|
afterProgramDone(state, program, config);
|
|
@@ -125902,10 +125965,10 @@ var ts;
|
|
|
125902
125965
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
125903
125966
|
emittedOutputs.set(toPath(state, name), name);
|
|
125904
125967
|
if (buildInfo) {
|
|
125905
|
-
|
|
125906
|
-
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)) {
|
|
125907
125969
|
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
|
125908
125970
|
}
|
|
125971
|
+
setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags);
|
|
125909
125972
|
}
|
|
125910
125973
|
ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
|
|
125911
125974
|
});
|
|
@@ -126164,15 +126227,23 @@ var ts;
|
|
|
126164
126227
|
state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
|
|
126165
126228
|
return result;
|
|
126166
126229
|
}
|
|
126167
|
-
function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
|
|
126230
|
+
function setBuildInfo(state, buildInfo, resolvedConfigPath, options, resultFlags) {
|
|
126168
126231
|
var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
|
|
126169
126232
|
var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
|
|
126233
|
+
var modifiedTime = getCurrentTime(state.host);
|
|
126170
126234
|
if (existing) {
|
|
126171
126235
|
existing.buildInfo = buildInfo;
|
|
126172
|
-
existing.modifiedTime =
|
|
126236
|
+
existing.modifiedTime = modifiedTime;
|
|
126237
|
+
if (!(resultFlags & BuildResultFlags.DeclarationOutputUnchanged))
|
|
126238
|
+
existing.latestChangedDtsTime = modifiedTime;
|
|
126173
126239
|
}
|
|
126174
126240
|
else {
|
|
126175
|
-
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
|
+
});
|
|
126176
126247
|
}
|
|
126177
126248
|
}
|
|
126178
126249
|
function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
|
|
@@ -126204,7 +126275,7 @@ var ts;
|
|
|
126204
126275
|
}
|
|
126205
126276
|
}
|
|
126206
126277
|
function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
126207
|
-
var _a, _b
|
|
126278
|
+
var _a, _b;
|
|
126208
126279
|
// Container if no files are specified in the project
|
|
126209
126280
|
if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
|
|
126210
126281
|
return {
|
|
@@ -126216,8 +126287,8 @@ var ts;
|
|
|
126216
126287
|
var force = !!state.options.force;
|
|
126217
126288
|
if (project.projectReferences) {
|
|
126218
126289
|
state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
|
|
126219
|
-
for (var _i = 0,
|
|
126220
|
-
var ref =
|
|
126290
|
+
for (var _i = 0, _c = project.projectReferences; _i < _c.length; _i++) {
|
|
126291
|
+
var ref = _c[_i];
|
|
126221
126292
|
var resolvedRef = ts.resolveProjectReferencePath(ref);
|
|
126222
126293
|
var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
|
|
126223
126294
|
var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
|
|
@@ -126257,7 +126328,6 @@ var ts;
|
|
|
126257
126328
|
var buildInfoTime;
|
|
126258
126329
|
var buildInfoProgram;
|
|
126259
126330
|
var buildInfoVersionMap;
|
|
126260
|
-
var newestDeclarationFileContentChangedTime;
|
|
126261
126331
|
if (buildInfoPath) {
|
|
126262
126332
|
var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
|
|
126263
126333
|
buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
|
|
@@ -126294,8 +126364,6 @@ var ts;
|
|
|
126294
126364
|
}
|
|
126295
126365
|
oldestOutputFileTime = buildInfoTime;
|
|
126296
126366
|
oldestOutputFileName = buildInfoPath;
|
|
126297
|
-
// Get the last dtsChange time from build info
|
|
126298
|
-
newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
|
|
126299
126367
|
}
|
|
126300
126368
|
// Check input files
|
|
126301
126369
|
var newestInputFileName = undefined;
|
|
@@ -126303,8 +126371,8 @@ var ts;
|
|
|
126303
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 */
|
|
126304
126372
|
var pseudoInputUpToDate = false;
|
|
126305
126373
|
// Get timestamps of input files
|
|
126306
|
-
for (var
|
|
126307
|
-
var inputFile =
|
|
126374
|
+
for (var _d = 0, _e = project.fileNames; _d < _e.length; _d++) {
|
|
126375
|
+
var inputFile = _e[_d];
|
|
126308
126376
|
var inputTime = getModifiedTime(state, inputFile);
|
|
126309
126377
|
if (inputTime === ts.missingFileModifiedTime) {
|
|
126310
126378
|
return {
|
|
@@ -126345,8 +126413,8 @@ var ts;
|
|
|
126345
126413
|
// Collect the expected outputs of this project
|
|
126346
126414
|
var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
|
|
126347
126415
|
var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
|
|
126348
|
-
for (var
|
|
126349
|
-
var output = outputs_1[
|
|
126416
|
+
for (var _f = 0, outputs_1 = outputs; _f < outputs_1.length; _f++) {
|
|
126417
|
+
var output = outputs_1[_f];
|
|
126350
126418
|
var path = toPath(state, output);
|
|
126351
126419
|
// Output is missing; can stop checking
|
|
126352
126420
|
var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
|
|
@@ -126384,8 +126452,8 @@ var ts;
|
|
|
126384
126452
|
var usesPrepend = false;
|
|
126385
126453
|
var upstreamChangedProject;
|
|
126386
126454
|
if (referenceStatuses) {
|
|
126387
|
-
for (var
|
|
126388
|
-
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;
|
|
126389
126457
|
usesPrepend = usesPrepend || !!(ref.prepend);
|
|
126390
126458
|
// If the upstream project's newest file is older than our oldest output, we
|
|
126391
126459
|
// can't be out of date because of it
|
|
@@ -126402,7 +126470,8 @@ var ts;
|
|
|
126402
126470
|
}
|
|
126403
126471
|
// If the upstream project has only change .d.ts files, and we've built
|
|
126404
126472
|
// *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
|
|
126405
|
-
|
|
126473
|
+
var newestDeclarationFileContentChangedTime = getLatestChangedDtsTime(state, resolvedConfig.options, resolvedRefPath);
|
|
126474
|
+
if (newestDeclarationFileContentChangedTime && newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
|
|
126406
126475
|
pseudoUpToDate = true;
|
|
126407
126476
|
upstreamChangedProject = ref.path;
|
|
126408
126477
|
continue;
|
|
@@ -126445,7 +126514,6 @@ var ts;
|
|
|
126445
126514
|
pseudoInputUpToDate ?
|
|
126446
126515
|
ts.UpToDateStatusType.UpToDateWithInputFileText :
|
|
126447
126516
|
ts.UpToDateStatusType.UpToDate,
|
|
126448
|
-
newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
|
|
126449
126517
|
newestInputFileTime: newestInputFileTime,
|
|
126450
126518
|
newestInputFileName: newestInputFileName,
|
|
126451
126519
|
oldestOutputFileName: oldestOutputFileName
|
|
@@ -126529,13 +126597,17 @@ var ts;
|
|
|
126529
126597
|
outputTimeStampMap.delete(key);
|
|
126530
126598
|
});
|
|
126531
126599
|
}
|
|
126532
|
-
function
|
|
126533
|
-
var _a;
|
|
126600
|
+
function getLatestChangedDtsTime(state, options, resolvedConfigPath) {
|
|
126534
126601
|
if (!options.composite)
|
|
126535
126602
|
return undefined;
|
|
126536
|
-
var
|
|
126537
|
-
|
|
126538
|
-
|
|
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;
|
|
126539
126611
|
}
|
|
126540
126612
|
function updateOutputTimestamps(state, proj, resolvedPath) {
|
|
126541
126613
|
if (state.options.dry) {
|
|
@@ -126544,7 +126616,6 @@ var ts;
|
|
|
126544
126616
|
updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
|
|
126545
126617
|
state.projectStatus.set(resolvedPath, {
|
|
126546
126618
|
type: ts.UpToDateStatusType.UpToDate,
|
|
126547
|
-
newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
|
|
126548
126619
|
oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
|
|
126549
126620
|
});
|
|
126550
126621
|
}
|