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/tsserver.js
CHANGED
|
@@ -109,7 +109,7 @@ var ts;
|
|
|
109
109
|
// The following is baselined as a literal template type without intervention
|
|
110
110
|
/** The version of the TypeScript compiler release */
|
|
111
111
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
112
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
112
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220704";
|
|
113
113
|
/* @internal */
|
|
114
114
|
var Comparison;
|
|
115
115
|
(function (Comparison) {
|
|
@@ -5276,9 +5276,10 @@ var ts;
|
|
|
5276
5276
|
(function (TypeMapKind) {
|
|
5277
5277
|
TypeMapKind[TypeMapKind["Simple"] = 0] = "Simple";
|
|
5278
5278
|
TypeMapKind[TypeMapKind["Array"] = 1] = "Array";
|
|
5279
|
-
TypeMapKind[TypeMapKind["
|
|
5280
|
-
TypeMapKind[TypeMapKind["
|
|
5281
|
-
TypeMapKind[TypeMapKind["
|
|
5279
|
+
TypeMapKind[TypeMapKind["Deferred"] = 2] = "Deferred";
|
|
5280
|
+
TypeMapKind[TypeMapKind["Function"] = 3] = "Function";
|
|
5281
|
+
TypeMapKind[TypeMapKind["Composite"] = 4] = "Composite";
|
|
5282
|
+
TypeMapKind[TypeMapKind["Merged"] = 5] = "Merged";
|
|
5282
5283
|
})(TypeMapKind = ts.TypeMapKind || (ts.TypeMapKind = {}));
|
|
5283
5284
|
var InferencePriority;
|
|
5284
5285
|
(function (InferencePriority) {
|
|
@@ -48681,6 +48682,24 @@ var ts;
|
|
|
48681
48682
|
var Symbol = ts.objectAllocator.getSymbolConstructor();
|
|
48682
48683
|
var Type = ts.objectAllocator.getTypeConstructor();
|
|
48683
48684
|
var Signature = ts.objectAllocator.getSignatureConstructor();
|
|
48685
|
+
var DebugTypeMapper = /** @class */ (function () {
|
|
48686
|
+
function DebugTypeMapper() {
|
|
48687
|
+
}
|
|
48688
|
+
DebugTypeMapper.prototype.__debugToString = function () {
|
|
48689
|
+
var _a;
|
|
48690
|
+
ts.Debug.type(this);
|
|
48691
|
+
switch (this.kind) {
|
|
48692
|
+
case 3 /* Function */: return ((_a = this.debugInfo) === null || _a === void 0 ? void 0 : _a.call(this)) || "(function mapper)";
|
|
48693
|
+
case 0 /* Simple */: return this.source.__debugTypeToString() + " -> " + this.target.__debugTypeToString();
|
|
48694
|
+
case 1 /* Array */: return ts.zipWith(this.sources, this.targets || ts.map(this.sources, function () { return anyType; }), function (s, t) { return s.__debugTypeToString() + " -> " + t.__debugTypeToString(); }).join(", ");
|
|
48695
|
+
case 2 /* Deferred */: return ts.zipWith(this.sources, this.targets, function (s, t) { return s.__debugTypeToString() + " -> " + t().__debugTypeToString(); }).join(", ");
|
|
48696
|
+
case 5 /* Merged */:
|
|
48697
|
+
case 4 /* Composite */: return "m1: " + this.mapper1.__debugToString().split("\n").join("\n ") + "\nm2: " + this.mapper2.__debugToString().split("\n").join("\n ");
|
|
48698
|
+
default: return ts.Debug.assertNever(this);
|
|
48699
|
+
}
|
|
48700
|
+
};
|
|
48701
|
+
return DebugTypeMapper;
|
|
48702
|
+
}());
|
|
48684
48703
|
var typeCount = 0;
|
|
48685
48704
|
var symbolCount = 0;
|
|
48686
48705
|
var enumCount = 0;
|
|
@@ -49141,10 +49160,23 @@ var ts;
|
|
|
49141
49160
|
var numberOrBigIntType = getUnionType([numberType, bigintType]);
|
|
49142
49161
|
var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
|
|
49143
49162
|
var numericStringType = getTemplateLiteralType(["", ""], [numberType]); // The `${number}` type
|
|
49144
|
-
var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; });
|
|
49145
|
-
var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? wildcardType : t; });
|
|
49163
|
+
var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; }, function () { return "(restrictive mapper)"; });
|
|
49164
|
+
var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? wildcardType : t; }, function () { return "(permissive mapper)"; });
|
|
49146
49165
|
var uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never"); // `uniqueLiteralType` is a special `never` flagged by union reduction to behave as a literal
|
|
49147
|
-
var uniqueLiteralMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? uniqueLiteralType : t; }); // replace all type parameters with the unique literal type (disregarding constraints)
|
|
49166
|
+
var uniqueLiteralMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? uniqueLiteralType : t; }, function () { return "(unique literal mapper)"; }); // replace all type parameters with the unique literal type (disregarding constraints)
|
|
49167
|
+
var outofbandVarianceMarkerHandler;
|
|
49168
|
+
var reportUnreliableMapper = makeFunctionTypeMapper(function (t) {
|
|
49169
|
+
if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
|
|
49170
|
+
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ true);
|
|
49171
|
+
}
|
|
49172
|
+
return t;
|
|
49173
|
+
}, function () { return "(unmeasurable reporter)"; });
|
|
49174
|
+
var reportUnmeasurableMapper = makeFunctionTypeMapper(function (t) {
|
|
49175
|
+
if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
|
|
49176
|
+
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ false);
|
|
49177
|
+
}
|
|
49178
|
+
return t;
|
|
49179
|
+
}, function () { return "(unreliable reporter)"; });
|
|
49148
49180
|
var emptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49149
49181
|
var emptyJsxObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49150
49182
|
emptyJsxObjectType.objectFlags |= 2048 /* JsxAttributes */;
|
|
@@ -49304,7 +49336,6 @@ var ts;
|
|
|
49304
49336
|
var typeofType = createTypeofType();
|
|
49305
49337
|
var _jsxNamespace;
|
|
49306
49338
|
var _jsxFactoryEntity;
|
|
49307
|
-
var outofbandVarianceMarkerHandler;
|
|
49308
49339
|
var subtypeRelation = new ts.Map();
|
|
49309
49340
|
var strictSubtypeRelation = new ts.Map();
|
|
49310
49341
|
var assignableRelation = new ts.Map();
|
|
@@ -53071,7 +53102,7 @@ var ts;
|
|
|
53071
53102
|
var name = typeParameterToName(newParam, context);
|
|
53072
53103
|
var newTypeVariable = ts.factory.createTypeReferenceNode(name);
|
|
53073
53104
|
context.approximateLength += 37; // 15 each for two added conditionals, 7 for an added infer type
|
|
53074
|
-
var newMapper = prependTypeMapping(type.root.checkType, newParam, type.
|
|
53105
|
+
var newMapper = prependTypeMapping(type.root.checkType, newParam, type.mapper);
|
|
53075
53106
|
var saveInferTypeParameters_1 = context.inferTypeParameters;
|
|
53076
53107
|
context.inferTypeParameters = type.root.inferTypeParameters;
|
|
53077
53108
|
var extendsTypeNode_1 = typeToTypeNodeHelper(instantiateType(type.root.extendsType, newMapper), context);
|
|
@@ -60482,8 +60513,7 @@ var ts;
|
|
|
60482
60513
|
var _a;
|
|
60483
60514
|
var inferences;
|
|
60484
60515
|
if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
|
|
60485
|
-
|
|
60486
|
-
var declaration = _b[_i];
|
|
60516
|
+
var _loop_15 = function (declaration) {
|
|
60487
60517
|
if (declaration.parent.kind === 190 /* InferType */) {
|
|
60488
60518
|
// When an 'infer T' declaration is immediately contained in a type reference node
|
|
60489
60519
|
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
|
|
@@ -60491,12 +60521,12 @@ var ts;
|
|
|
60491
60521
|
// present, we form an intersection of the inferred constraint types.
|
|
60492
60522
|
var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1];
|
|
60493
60523
|
if (grandParent.kind === 178 /* TypeReference */ && !omitTypeReferences) {
|
|
60494
|
-
var
|
|
60495
|
-
var
|
|
60496
|
-
if (
|
|
60497
|
-
var index =
|
|
60498
|
-
if (index <
|
|
60499
|
-
var declaredConstraint = getConstraintOfTypeParameter(
|
|
60524
|
+
var typeReference_1 = grandParent;
|
|
60525
|
+
var typeParameters_1 = getTypeParametersForTypeReference(typeReference_1);
|
|
60526
|
+
if (typeParameters_1) {
|
|
60527
|
+
var index = typeReference_1.typeArguments.indexOf(childTypeParameter);
|
|
60528
|
+
if (index < typeParameters_1.length) {
|
|
60529
|
+
var declaredConstraint = getConstraintOfTypeParameter(typeParameters_1[index]);
|
|
60500
60530
|
if (declaredConstraint) {
|
|
60501
60531
|
// Type parameter constraints can reference other type parameters so
|
|
60502
60532
|
// constraints need to be instantiated. If instantiation produces the
|
|
@@ -60504,7 +60534,9 @@ var ts;
|
|
|
60504
60534
|
// type Foo<T extends string, U extends T> = [T, U];
|
|
60505
60535
|
// type Bar<T> = T extends Foo<infer X, infer X> ? Foo<X, X> : T;
|
|
60506
60536
|
// the instantiated constraint for U is X, so we discard that inference.
|
|
60507
|
-
var mapper =
|
|
60537
|
+
var mapper = makeDeferredTypeMapper(typeParameters_1, typeParameters_1.map(function (_, index) { return function () {
|
|
60538
|
+
return getEffectiveTypeArgumentAtIndex(typeReference_1, typeParameters_1, index);
|
|
60539
|
+
}; }));
|
|
60508
60540
|
var constraint = instantiateType(declaredConstraint, mapper);
|
|
60509
60541
|
if (constraint !== typeParameter) {
|
|
60510
60542
|
inferences = ts.append(inferences, constraint);
|
|
@@ -60542,6 +60574,10 @@ var ts;
|
|
|
60542
60574
|
inferences = ts.append(inferences, instantiateType(nodeType, makeUnaryTypeMapper(getDeclaredTypeOfTypeParameter(getSymbolOfNode(checkMappedType_1.typeParameter)), checkMappedType_1.typeParameter.constraint ? getTypeFromTypeNode(checkMappedType_1.typeParameter.constraint) : keyofConstraintType)));
|
|
60543
60575
|
}
|
|
60544
60576
|
}
|
|
60577
|
+
};
|
|
60578
|
+
for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
|
|
60579
|
+
var declaration = _b[_i];
|
|
60580
|
+
_loop_15(declaration);
|
|
60545
60581
|
}
|
|
60546
60582
|
}
|
|
60547
60583
|
return inferences && getIntersectionType(inferences);
|
|
@@ -61430,7 +61466,7 @@ var ts;
|
|
|
61430
61466
|
var lastRequiredIndex = -1;
|
|
61431
61467
|
var firstRestIndex = -1;
|
|
61432
61468
|
var lastOptionalOrRestIndex = -1;
|
|
61433
|
-
var
|
|
61469
|
+
var _loop_16 = function (i) {
|
|
61434
61470
|
var type = elementTypes[i];
|
|
61435
61471
|
var flags = target.elementFlags[i];
|
|
61436
61472
|
if (flags & 8 /* Variadic */) {
|
|
@@ -61460,7 +61496,7 @@ var ts;
|
|
|
61460
61496
|
}
|
|
61461
61497
|
};
|
|
61462
61498
|
for (var i = 0; i < elementTypes.length; i++) {
|
|
61463
|
-
var state_4 =
|
|
61499
|
+
var state_4 = _loop_16(i);
|
|
61464
61500
|
if (typeof state_4 === "object")
|
|
61465
61501
|
return state_4.value;
|
|
61466
61502
|
}
|
|
@@ -61656,7 +61692,7 @@ var ts;
|
|
|
61656
61692
|
var templates = ts.filter(types, isPatternLiteralType);
|
|
61657
61693
|
if (templates.length) {
|
|
61658
61694
|
var i = types.length;
|
|
61659
|
-
var
|
|
61695
|
+
var _loop_17 = function () {
|
|
61660
61696
|
i--;
|
|
61661
61697
|
var t = types[i];
|
|
61662
61698
|
if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
|
|
@@ -61664,7 +61700,7 @@ var ts;
|
|
|
61664
61700
|
}
|
|
61665
61701
|
};
|
|
61666
61702
|
while (i > 0) {
|
|
61667
|
-
|
|
61703
|
+
_loop_17();
|
|
61668
61704
|
}
|
|
61669
61705
|
}
|
|
61670
61706
|
}
|
|
@@ -61741,14 +61777,14 @@ var ts;
|
|
|
61741
61777
|
var namedUnions = [];
|
|
61742
61778
|
addNamedUnions(namedUnions, types);
|
|
61743
61779
|
var reducedTypes = [];
|
|
61744
|
-
var
|
|
61780
|
+
var _loop_18 = function (t) {
|
|
61745
61781
|
if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
|
|
61746
61782
|
reducedTypes.push(t);
|
|
61747
61783
|
}
|
|
61748
61784
|
};
|
|
61749
61785
|
for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
|
|
61750
61786
|
var t = typeSet_1[_i];
|
|
61751
|
-
|
|
61787
|
+
_loop_18(t);
|
|
61752
61788
|
}
|
|
61753
61789
|
if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
|
|
61754
61790
|
return namedUnions[0];
|
|
@@ -62972,7 +63008,7 @@ var ts;
|
|
|
62972
63008
|
var result;
|
|
62973
63009
|
var extraTypes;
|
|
62974
63010
|
var tailCount = 0;
|
|
62975
|
-
var
|
|
63011
|
+
var _loop_19 = function () {
|
|
62976
63012
|
if (tailCount === 1000) {
|
|
62977
63013
|
error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
62978
63014
|
result = errorType;
|
|
@@ -63093,7 +63129,7 @@ var ts;
|
|
|
63093
63129
|
// another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
|
|
63094
63130
|
// cases we increment the tail recursion counter and stop after 1000 iterations.
|
|
63095
63131
|
while (true) {
|
|
63096
|
-
var state_5 =
|
|
63132
|
+
var state_5 = _loop_19();
|
|
63097
63133
|
if (typeof state_5 === "object")
|
|
63098
63134
|
return state_5.value;
|
|
63099
63135
|
if (state_5 === "break")
|
|
@@ -63723,7 +63759,7 @@ var ts;
|
|
|
63723
63759
|
switch (mapper.kind) {
|
|
63724
63760
|
case 0 /* Simple */:
|
|
63725
63761
|
return type === mapper.source ? mapper.target : type;
|
|
63726
|
-
case 1 /* Array */:
|
|
63762
|
+
case 1 /* Array */: {
|
|
63727
63763
|
var sources = mapper.sources;
|
|
63728
63764
|
var targets = mapper.targets;
|
|
63729
63765
|
for (var i = 0; i < sources.length; i++) {
|
|
@@ -63732,25 +63768,45 @@ var ts;
|
|
|
63732
63768
|
}
|
|
63733
63769
|
}
|
|
63734
63770
|
return type;
|
|
63735
|
-
|
|
63771
|
+
}
|
|
63772
|
+
case 2 /* Deferred */: {
|
|
63773
|
+
var sources = mapper.sources;
|
|
63774
|
+
var targets = mapper.targets;
|
|
63775
|
+
for (var i = 0; i < sources.length; i++) {
|
|
63776
|
+
if (type === sources[i]) {
|
|
63777
|
+
return targets[i]();
|
|
63778
|
+
}
|
|
63779
|
+
}
|
|
63780
|
+
return type;
|
|
63781
|
+
}
|
|
63782
|
+
case 3 /* Function */:
|
|
63736
63783
|
return mapper.func(type);
|
|
63737
|
-
case
|
|
63738
|
-
case
|
|
63784
|
+
case 4 /* Composite */:
|
|
63785
|
+
case 5 /* Merged */:
|
|
63739
63786
|
var t1 = getMappedType(type, mapper.mapper1);
|
|
63740
|
-
return t1 !== type && mapper.kind ===
|
|
63787
|
+
return t1 !== type && mapper.kind === 4 /* Composite */ ? instantiateType(t1, mapper.mapper2) : getMappedType(t1, mapper.mapper2);
|
|
63741
63788
|
}
|
|
63742
63789
|
}
|
|
63790
|
+
function attachDebugPrototypeIfDebug(mapper) {
|
|
63791
|
+
if (ts.Debug.isDebugging) {
|
|
63792
|
+
return Object.setPrototypeOf(mapper, DebugTypeMapper.prototype);
|
|
63793
|
+
}
|
|
63794
|
+
return mapper;
|
|
63795
|
+
}
|
|
63743
63796
|
function makeUnaryTypeMapper(source, target) {
|
|
63744
|
-
return { kind: 0 /* Simple */, source: source, target: target };
|
|
63797
|
+
return attachDebugPrototypeIfDebug({ kind: 0 /* Simple */, source: source, target: target });
|
|
63745
63798
|
}
|
|
63746
63799
|
function makeArrayTypeMapper(sources, targets) {
|
|
63747
|
-
return { kind: 1 /* Array */, sources: sources, targets: targets };
|
|
63800
|
+
return attachDebugPrototypeIfDebug({ kind: 1 /* Array */, sources: sources, targets: targets });
|
|
63748
63801
|
}
|
|
63749
|
-
function makeFunctionTypeMapper(func) {
|
|
63750
|
-
return { kind:
|
|
63802
|
+
function makeFunctionTypeMapper(func, debugInfo) {
|
|
63803
|
+
return attachDebugPrototypeIfDebug({ kind: 3 /* Function */, func: func, debugInfo: ts.Debug.isDebugging ? debugInfo : undefined });
|
|
63804
|
+
}
|
|
63805
|
+
function makeDeferredTypeMapper(sources, targets) {
|
|
63806
|
+
return attachDebugPrototypeIfDebug({ kind: 2 /* Deferred */, sources: sources, targets: targets });
|
|
63751
63807
|
}
|
|
63752
63808
|
function makeCompositeTypeMapper(kind, mapper1, mapper2) {
|
|
63753
|
-
return { kind: kind, mapper1: mapper1, mapper2: mapper2 };
|
|
63809
|
+
return attachDebugPrototypeIfDebug({ kind: kind, mapper1: mapper1, mapper2: mapper2 });
|
|
63754
63810
|
}
|
|
63755
63811
|
function createTypeEraser(sources) {
|
|
63756
63812
|
return createTypeMapper(sources, /*targets*/ undefined);
|
|
@@ -63760,19 +63816,20 @@ var ts;
|
|
|
63760
63816
|
* This is used during inference when instantiating type parameter defaults.
|
|
63761
63817
|
*/
|
|
63762
63818
|
function createBackreferenceMapper(context, index) {
|
|
63763
|
-
|
|
63819
|
+
var forwardInferences = context.inferences.slice(index);
|
|
63820
|
+
return createTypeMapper(ts.map(forwardInferences, function (i) { return i.typeParameter; }), ts.map(forwardInferences, function () { return unknownType; }));
|
|
63764
63821
|
}
|
|
63765
63822
|
function combineTypeMappers(mapper1, mapper2) {
|
|
63766
|
-
return mapper1 ? makeCompositeTypeMapper(
|
|
63823
|
+
return mapper1 ? makeCompositeTypeMapper(4 /* Composite */, mapper1, mapper2) : mapper2;
|
|
63767
63824
|
}
|
|
63768
63825
|
function mergeTypeMappers(mapper1, mapper2) {
|
|
63769
|
-
return mapper1 ? makeCompositeTypeMapper(
|
|
63826
|
+
return mapper1 ? makeCompositeTypeMapper(5 /* Merged */, mapper1, mapper2) : mapper2;
|
|
63770
63827
|
}
|
|
63771
63828
|
function prependTypeMapping(source, target, mapper) {
|
|
63772
|
-
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(
|
|
63829
|
+
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* Merged */, makeUnaryTypeMapper(source, target), mapper);
|
|
63773
63830
|
}
|
|
63774
63831
|
function appendTypeMapping(mapper, source, target) {
|
|
63775
|
-
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(
|
|
63832
|
+
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* Merged */, mapper, makeUnaryTypeMapper(source, target));
|
|
63776
63833
|
}
|
|
63777
63834
|
function getRestrictiveTypeParameter(tp) {
|
|
63778
63835
|
return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol),
|
|
@@ -65668,7 +65725,7 @@ var ts;
|
|
|
65668
65725
|
reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
|
|
65669
65726
|
checkTypes = reducedTarget.flags & 1048576 /* Union */ ? reducedTarget.types : [reducedTarget];
|
|
65670
65727
|
}
|
|
65671
|
-
var
|
|
65728
|
+
var _loop_20 = function (prop) {
|
|
65672
65729
|
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
|
|
65673
65730
|
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
|
|
65674
65731
|
if (reportErrors) {
|
|
@@ -65731,7 +65788,7 @@ var ts;
|
|
|
65731
65788
|
};
|
|
65732
65789
|
for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
|
|
65733
65790
|
var prop = _b[_i];
|
|
65734
|
-
var state_6 =
|
|
65791
|
+
var state_6 = _loop_20(prop);
|
|
65735
65792
|
if (typeof state_6 === "object")
|
|
65736
65793
|
return state_6.value;
|
|
65737
65794
|
}
|
|
@@ -65963,10 +66020,10 @@ var ts;
|
|
|
65963
66020
|
// We're in the middle of variance checking - integrate any unmeasurable/unreliable flags from this cached component
|
|
65964
66021
|
var saved = entry & 24 /* ReportsMask */;
|
|
65965
66022
|
if (saved & 8 /* ReportsUnmeasurable */) {
|
|
65966
|
-
instantiateType(source,
|
|
66023
|
+
instantiateType(source, reportUnmeasurableMapper);
|
|
65967
66024
|
}
|
|
65968
66025
|
if (saved & 16 /* ReportsUnreliable */) {
|
|
65969
|
-
instantiateType(source,
|
|
66026
|
+
instantiateType(source, reportUnreliableMapper);
|
|
65970
66027
|
}
|
|
65971
66028
|
}
|
|
65972
66029
|
return entry & 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */;
|
|
@@ -66392,7 +66449,7 @@ var ts;
|
|
|
66392
66449
|
}
|
|
66393
66450
|
// Report unreliable variance for type variables referenced in template literal type placeholders.
|
|
66394
66451
|
// For example, `foo-${number}` is related to `foo-${string}` even though number isn't related to string.
|
|
66395
|
-
instantiateType(source,
|
|
66452
|
+
instantiateType(source, reportUnreliableMapper);
|
|
66396
66453
|
}
|
|
66397
66454
|
if (isTypeMatchedByTemplateLiteralType(source, target)) {
|
|
66398
66455
|
return -1 /* True */;
|
|
@@ -66664,18 +66721,6 @@ var ts;
|
|
|
66664
66721
|
}
|
|
66665
66722
|
}
|
|
66666
66723
|
}
|
|
66667
|
-
function reportUnmeasurableMarkers(p) {
|
|
66668
|
-
if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
|
|
66669
|
-
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ false);
|
|
66670
|
-
}
|
|
66671
|
-
return p;
|
|
66672
|
-
}
|
|
66673
|
-
function reportUnreliableMarkers(p) {
|
|
66674
|
-
if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
|
|
66675
|
-
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ true);
|
|
66676
|
-
}
|
|
66677
|
-
return p;
|
|
66678
|
-
}
|
|
66679
66724
|
// A type [P in S]: X is related to a type [Q in T]: Y if T is related to S and X' is
|
|
66680
66725
|
// related to Y, where X' is an instantiation of X in which P is replaced with Q. Notice
|
|
66681
66726
|
// that S and T are contra-variant whereas X and Y are co-variant.
|
|
@@ -66685,7 +66730,7 @@ var ts;
|
|
|
66685
66730
|
if (modifiersRelated) {
|
|
66686
66731
|
var result_10;
|
|
66687
66732
|
var targetConstraint = getConstraintTypeFromMappedType(target);
|
|
66688
|
-
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source),
|
|
66733
|
+
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMapper : reportUnreliableMapper);
|
|
66689
66734
|
if (result_10 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
|
|
66690
66735
|
var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
|
|
66691
66736
|
if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
|
|
@@ -66739,11 +66784,11 @@ var ts;
|
|
|
66739
66784
|
// constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
|
|
66740
66785
|
var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
|
|
66741
66786
|
var matchingTypes = [];
|
|
66742
|
-
var
|
|
66787
|
+
var _loop_21 = function (combination) {
|
|
66743
66788
|
var hasMatch = false;
|
|
66744
66789
|
outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
|
|
66745
66790
|
var type = _d[_c];
|
|
66746
|
-
var
|
|
66791
|
+
var _loop_22 = function (i) {
|
|
66747
66792
|
var sourceProperty = sourcePropertiesFiltered[i];
|
|
66748
66793
|
var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
|
|
66749
66794
|
if (!targetProperty)
|
|
@@ -66759,7 +66804,7 @@ var ts;
|
|
|
66759
66804
|
}
|
|
66760
66805
|
};
|
|
66761
66806
|
for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
|
|
66762
|
-
var state_8 =
|
|
66807
|
+
var state_8 = _loop_22(i);
|
|
66763
66808
|
switch (state_8) {
|
|
66764
66809
|
case "continue-outer": continue outer;
|
|
66765
66810
|
}
|
|
@@ -66773,7 +66818,7 @@ var ts;
|
|
|
66773
66818
|
};
|
|
66774
66819
|
for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
|
|
66775
66820
|
var combination = discriminantCombinations_1[_a];
|
|
66776
|
-
var state_7 =
|
|
66821
|
+
var state_7 = _loop_21(combination);
|
|
66777
66822
|
if (typeof state_7 === "object")
|
|
66778
66823
|
return state_7.value;
|
|
66779
66824
|
}
|
|
@@ -67221,7 +67266,7 @@ var ts;
|
|
|
67221
67266
|
* See signatureAssignableTo, compareSignaturesIdentical
|
|
67222
67267
|
*/
|
|
67223
67268
|
function signatureRelatedTo(source, target, erase, reportErrors, incompatibleReporter) {
|
|
67224
|
-
return compareSignaturesRelated(erase ? getErasedSignature(source) : source, erase ? getErasedSignature(target) : target, relation === strictSubtypeRelation ? 8 /* StrictArity */ : 0, reportErrors, reportError, incompatibleReporter, isRelatedToWorker,
|
|
67269
|
+
return compareSignaturesRelated(erase ? getErasedSignature(source) : source, erase ? getErasedSignature(target) : target, relation === strictSubtypeRelation ? 8 /* StrictArity */ : 0, reportErrors, reportError, incompatibleReporter, isRelatedToWorker, reportUnreliableMapper);
|
|
67225
67270
|
}
|
|
67226
67271
|
function signaturesIdenticalTo(source, target, kind) {
|
|
67227
67272
|
var sourceSignatures = getSignaturesOfType(source, kind);
|
|
@@ -67480,7 +67525,7 @@ var ts;
|
|
|
67480
67525
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
|
|
67481
67526
|
links.variances = ts.emptyArray;
|
|
67482
67527
|
var variances = [];
|
|
67483
|
-
var
|
|
67528
|
+
var _loop_23 = function (tp) {
|
|
67484
67529
|
var modifiers = getVarianceModifiers(tp);
|
|
67485
67530
|
var variance = modifiers & 65536 /* Out */ ?
|
|
67486
67531
|
modifiers & 32768 /* In */ ? 0 /* Invariant */ : 1 /* Covariant */ :
|
|
@@ -67516,9 +67561,9 @@ var ts;
|
|
|
67516
67561
|
}
|
|
67517
67562
|
variances.push(variance);
|
|
67518
67563
|
};
|
|
67519
|
-
for (var _i = 0,
|
|
67520
|
-
var tp =
|
|
67521
|
-
|
|
67564
|
+
for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
|
|
67565
|
+
var tp = typeParameters_2[_i];
|
|
67566
|
+
_loop_23(tp);
|
|
67522
67567
|
}
|
|
67523
67568
|
links.variances = variances;
|
|
67524
67569
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
|
|
@@ -68513,27 +68558,29 @@ var ts;
|
|
|
68513
68558
|
signature: signature,
|
|
68514
68559
|
flags: flags,
|
|
68515
68560
|
compareTypes: compareTypes,
|
|
68516
|
-
mapper:
|
|
68517
|
-
nonFixingMapper:
|
|
68561
|
+
mapper: reportUnmeasurableMapper,
|
|
68562
|
+
nonFixingMapper: reportUnmeasurableMapper,
|
|
68518
68563
|
};
|
|
68564
|
+
context.mapper = makeFixingMapperForContext(context);
|
|
68565
|
+
context.nonFixingMapper = makeNonFixingMapperForContext(context);
|
|
68519
68566
|
return context;
|
|
68520
68567
|
}
|
|
68521
|
-
function
|
|
68522
|
-
|
|
68523
|
-
|
|
68524
|
-
|
|
68525
|
-
|
|
68526
|
-
|
|
68527
|
-
|
|
68528
|
-
|
|
68529
|
-
inferFromIntraExpressionSites(context);
|
|
68530
|
-
clearCachedInferences(inferences);
|
|
68531
|
-
inference.isFixed = true;
|
|
68532
|
-
}
|
|
68533
|
-
return getInferredType(context, i);
|
|
68568
|
+
function makeFixingMapperForContext(context) {
|
|
68569
|
+
return makeDeferredTypeMapper(ts.map(context.inferences, function (i) { return i.typeParameter; }), ts.map(context.inferences, function (inference, i) { return function () {
|
|
68570
|
+
if (!inference.isFixed) {
|
|
68571
|
+
// Before we commit to a particular inference (and thus lock out any further inferences),
|
|
68572
|
+
// we infer from any intra-expression inference sites we have collected.
|
|
68573
|
+
inferFromIntraExpressionSites(context);
|
|
68574
|
+
clearCachedInferences(context.inferences);
|
|
68575
|
+
inference.isFixed = true;
|
|
68534
68576
|
}
|
|
68535
|
-
|
|
68536
|
-
|
|
68577
|
+
return getInferredType(context, i);
|
|
68578
|
+
}; }));
|
|
68579
|
+
}
|
|
68580
|
+
function makeNonFixingMapperForContext(context) {
|
|
68581
|
+
return makeDeferredTypeMapper(ts.map(context.inferences, function (i) { return i.typeParameter; }), ts.map(context.inferences, function (_, i) { return function () {
|
|
68582
|
+
return getInferredType(context, i);
|
|
68583
|
+
}; }));
|
|
68537
68584
|
}
|
|
68538
68585
|
function clearCachedInferences(inferences) {
|
|
68539
68586
|
for (var _i = 0, inferences_1 = inferences; _i < inferences_1.length; _i++) {
|
|
@@ -69453,7 +69500,7 @@ var ts;
|
|
|
69453
69500
|
// upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
|
|
69454
69501
|
// succeed. That would be a pointless and confusing outcome.
|
|
69455
69502
|
if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
|
|
69456
|
-
var
|
|
69503
|
+
var _loop_24 = function (i) {
|
|
69457
69504
|
var source_1 = matches ? matches[i] : neverType;
|
|
69458
69505
|
var target_3 = types[i];
|
|
69459
69506
|
// If we are inferring from a string literal type to a type variable whose constraint includes one of the
|
|
@@ -69503,7 +69550,7 @@ var ts;
|
|
|
69503
69550
|
inferFromTypes(source_1, target_3);
|
|
69504
69551
|
};
|
|
69505
69552
|
for (var i = 0; i < types.length; i++) {
|
|
69506
|
-
|
|
69553
|
+
_loop_24(i);
|
|
69507
69554
|
}
|
|
69508
69555
|
}
|
|
69509
69556
|
}
|
|
@@ -70021,7 +70068,7 @@ var ts;
|
|
|
70021
70068
|
function mapTypesByKeyProperty(types, name) {
|
|
70022
70069
|
var map = new ts.Map();
|
|
70023
70070
|
var count = 0;
|
|
70024
|
-
var
|
|
70071
|
+
var _loop_25 = function (type) {
|
|
70025
70072
|
if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
70026
70073
|
var discriminant = getTypeOfPropertyOfType(type, name);
|
|
70027
70074
|
if (discriminant) {
|
|
@@ -70047,7 +70094,7 @@ var ts;
|
|
|
70047
70094
|
};
|
|
70048
70095
|
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
|
|
70049
70096
|
var type = types_15[_i];
|
|
70050
|
-
var state_9 =
|
|
70097
|
+
var state_9 = _loop_25(type);
|
|
70051
70098
|
if (typeof state_9 === "object")
|
|
70052
70099
|
return state_9.value;
|
|
70053
70100
|
}
|
|
@@ -76396,7 +76443,7 @@ var ts;
|
|
|
76396
76443
|
if (spreadIndex >= 0) {
|
|
76397
76444
|
// Create synthetic arguments from spreads of tuple types.
|
|
76398
76445
|
var effectiveArgs_1 = args.slice(0, spreadIndex);
|
|
76399
|
-
var
|
|
76446
|
+
var _loop_26 = function (i) {
|
|
76400
76447
|
var arg = args[i];
|
|
76401
76448
|
// We can call checkExpressionCached because spread expressions never have a contextual type.
|
|
76402
76449
|
var spreadType = arg.kind === 225 /* SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
|
|
@@ -76413,7 +76460,7 @@ var ts;
|
|
|
76413
76460
|
}
|
|
76414
76461
|
};
|
|
76415
76462
|
for (var i = spreadIndex; i < args.length; i++) {
|
|
76416
|
-
|
|
76463
|
+
_loop_26(i);
|
|
76417
76464
|
}
|
|
76418
76465
|
return effectiveArgs_1;
|
|
76419
76466
|
}
|
|
@@ -76742,7 +76789,7 @@ var ts;
|
|
|
76742
76789
|
var min_3 = Number.MAX_VALUE;
|
|
76743
76790
|
var minIndex = 0;
|
|
76744
76791
|
var i_1 = 0;
|
|
76745
|
-
var
|
|
76792
|
+
var _loop_27 = function (c) {
|
|
76746
76793
|
var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
|
|
76747
76794
|
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2);
|
|
76748
76795
|
if (diags_2) {
|
|
@@ -76760,7 +76807,7 @@ var ts;
|
|
|
76760
76807
|
};
|
|
76761
76808
|
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
|
|
76762
76809
|
var c = candidatesForArgumentError_1[_a];
|
|
76763
|
-
|
|
76810
|
+
_loop_27(c);
|
|
76764
76811
|
}
|
|
76765
76812
|
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
|
|
76766
76813
|
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
|
|
@@ -76918,7 +76965,7 @@ var ts;
|
|
|
76918
76965
|
}
|
|
76919
76966
|
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
|
|
76920
76967
|
var parameters = [];
|
|
76921
|
-
var
|
|
76968
|
+
var _loop_28 = function (i) {
|
|
76922
76969
|
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
|
|
76923
76970
|
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
|
|
76924
76971
|
i < s.parameters.length ? s.parameters[i] : undefined; });
|
|
@@ -76926,7 +76973,7 @@ var ts;
|
|
|
76926
76973
|
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
|
|
76927
76974
|
};
|
|
76928
76975
|
for (var i = 0; i < maxNonRestParam; i++) {
|
|
76929
|
-
|
|
76976
|
+
_loop_28(i);
|
|
76930
76977
|
}
|
|
76931
76978
|
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
|
|
76932
76979
|
var flags = 0 /* None */;
|
|
@@ -80279,8 +80326,8 @@ var ts;
|
|
|
80279
80326
|
var result = [];
|
|
80280
80327
|
var oldTypeParameters;
|
|
80281
80328
|
var newTypeParameters;
|
|
80282
|
-
for (var _i = 0,
|
|
80283
|
-
var tp =
|
|
80329
|
+
for (var _i = 0, typeParameters_3 = typeParameters; _i < typeParameters_3.length; _i++) {
|
|
80330
|
+
var tp = typeParameters_3[_i];
|
|
80284
80331
|
var name = tp.symbol.escapedName;
|
|
80285
80332
|
if (hasTypeParameterByName(context.inferredTypeParameters, name) || hasTypeParameterByName(result, name)) {
|
|
80286
80333
|
var newName = getUniqueTypeParameterName(ts.concatenate(context.inferredTypeParameters, result), name);
|
|
@@ -80959,7 +81006,7 @@ var ts;
|
|
|
80959
81006
|
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
|
|
80960
81007
|
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
|
|
80961
81008
|
var indexSignatureMap_1 = new ts.Map();
|
|
80962
|
-
var
|
|
81009
|
+
var _loop_29 = function (declaration) {
|
|
80963
81010
|
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
|
|
80964
81011
|
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
|
|
80965
81012
|
var entry = indexSignatureMap_1.get(getTypeId(type));
|
|
@@ -80974,7 +81021,7 @@ var ts;
|
|
|
80974
81021
|
};
|
|
80975
81022
|
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
|
|
80976
81023
|
var declaration = _a[_i];
|
|
80977
|
-
|
|
81024
|
+
_loop_29(declaration);
|
|
80978
81025
|
}
|
|
80979
81026
|
indexSignatureMap_1.forEach(function (entry) {
|
|
80980
81027
|
if (entry.declarations.length > 1) {
|
|
@@ -81197,6 +81244,12 @@ var ts;
|
|
|
81197
81244
|
function checkMissingDeclaration(node) {
|
|
81198
81245
|
checkDecorators(node);
|
|
81199
81246
|
}
|
|
81247
|
+
function getEffectiveTypeArgumentAtIndex(node, typeParameters, index) {
|
|
81248
|
+
if (index < typeParameters.length) {
|
|
81249
|
+
return getTypeFromTypeNode(node.typeArguments[index]);
|
|
81250
|
+
}
|
|
81251
|
+
return getEffectiveTypeArguments(node, typeParameters)[index];
|
|
81252
|
+
}
|
|
81200
81253
|
function getEffectiveTypeArguments(node, typeParameters) {
|
|
81201
81254
|
return fillMissingTypeArguments(ts.map(node.typeArguments, getTypeFromTypeNode), typeParameters, getMinTypeArgumentCount(typeParameters), ts.isInJSFile(node));
|
|
81202
81255
|
}
|
|
@@ -81938,6 +81991,32 @@ var ts;
|
|
|
81938
81991
|
isAwaitedTypeInstantiation(type) ? type.aliasTypeArguments[0] :
|
|
81939
81992
|
type;
|
|
81940
81993
|
}
|
|
81994
|
+
function isAwaitedTypeNeeded(type) {
|
|
81995
|
+
// If this is already an `Awaited<T>`, we shouldn't wrap it. This helps to avoid `Awaited<Awaited<T>>` in higher-order.
|
|
81996
|
+
if (isTypeAny(type) || isAwaitedTypeInstantiation(type)) {
|
|
81997
|
+
return false;
|
|
81998
|
+
}
|
|
81999
|
+
// We only need `Awaited<T>` if `T` contains possibly non-primitive types.
|
|
82000
|
+
if (isGenericObjectType(type)) {
|
|
82001
|
+
var baseConstraint = getBaseConstraintOfType(type);
|
|
82002
|
+
// We only need `Awaited<T>` if `T` has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
|
|
82003
|
+
// or is promise-like.
|
|
82004
|
+
if (!baseConstraint || (baseConstraint.flags & 3 /* AnyOrUnknown */) || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint)) {
|
|
82005
|
+
return true;
|
|
82006
|
+
}
|
|
82007
|
+
}
|
|
82008
|
+
return false;
|
|
82009
|
+
}
|
|
82010
|
+
function tryCreateAwaitedType(type) {
|
|
82011
|
+
// Nothing to do if `Awaited<T>` doesn't exist
|
|
82012
|
+
var awaitedSymbol = getGlobalAwaitedSymbol(/*reportErrors*/ true);
|
|
82013
|
+
if (awaitedSymbol) {
|
|
82014
|
+
// Unwrap unions that may contain `Awaited<T>`, otherwise its possible to manufacture an `Awaited<Awaited<T> | U>` where
|
|
82015
|
+
// an `Awaited<T | U>` would suffice.
|
|
82016
|
+
return getTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
|
|
82017
|
+
}
|
|
82018
|
+
return undefined;
|
|
82019
|
+
}
|
|
81941
82020
|
function createAwaitedTypeIfNeeded(type) {
|
|
81942
82021
|
// We wrap type `T` in `Awaited<T>` based on the following conditions:
|
|
81943
82022
|
// - `T` is not already an `Awaited<U>`, and
|
|
@@ -81946,26 +82025,10 @@ var ts;
|
|
|
81946
82025
|
// - `T` has no base constraint, or
|
|
81947
82026
|
// - The base constraint of `T` is `any`, `unknown`, `object`, or `{}`, or
|
|
81948
82027
|
// - The base constraint of `T` is an object type with a callable `then` method.
|
|
81949
|
-
if (
|
|
81950
|
-
|
|
81951
|
-
|
|
81952
|
-
|
|
81953
|
-
if (isAwaitedTypeInstantiation(type)) {
|
|
81954
|
-
return type;
|
|
81955
|
-
}
|
|
81956
|
-
// Only instantiate `Awaited<T>` if `T` contains possibly non-primitive types.
|
|
81957
|
-
if (isGenericObjectType(type)) {
|
|
81958
|
-
var baseConstraint = getBaseConstraintOfType(type);
|
|
81959
|
-
// Only instantiate `Awaited<T>` if `T` has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
|
|
81960
|
-
// or is promise-like.
|
|
81961
|
-
if (!baseConstraint || (baseConstraint.flags & 3 /* AnyOrUnknown */) || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint)) {
|
|
81962
|
-
// Nothing to do if `Awaited<T>` doesn't exist
|
|
81963
|
-
var awaitedSymbol = getGlobalAwaitedSymbol(/*reportErrors*/ true);
|
|
81964
|
-
if (awaitedSymbol) {
|
|
81965
|
-
// Unwrap unions that may contain `Awaited<T>`, otherwise its possible to manufacture an `Awaited<Awaited<T> | U>` where
|
|
81966
|
-
// an `Awaited<T | U>` would suffice.
|
|
81967
|
-
return getTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
|
|
81968
|
-
}
|
|
82028
|
+
if (isAwaitedTypeNeeded(type)) {
|
|
82029
|
+
var awaitedType = tryCreateAwaitedType(type);
|
|
82030
|
+
if (awaitedType) {
|
|
82031
|
+
return awaitedType;
|
|
81969
82032
|
}
|
|
81970
82033
|
}
|
|
81971
82034
|
ts.Debug.assert(getPromisedTypeOfPromise(type) === undefined, "type provided should not be a non-generic 'promise'-like.");
|
|
@@ -82017,6 +82080,10 @@ var ts;
|
|
|
82017
82080
|
awaitedTypeStack.pop();
|
|
82018
82081
|
return typeAsAwaitable.awaitedTypeOfType = mapped;
|
|
82019
82082
|
}
|
|
82083
|
+
// If `type` is generic and should be wrapped in `Awaited<T>`, return it.
|
|
82084
|
+
if (isAwaitedTypeNeeded(type)) {
|
|
82085
|
+
return typeAsAwaitable.awaitedTypeOfType = type;
|
|
82086
|
+
}
|
|
82020
82087
|
var thisTypeForErrorOut = { value: undefined };
|
|
82021
82088
|
var promisedType = getPromisedTypeOfPromise(type, /*errorNode*/ undefined, thisTypeForErrorOut);
|
|
82022
82089
|
if (promisedType) {
|
|
@@ -82664,8 +82731,8 @@ var ts;
|
|
|
82664
82731
|
return;
|
|
82665
82732
|
var typeParameters = ts.getEffectiveTypeParameterDeclarations(node);
|
|
82666
82733
|
var seenParentsWithEveryUnused = new ts.Set();
|
|
82667
|
-
for (var _i = 0,
|
|
82668
|
-
var typeParameter =
|
|
82734
|
+
for (var _i = 0, typeParameters_4 = typeParameters; _i < typeParameters_4.length; _i++) {
|
|
82735
|
+
var typeParameter = typeParameters_4[_i];
|
|
82669
82736
|
if (!isTypeParameterUnused(typeParameter))
|
|
82670
82737
|
continue;
|
|
82671
82738
|
var name = ts.idText(typeParameter.name);
|
|
@@ -84484,7 +84551,7 @@ var ts;
|
|
|
84484
84551
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84485
84552
|
var localPropDeclaration = declaration && declaration.kind === 221 /* BinaryExpression */ ||
|
|
84486
84553
|
name && name.kind === 162 /* ComputedPropertyName */ || getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
84487
|
-
var
|
|
84554
|
+
var _loop_30 = function (info) {
|
|
84488
84555
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
84489
84556
|
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
|
|
84490
84557
|
// in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
|
|
@@ -84497,7 +84564,7 @@ var ts;
|
|
|
84497
84564
|
};
|
|
84498
84565
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
84499
84566
|
var info = indexInfos_9[_i];
|
|
84500
|
-
|
|
84567
|
+
_loop_30(info);
|
|
84501
84568
|
}
|
|
84502
84569
|
}
|
|
84503
84570
|
function checkIndexConstraintForIndexSignature(type, checkInfo) {
|
|
@@ -84505,7 +84572,7 @@ var ts;
|
|
|
84505
84572
|
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
|
|
84506
84573
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84507
84574
|
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
|
|
84508
|
-
var
|
|
84575
|
+
var _loop_31 = function (info) {
|
|
84509
84576
|
if (info === checkInfo)
|
|
84510
84577
|
return "continue";
|
|
84511
84578
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
@@ -84520,7 +84587,7 @@ var ts;
|
|
|
84520
84587
|
};
|
|
84521
84588
|
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
84522
84589
|
var info = indexInfos_10[_i];
|
|
84523
|
-
|
|
84590
|
+
_loop_31(info);
|
|
84524
84591
|
}
|
|
84525
84592
|
}
|
|
84526
84593
|
function checkTypeNameIsReserved(name, message) {
|
|
@@ -84840,7 +84907,7 @@ var ts;
|
|
|
84840
84907
|
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
84841
84908
|
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
84842
84909
|
var baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
84843
|
-
var
|
|
84910
|
+
var _loop_32 = function (member) {
|
|
84844
84911
|
if (ts.hasAmbientModifier(member)) {
|
|
84845
84912
|
return "continue";
|
|
84846
84913
|
}
|
|
@@ -84857,7 +84924,7 @@ var ts;
|
|
|
84857
84924
|
};
|
|
84858
84925
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
84859
84926
|
var member = _a[_i];
|
|
84860
|
-
|
|
84927
|
+
_loop_32(member);
|
|
84861
84928
|
}
|
|
84862
84929
|
}
|
|
84863
84930
|
/**
|
|
@@ -84945,7 +85012,7 @@ var ts;
|
|
|
84945
85012
|
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
|
|
84946
85013
|
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
|
|
84947
85014
|
var issuedMemberError = false;
|
|
84948
|
-
var
|
|
85015
|
+
var _loop_33 = function (member) {
|
|
84949
85016
|
if (ts.isStatic(member)) {
|
|
84950
85017
|
return "continue";
|
|
84951
85018
|
}
|
|
@@ -84964,7 +85031,7 @@ var ts;
|
|
|
84964
85031
|
};
|
|
84965
85032
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
84966
85033
|
var member = _a[_i];
|
|
84967
|
-
|
|
85034
|
+
_loop_33(member);
|
|
84968
85035
|
}
|
|
84969
85036
|
if (!issuedMemberError) {
|
|
84970
85037
|
// check again with diagnostics to generate a less-specific error
|
|
@@ -85035,7 +85102,7 @@ var ts;
|
|
|
85035
85102
|
var _a, _b, _c, _d;
|
|
85036
85103
|
// NOTE: assignability is checked in checkClassDeclaration
|
|
85037
85104
|
var baseProperties = getPropertiesOfType(baseType);
|
|
85038
|
-
var
|
|
85105
|
+
var _loop_34 = function (baseProperty) {
|
|
85039
85106
|
var base = getTargetSymbol(baseProperty);
|
|
85040
85107
|
if (base.flags & 4194304 /* Prototype */) {
|
|
85041
85108
|
return "continue";
|
|
@@ -85145,7 +85212,7 @@ var ts;
|
|
|
85145
85212
|
};
|
|
85146
85213
|
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
|
|
85147
85214
|
var baseProperty = baseProperties_1[_i];
|
|
85148
|
-
var state_10 =
|
|
85215
|
+
var state_10 = _loop_34(baseProperty);
|
|
85149
85216
|
switch (state_10) {
|
|
85150
85217
|
case "continue-basePropertyCheck": continue basePropertyCheck;
|
|
85151
85218
|
}
|
|
@@ -111660,7 +111727,6 @@ var ts;
|
|
|
111660
111727
|
if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
|
|
111661
111728
|
// Update the output signature
|
|
111662
111729
|
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, createHash, changedDtsData);
|
|
111663
|
-
newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
|
|
111664
111730
|
}
|
|
111665
111731
|
// Update sourceFileInfo
|
|
111666
111732
|
var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
|
|
@@ -121047,7 +121113,7 @@ var ts;
|
|
|
121047
121113
|
state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
|
|
121048
121114
|
}
|
|
121049
121115
|
state.changedFilesSet = new ts.Set();
|
|
121050
|
-
state.
|
|
121116
|
+
state.latestChangedDtsFile = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.latestChangedDtsFile : undefined;
|
|
121051
121117
|
var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
|
|
121052
121118
|
var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
|
|
121053
121119
|
var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
|
|
@@ -121171,7 +121237,7 @@ var ts;
|
|
|
121171
121237
|
programEmitComplete: state.programEmitComplete,
|
|
121172
121238
|
emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
|
|
121173
121239
|
outSignature: state.outSignature,
|
|
121174
|
-
|
|
121240
|
+
latestChangedDtsFile: state.latestChangedDtsFile,
|
|
121175
121241
|
hasChangedEmitSignature: state.hasChangedEmitSignature,
|
|
121176
121242
|
changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
|
|
121177
121243
|
};
|
|
@@ -121184,7 +121250,7 @@ var ts;
|
|
|
121184
121250
|
state.programEmitComplete = savedEmitState.programEmitComplete;
|
|
121185
121251
|
state.emitSignatures = savedEmitState.emitSignatures;
|
|
121186
121252
|
state.outSignature = savedEmitState.outSignature;
|
|
121187
|
-
state.
|
|
121253
|
+
state.latestChangedDtsFile = savedEmitState.latestChangedDtsFile;
|
|
121188
121254
|
state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
|
|
121189
121255
|
if (savedEmitState.changedFilesSet)
|
|
121190
121256
|
state.changedFilesSet = savedEmitState.changedFilesSet;
|
|
@@ -121498,14 +121564,14 @@ var ts;
|
|
|
121498
121564
|
/**
|
|
121499
121565
|
* Gets the program information to be emitted in buildInfo so that we can use it to create new program
|
|
121500
121566
|
*/
|
|
121501
|
-
function getProgramBuildInfo(state, getCanonicalFileName
|
|
121567
|
+
function getProgramBuildInfo(state, getCanonicalFileName) {
|
|
121502
121568
|
var outFilePath = ts.outFile(state.compilerOptions);
|
|
121503
121569
|
if (outFilePath && !state.compilerOptions.composite)
|
|
121504
121570
|
return;
|
|
121505
121571
|
var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
|
|
121506
121572
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
|
|
121507
|
-
//
|
|
121508
|
-
|
|
121573
|
+
// Convert the file name to Path here if we set the fileName instead to optimize multiple d.ts file emits and having to compute Canonical path
|
|
121574
|
+
var latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : undefined;
|
|
121509
121575
|
if (outFilePath) {
|
|
121510
121576
|
var fileNames_1 = [];
|
|
121511
121577
|
var fileInfos_1 = [];
|
|
@@ -121521,7 +121587,7 @@ var ts;
|
|
|
121521
121587
|
fileInfos: fileInfos_1,
|
|
121522
121588
|
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
|
|
121523
121589
|
outSignature: state.outSignature,
|
|
121524
|
-
|
|
121590
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
121525
121591
|
};
|
|
121526
121592
|
return result_15;
|
|
121527
121593
|
}
|
|
@@ -121623,7 +121689,7 @@ var ts;
|
|
|
121623
121689
|
affectedFilesPendingEmit: affectedFilesPendingEmit,
|
|
121624
121690
|
changeFileSet: changeFileSet,
|
|
121625
121691
|
emitSignatures: emitSignatures,
|
|
121626
|
-
|
|
121692
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
121627
121693
|
};
|
|
121628
121694
|
return result;
|
|
121629
121695
|
function relativeToBuildInfoEnsuringAbsolutePath(path) {
|
|
@@ -121791,7 +121857,7 @@ var ts;
|
|
|
121791
121857
|
*/
|
|
121792
121858
|
var computeHash = ts.maybeBind(host, host.createHash);
|
|
121793
121859
|
var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
|
|
121794
|
-
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName
|
|
121860
|
+
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
|
|
121795
121861
|
// To ensure that we arent storing any references to old program or new program without state
|
|
121796
121862
|
newProgram = undefined; // TODO: GH#18217
|
|
121797
121863
|
oldProgram = undefined;
|
|
@@ -121801,6 +121867,7 @@ var ts;
|
|
|
121801
121867
|
builderProgram.getState = getState;
|
|
121802
121868
|
builderProgram.saveEmitState = function () { return backupBuilderProgramEmitState(state); };
|
|
121803
121869
|
builderProgram.restoreEmitState = function (saved) { return restoreBuilderProgramEmitState(state, saved); };
|
|
121870
|
+
builderProgram.hasChangedEmitSignature = function () { return !!state.hasChangedEmitSignature; };
|
|
121804
121871
|
builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
|
|
121805
121872
|
builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
|
|
121806
121873
|
builderProgram.emit = emit;
|
|
@@ -121908,18 +121975,22 @@ var ts;
|
|
|
121908
121975
|
var filePath = sourceFiles[0].resolvedPath;
|
|
121909
121976
|
var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath);
|
|
121910
121977
|
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text, computeHash, data));
|
|
121911
|
-
if
|
|
121912
|
-
|
|
121913
|
-
|
|
121914
|
-
|
|
121978
|
+
// Dont write dts files if they didn't change
|
|
121979
|
+
if (emitSignature === oldSignature)
|
|
121980
|
+
return;
|
|
121981
|
+
((_g = state.emitSignatures) !== null && _g !== void 0 ? _g : (state.emitSignatures = new ts.Map())).set(filePath, emitSignature);
|
|
121982
|
+
state.hasChangedEmitSignature = true;
|
|
121983
|
+
state.latestChangedDtsFile = fileName;
|
|
121915
121984
|
}
|
|
121916
121985
|
}
|
|
121917
121986
|
else if (state.compilerOptions.composite) {
|
|
121918
121987
|
var newSignature = computeSignature(text, computeHash, data);
|
|
121919
|
-
if
|
|
121920
|
-
|
|
121921
|
-
|
|
121922
|
-
|
|
121988
|
+
// Dont write dts files if they didn't change
|
|
121989
|
+
if (newSignature === state.outSignature)
|
|
121990
|
+
return;
|
|
121991
|
+
state.outSignature = newSignature;
|
|
121992
|
+
state.hasChangedEmitSignature = true;
|
|
121993
|
+
state.latestChangedDtsFile = fileName;
|
|
121923
121994
|
}
|
|
121924
121995
|
}
|
|
121925
121996
|
if (writeFile)
|
|
@@ -122082,11 +122153,12 @@ var ts;
|
|
|
122082
122153
|
var state;
|
|
122083
122154
|
var filePaths;
|
|
122084
122155
|
var filePathsSetList;
|
|
122156
|
+
var latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : undefined;
|
|
122085
122157
|
if (isProgramBundleEmitBuildInfo(program)) {
|
|
122086
122158
|
state = {
|
|
122087
122159
|
fileInfos: new ts.Map(),
|
|
122088
122160
|
compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
|
|
122089
|
-
|
|
122161
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
122090
122162
|
outSignature: program.outSignature,
|
|
122091
122163
|
};
|
|
122092
122164
|
}
|
|
@@ -122119,7 +122191,7 @@ var ts;
|
|
|
122119
122191
|
affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
|
|
122120
122192
|
affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
|
|
122121
122193
|
changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
|
|
122122
|
-
|
|
122194
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
122123
122195
|
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
|
122124
122196
|
};
|
|
122125
122197
|
}
|
|
@@ -122146,6 +122218,7 @@ var ts;
|
|
|
122146
122218
|
getSemanticDiagnosticsOfNextAffectedFile: ts.notImplemented,
|
|
122147
122219
|
emitBuildInfo: ts.notImplemented,
|
|
122148
122220
|
close: ts.noop,
|
|
122221
|
+
hasChangedEmitSignature: ts.returnFalse,
|
|
122149
122222
|
};
|
|
122150
122223
|
function toPath(path) {
|
|
122151
122224
|
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
@@ -123460,7 +123533,7 @@ var ts;
|
|
|
123460
123533
|
});
|
|
123461
123534
|
// Sort by paths closest to importing file Name directory
|
|
123462
123535
|
var sortedPaths = [];
|
|
123463
|
-
var
|
|
123536
|
+
var _loop_35 = function (directory) {
|
|
123464
123537
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
123465
123538
|
var pathsInDirectory;
|
|
123466
123539
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -123484,7 +123557,7 @@ var ts;
|
|
|
123484
123557
|
};
|
|
123485
123558
|
var out_directory_1;
|
|
123486
123559
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
123487
|
-
var state_11 =
|
|
123560
|
+
var state_11 = _loop_35(directory);
|
|
123488
123561
|
directory = out_directory_1;
|
|
123489
123562
|
if (state_11 === "break")
|
|
123490
123563
|
break;
|
|
@@ -124328,7 +124401,6 @@ var ts;
|
|
|
124328
124401
|
readDirectory: ts.maybeBind(host, host.readDirectory),
|
|
124329
124402
|
disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
|
|
124330
124403
|
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
|
|
124331
|
-
now: ts.maybeBind(host, host.now),
|
|
124332
124404
|
};
|
|
124333
124405
|
function writeFile(fileName, text, writeByteOrderMark, onError) {
|
|
124334
124406
|
try {
|
|
@@ -124486,7 +124558,6 @@ var ts;
|
|
|
124486
124558
|
host.createHash = ts.maybeBind(system, system.createHash);
|
|
124487
124559
|
host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
|
|
124488
124560
|
host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
|
|
124489
|
-
host.now = ts.maybeBind(system, system.now);
|
|
124490
124561
|
ts.setGetSourceFileAsHashVersioned(host, system);
|
|
124491
124562
|
ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
|
|
124492
124563
|
return host;
|
|
@@ -125814,8 +125885,7 @@ var ts;
|
|
|
125814
125885
|
}
|
|
125815
125886
|
// Actual Emit
|
|
125816
125887
|
var host = state.host, compilerHost = state.compilerHost;
|
|
125817
|
-
var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
|
|
125818
|
-
var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
|
|
125888
|
+
var resultFlags = ((_d = program.hasChangedEmitSignature) === null || _d === void 0 ? void 0 : _d.call(program)) ? BuildResultFlags.None : BuildResultFlags.DeclarationOutputUnchanged;
|
|
125819
125889
|
var emitterDiagnostics = ts.createDiagnosticCollection();
|
|
125820
125890
|
var emittedOutputs = new ts.Map();
|
|
125821
125891
|
var options = program.getCompilerOptions();
|
|
@@ -125823,17 +125893,11 @@ var ts;
|
|
|
125823
125893
|
var outputTimeStampMap;
|
|
125824
125894
|
var now;
|
|
125825
125895
|
outputFiles.forEach(function (_a) {
|
|
125826
|
-
var _b, _c;
|
|
125827
125896
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
125828
125897
|
var path = toPath(state, name);
|
|
125829
125898
|
emittedOutputs.set(toPath(state, name), name);
|
|
125830
|
-
if (buildInfo)
|
|
125831
|
-
setBuildInfo(state, buildInfo, projectPath, options);
|
|
125832
|
-
// Buildinfo has information on when last dts change time
|
|
125833
|
-
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)) {
|
|
125834
|
-
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
|
125835
|
-
}
|
|
125836
|
-
}
|
|
125899
|
+
if (buildInfo)
|
|
125900
|
+
setBuildInfo(state, buildInfo, projectPath, options, resultFlags);
|
|
125837
125901
|
ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
|
|
125838
125902
|
if (!isIncremental && state.watch) {
|
|
125839
125903
|
(outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
|
|
@@ -125847,7 +125911,7 @@ var ts;
|
|
|
125847
125911
|
ts.Debug.assert(step === BuildStep.EmitBuildInfo);
|
|
125848
125912
|
var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
|
|
125849
125913
|
if (data === null || data === void 0 ? void 0 : data.buildInfo)
|
|
125850
|
-
setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
|
|
125914
|
+
setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions(), BuildResultFlags.DeclarationOutputUnchanged);
|
|
125851
125915
|
if (writeFileCallback)
|
|
125852
125916
|
writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
125853
125917
|
else
|
|
@@ -125880,7 +125944,6 @@ var ts;
|
|
|
125880
125944
|
state.diagnostics.delete(projectPath);
|
|
125881
125945
|
state.projectStatus.set(projectPath, {
|
|
125882
125946
|
type: ts.UpToDateStatusType.UpToDate,
|
|
125883
|
-
newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
|
|
125884
125947
|
oldestOutputFileName: oldestOutputFileName
|
|
125885
125948
|
});
|
|
125886
125949
|
afterProgramDone(state, program, config);
|
|
@@ -125922,10 +125985,10 @@ var ts;
|
|
|
125922
125985
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
125923
125986
|
emittedOutputs.set(toPath(state, name), name);
|
|
125924
125987
|
if (buildInfo) {
|
|
125925
|
-
|
|
125926
|
-
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
|
|
125988
|
+
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) {
|
|
125927
125989
|
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
|
125928
125990
|
}
|
|
125991
|
+
setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags);
|
|
125929
125992
|
}
|
|
125930
125993
|
ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
|
|
125931
125994
|
});
|
|
@@ -126184,15 +126247,23 @@ var ts;
|
|
|
126184
126247
|
state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
|
|
126185
126248
|
return result;
|
|
126186
126249
|
}
|
|
126187
|
-
function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
|
|
126250
|
+
function setBuildInfo(state, buildInfo, resolvedConfigPath, options, resultFlags) {
|
|
126188
126251
|
var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
|
|
126189
126252
|
var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
|
|
126253
|
+
var modifiedTime = getCurrentTime(state.host);
|
|
126190
126254
|
if (existing) {
|
|
126191
126255
|
existing.buildInfo = buildInfo;
|
|
126192
|
-
existing.modifiedTime =
|
|
126256
|
+
existing.modifiedTime = modifiedTime;
|
|
126257
|
+
if (!(resultFlags & BuildResultFlags.DeclarationOutputUnchanged))
|
|
126258
|
+
existing.latestChangedDtsTime = modifiedTime;
|
|
126193
126259
|
}
|
|
126194
126260
|
else {
|
|
126195
|
-
state.buildInfoCache.set(resolvedConfigPath, {
|
|
126261
|
+
state.buildInfoCache.set(resolvedConfigPath, {
|
|
126262
|
+
path: toPath(state, buildInfoPath),
|
|
126263
|
+
buildInfo: buildInfo,
|
|
126264
|
+
modifiedTime: modifiedTime,
|
|
126265
|
+
latestChangedDtsTime: resultFlags & BuildResultFlags.DeclarationOutputUnchanged ? undefined : modifiedTime,
|
|
126266
|
+
});
|
|
126196
126267
|
}
|
|
126197
126268
|
}
|
|
126198
126269
|
function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
|
|
@@ -126224,7 +126295,7 @@ var ts;
|
|
|
126224
126295
|
}
|
|
126225
126296
|
}
|
|
126226
126297
|
function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
126227
|
-
var _a, _b
|
|
126298
|
+
var _a, _b;
|
|
126228
126299
|
// Container if no files are specified in the project
|
|
126229
126300
|
if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
|
|
126230
126301
|
return {
|
|
@@ -126236,8 +126307,8 @@ var ts;
|
|
|
126236
126307
|
var force = !!state.options.force;
|
|
126237
126308
|
if (project.projectReferences) {
|
|
126238
126309
|
state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
|
|
126239
|
-
for (var _i = 0,
|
|
126240
|
-
var ref =
|
|
126310
|
+
for (var _i = 0, _c = project.projectReferences; _i < _c.length; _i++) {
|
|
126311
|
+
var ref = _c[_i];
|
|
126241
126312
|
var resolvedRef = ts.resolveProjectReferencePath(ref);
|
|
126242
126313
|
var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
|
|
126243
126314
|
var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
|
|
@@ -126277,7 +126348,6 @@ var ts;
|
|
|
126277
126348
|
var buildInfoTime;
|
|
126278
126349
|
var buildInfoProgram;
|
|
126279
126350
|
var buildInfoVersionMap;
|
|
126280
|
-
var newestDeclarationFileContentChangedTime;
|
|
126281
126351
|
if (buildInfoPath) {
|
|
126282
126352
|
var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
|
|
126283
126353
|
buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
|
|
@@ -126314,8 +126384,6 @@ var ts;
|
|
|
126314
126384
|
}
|
|
126315
126385
|
oldestOutputFileTime = buildInfoTime;
|
|
126316
126386
|
oldestOutputFileName = buildInfoPath;
|
|
126317
|
-
// Get the last dtsChange time from build info
|
|
126318
|
-
newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
|
|
126319
126387
|
}
|
|
126320
126388
|
// Check input files
|
|
126321
126389
|
var newestInputFileName = undefined;
|
|
@@ -126323,8 +126391,8 @@ var ts;
|
|
|
126323
126391
|
/** True if input file has changed timestamp but text is not changed, we can then do only timestamp updates on output to make it look up-to-date later */
|
|
126324
126392
|
var pseudoInputUpToDate = false;
|
|
126325
126393
|
// Get timestamps of input files
|
|
126326
|
-
for (var
|
|
126327
|
-
var inputFile =
|
|
126394
|
+
for (var _d = 0, _e = project.fileNames; _d < _e.length; _d++) {
|
|
126395
|
+
var inputFile = _e[_d];
|
|
126328
126396
|
var inputTime = getModifiedTime(state, inputFile);
|
|
126329
126397
|
if (inputTime === ts.missingFileModifiedTime) {
|
|
126330
126398
|
return {
|
|
@@ -126365,8 +126433,8 @@ var ts;
|
|
|
126365
126433
|
// Collect the expected outputs of this project
|
|
126366
126434
|
var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
|
|
126367
126435
|
var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
|
|
126368
|
-
for (var
|
|
126369
|
-
var output = outputs_1[
|
|
126436
|
+
for (var _f = 0, outputs_1 = outputs; _f < outputs_1.length; _f++) {
|
|
126437
|
+
var output = outputs_1[_f];
|
|
126370
126438
|
var path = toPath(state, output);
|
|
126371
126439
|
// Output is missing; can stop checking
|
|
126372
126440
|
var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
|
|
@@ -126404,8 +126472,8 @@ var ts;
|
|
|
126404
126472
|
var usesPrepend = false;
|
|
126405
126473
|
var upstreamChangedProject;
|
|
126406
126474
|
if (referenceStatuses) {
|
|
126407
|
-
for (var
|
|
126408
|
-
var
|
|
126475
|
+
for (var _g = 0, referenceStatuses_1 = referenceStatuses; _g < referenceStatuses_1.length; _g++) {
|
|
126476
|
+
var _h = referenceStatuses_1[_g], ref = _h.ref, refStatus = _h.refStatus, resolvedConfig = _h.resolvedConfig, resolvedRefPath = _h.resolvedRefPath;
|
|
126409
126477
|
usesPrepend = usesPrepend || !!(ref.prepend);
|
|
126410
126478
|
// If the upstream project's newest file is older than our oldest output, we
|
|
126411
126479
|
// can't be out of date because of it
|
|
@@ -126422,7 +126490,8 @@ var ts;
|
|
|
126422
126490
|
}
|
|
126423
126491
|
// If the upstream project has only change .d.ts files, and we've built
|
|
126424
126492
|
// *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
|
|
126425
|
-
|
|
126493
|
+
var newestDeclarationFileContentChangedTime = getLatestChangedDtsTime(state, resolvedConfig.options, resolvedRefPath);
|
|
126494
|
+
if (newestDeclarationFileContentChangedTime && newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
|
|
126426
126495
|
pseudoUpToDate = true;
|
|
126427
126496
|
upstreamChangedProject = ref.path;
|
|
126428
126497
|
continue;
|
|
@@ -126465,7 +126534,6 @@ var ts;
|
|
|
126465
126534
|
pseudoInputUpToDate ?
|
|
126466
126535
|
ts.UpToDateStatusType.UpToDateWithInputFileText :
|
|
126467
126536
|
ts.UpToDateStatusType.UpToDate,
|
|
126468
|
-
newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
|
|
126469
126537
|
newestInputFileTime: newestInputFileTime,
|
|
126470
126538
|
newestInputFileName: newestInputFileName,
|
|
126471
126539
|
oldestOutputFileName: oldestOutputFileName
|
|
@@ -126549,13 +126617,17 @@ var ts;
|
|
|
126549
126617
|
outputTimeStampMap.delete(key);
|
|
126550
126618
|
});
|
|
126551
126619
|
}
|
|
126552
|
-
function
|
|
126553
|
-
var _a;
|
|
126620
|
+
function getLatestChangedDtsTime(state, options, resolvedConfigPath) {
|
|
126554
126621
|
if (!options.composite)
|
|
126555
126622
|
return undefined;
|
|
126556
|
-
var
|
|
126557
|
-
|
|
126558
|
-
|
|
126623
|
+
var entry = ts.Debug.checkDefined(state.buildInfoCache.get(resolvedConfigPath));
|
|
126624
|
+
if (entry.latestChangedDtsTime !== undefined)
|
|
126625
|
+
return entry.latestChangedDtsTime || undefined;
|
|
126626
|
+
var latestChangedDtsTime = entry.buildInfo && entry.buildInfo.program && entry.buildInfo.program.latestChangedDtsFile ?
|
|
126627
|
+
state.host.getModifiedTime(ts.getNormalizedAbsolutePath(entry.buildInfo.program.latestChangedDtsFile, ts.getDirectoryPath(entry.path))) :
|
|
126628
|
+
undefined;
|
|
126629
|
+
entry.latestChangedDtsTime = latestChangedDtsTime || false;
|
|
126630
|
+
return latestChangedDtsTime;
|
|
126559
126631
|
}
|
|
126560
126632
|
function updateOutputTimestamps(state, proj, resolvedPath) {
|
|
126561
126633
|
if (state.options.dry) {
|
|
@@ -126564,7 +126636,6 @@ var ts;
|
|
|
126564
126636
|
updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
|
|
126565
126637
|
state.projectStatus.set(resolvedPath, {
|
|
126566
126638
|
type: ts.UpToDateStatusType.UpToDate,
|
|
126567
|
-
newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
|
|
126568
126639
|
oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
|
|
126569
126640
|
});
|
|
126570
126641
|
}
|