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/tsserverlibrary.js
CHANGED
|
@@ -303,7 +303,7 @@ var ts;
|
|
|
303
303
|
// The following is baselined as a literal template type without intervention
|
|
304
304
|
/** The version of the TypeScript compiler release */
|
|
305
305
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
306
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
306
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220704";
|
|
307
307
|
/* @internal */
|
|
308
308
|
var Comparison;
|
|
309
309
|
(function (Comparison) {
|
|
@@ -5470,9 +5470,10 @@ var ts;
|
|
|
5470
5470
|
(function (TypeMapKind) {
|
|
5471
5471
|
TypeMapKind[TypeMapKind["Simple"] = 0] = "Simple";
|
|
5472
5472
|
TypeMapKind[TypeMapKind["Array"] = 1] = "Array";
|
|
5473
|
-
TypeMapKind[TypeMapKind["
|
|
5474
|
-
TypeMapKind[TypeMapKind["
|
|
5475
|
-
TypeMapKind[TypeMapKind["
|
|
5473
|
+
TypeMapKind[TypeMapKind["Deferred"] = 2] = "Deferred";
|
|
5474
|
+
TypeMapKind[TypeMapKind["Function"] = 3] = "Function";
|
|
5475
|
+
TypeMapKind[TypeMapKind["Composite"] = 4] = "Composite";
|
|
5476
|
+
TypeMapKind[TypeMapKind["Merged"] = 5] = "Merged";
|
|
5476
5477
|
})(TypeMapKind = ts.TypeMapKind || (ts.TypeMapKind = {}));
|
|
5477
5478
|
var InferencePriority;
|
|
5478
5479
|
(function (InferencePriority) {
|
|
@@ -48875,6 +48876,24 @@ var ts;
|
|
|
48875
48876
|
var Symbol = ts.objectAllocator.getSymbolConstructor();
|
|
48876
48877
|
var Type = ts.objectAllocator.getTypeConstructor();
|
|
48877
48878
|
var Signature = ts.objectAllocator.getSignatureConstructor();
|
|
48879
|
+
var DebugTypeMapper = /** @class */ (function () {
|
|
48880
|
+
function DebugTypeMapper() {
|
|
48881
|
+
}
|
|
48882
|
+
DebugTypeMapper.prototype.__debugToString = function () {
|
|
48883
|
+
var _a;
|
|
48884
|
+
ts.Debug.type(this);
|
|
48885
|
+
switch (this.kind) {
|
|
48886
|
+
case 3 /* Function */: return ((_a = this.debugInfo) === null || _a === void 0 ? void 0 : _a.call(this)) || "(function mapper)";
|
|
48887
|
+
case 0 /* Simple */: return this.source.__debugTypeToString() + " -> " + this.target.__debugTypeToString();
|
|
48888
|
+
case 1 /* Array */: return ts.zipWith(this.sources, this.targets || ts.map(this.sources, function () { return anyType; }), function (s, t) { return s.__debugTypeToString() + " -> " + t.__debugTypeToString(); }).join(", ");
|
|
48889
|
+
case 2 /* Deferred */: return ts.zipWith(this.sources, this.targets, function (s, t) { return s.__debugTypeToString() + " -> " + t().__debugTypeToString(); }).join(", ");
|
|
48890
|
+
case 5 /* Merged */:
|
|
48891
|
+
case 4 /* Composite */: return "m1: " + this.mapper1.__debugToString().split("\n").join("\n ") + "\nm2: " + this.mapper2.__debugToString().split("\n").join("\n ");
|
|
48892
|
+
default: return ts.Debug.assertNever(this);
|
|
48893
|
+
}
|
|
48894
|
+
};
|
|
48895
|
+
return DebugTypeMapper;
|
|
48896
|
+
}());
|
|
48878
48897
|
var typeCount = 0;
|
|
48879
48898
|
var symbolCount = 0;
|
|
48880
48899
|
var enumCount = 0;
|
|
@@ -49335,10 +49354,23 @@ var ts;
|
|
|
49335
49354
|
var numberOrBigIntType = getUnionType([numberType, bigintType]);
|
|
49336
49355
|
var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
|
|
49337
49356
|
var numericStringType = getTemplateLiteralType(["", ""], [numberType]); // The `${number}` type
|
|
49338
|
-
var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; });
|
|
49339
|
-
var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? wildcardType : t; });
|
|
49357
|
+
var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; }, function () { return "(restrictive mapper)"; });
|
|
49358
|
+
var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? wildcardType : t; }, function () { return "(permissive mapper)"; });
|
|
49340
49359
|
var uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never"); // `uniqueLiteralType` is a special `never` flagged by union reduction to behave as a literal
|
|
49341
|
-
var uniqueLiteralMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? uniqueLiteralType : t; }); // replace all type parameters with the unique literal type (disregarding constraints)
|
|
49360
|
+
var uniqueLiteralMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? uniqueLiteralType : t; }, function () { return "(unique literal mapper)"; }); // replace all type parameters with the unique literal type (disregarding constraints)
|
|
49361
|
+
var outofbandVarianceMarkerHandler;
|
|
49362
|
+
var reportUnreliableMapper = makeFunctionTypeMapper(function (t) {
|
|
49363
|
+
if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
|
|
49364
|
+
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ true);
|
|
49365
|
+
}
|
|
49366
|
+
return t;
|
|
49367
|
+
}, function () { return "(unmeasurable reporter)"; });
|
|
49368
|
+
var reportUnmeasurableMapper = makeFunctionTypeMapper(function (t) {
|
|
49369
|
+
if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
|
|
49370
|
+
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ false);
|
|
49371
|
+
}
|
|
49372
|
+
return t;
|
|
49373
|
+
}, function () { return "(unreliable reporter)"; });
|
|
49342
49374
|
var emptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49343
49375
|
var emptyJsxObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49344
49376
|
emptyJsxObjectType.objectFlags |= 2048 /* JsxAttributes */;
|
|
@@ -49498,7 +49530,6 @@ var ts;
|
|
|
49498
49530
|
var typeofType = createTypeofType();
|
|
49499
49531
|
var _jsxNamespace;
|
|
49500
49532
|
var _jsxFactoryEntity;
|
|
49501
|
-
var outofbandVarianceMarkerHandler;
|
|
49502
49533
|
var subtypeRelation = new ts.Map();
|
|
49503
49534
|
var strictSubtypeRelation = new ts.Map();
|
|
49504
49535
|
var assignableRelation = new ts.Map();
|
|
@@ -53265,7 +53296,7 @@ var ts;
|
|
|
53265
53296
|
var name = typeParameterToName(newParam, context);
|
|
53266
53297
|
var newTypeVariable = ts.factory.createTypeReferenceNode(name);
|
|
53267
53298
|
context.approximateLength += 37; // 15 each for two added conditionals, 7 for an added infer type
|
|
53268
|
-
var newMapper = prependTypeMapping(type.root.checkType, newParam, type.
|
|
53299
|
+
var newMapper = prependTypeMapping(type.root.checkType, newParam, type.mapper);
|
|
53269
53300
|
var saveInferTypeParameters_1 = context.inferTypeParameters;
|
|
53270
53301
|
context.inferTypeParameters = type.root.inferTypeParameters;
|
|
53271
53302
|
var extendsTypeNode_1 = typeToTypeNodeHelper(instantiateType(type.root.extendsType, newMapper), context);
|
|
@@ -60676,8 +60707,7 @@ var ts;
|
|
|
60676
60707
|
var _a;
|
|
60677
60708
|
var inferences;
|
|
60678
60709
|
if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
|
|
60679
|
-
|
|
60680
|
-
var declaration = _b[_i];
|
|
60710
|
+
var _loop_15 = function (declaration) {
|
|
60681
60711
|
if (declaration.parent.kind === 190 /* InferType */) {
|
|
60682
60712
|
// When an 'infer T' declaration is immediately contained in a type reference node
|
|
60683
60713
|
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
|
|
@@ -60685,12 +60715,12 @@ var ts;
|
|
|
60685
60715
|
// present, we form an intersection of the inferred constraint types.
|
|
60686
60716
|
var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1];
|
|
60687
60717
|
if (grandParent.kind === 178 /* TypeReference */ && !omitTypeReferences) {
|
|
60688
|
-
var
|
|
60689
|
-
var
|
|
60690
|
-
if (
|
|
60691
|
-
var index =
|
|
60692
|
-
if (index <
|
|
60693
|
-
var declaredConstraint = getConstraintOfTypeParameter(
|
|
60718
|
+
var typeReference_1 = grandParent;
|
|
60719
|
+
var typeParameters_1 = getTypeParametersForTypeReference(typeReference_1);
|
|
60720
|
+
if (typeParameters_1) {
|
|
60721
|
+
var index = typeReference_1.typeArguments.indexOf(childTypeParameter);
|
|
60722
|
+
if (index < typeParameters_1.length) {
|
|
60723
|
+
var declaredConstraint = getConstraintOfTypeParameter(typeParameters_1[index]);
|
|
60694
60724
|
if (declaredConstraint) {
|
|
60695
60725
|
// Type parameter constraints can reference other type parameters so
|
|
60696
60726
|
// constraints need to be instantiated. If instantiation produces the
|
|
@@ -60698,7 +60728,9 @@ var ts;
|
|
|
60698
60728
|
// type Foo<T extends string, U extends T> = [T, U];
|
|
60699
60729
|
// type Bar<T> = T extends Foo<infer X, infer X> ? Foo<X, X> : T;
|
|
60700
60730
|
// the instantiated constraint for U is X, so we discard that inference.
|
|
60701
|
-
var mapper =
|
|
60731
|
+
var mapper = makeDeferredTypeMapper(typeParameters_1, typeParameters_1.map(function (_, index) { return function () {
|
|
60732
|
+
return getEffectiveTypeArgumentAtIndex(typeReference_1, typeParameters_1, index);
|
|
60733
|
+
}; }));
|
|
60702
60734
|
var constraint = instantiateType(declaredConstraint, mapper);
|
|
60703
60735
|
if (constraint !== typeParameter) {
|
|
60704
60736
|
inferences = ts.append(inferences, constraint);
|
|
@@ -60736,6 +60768,10 @@ var ts;
|
|
|
60736
60768
|
inferences = ts.append(inferences, instantiateType(nodeType, makeUnaryTypeMapper(getDeclaredTypeOfTypeParameter(getSymbolOfNode(checkMappedType_1.typeParameter)), checkMappedType_1.typeParameter.constraint ? getTypeFromTypeNode(checkMappedType_1.typeParameter.constraint) : keyofConstraintType)));
|
|
60737
60769
|
}
|
|
60738
60770
|
}
|
|
60771
|
+
};
|
|
60772
|
+
for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
|
|
60773
|
+
var declaration = _b[_i];
|
|
60774
|
+
_loop_15(declaration);
|
|
60739
60775
|
}
|
|
60740
60776
|
}
|
|
60741
60777
|
return inferences && getIntersectionType(inferences);
|
|
@@ -61624,7 +61660,7 @@ var ts;
|
|
|
61624
61660
|
var lastRequiredIndex = -1;
|
|
61625
61661
|
var firstRestIndex = -1;
|
|
61626
61662
|
var lastOptionalOrRestIndex = -1;
|
|
61627
|
-
var
|
|
61663
|
+
var _loop_16 = function (i) {
|
|
61628
61664
|
var type = elementTypes[i];
|
|
61629
61665
|
var flags = target.elementFlags[i];
|
|
61630
61666
|
if (flags & 8 /* Variadic */) {
|
|
@@ -61654,7 +61690,7 @@ var ts;
|
|
|
61654
61690
|
}
|
|
61655
61691
|
};
|
|
61656
61692
|
for (var i = 0; i < elementTypes.length; i++) {
|
|
61657
|
-
var state_4 =
|
|
61693
|
+
var state_4 = _loop_16(i);
|
|
61658
61694
|
if (typeof state_4 === "object")
|
|
61659
61695
|
return state_4.value;
|
|
61660
61696
|
}
|
|
@@ -61850,7 +61886,7 @@ var ts;
|
|
|
61850
61886
|
var templates = ts.filter(types, isPatternLiteralType);
|
|
61851
61887
|
if (templates.length) {
|
|
61852
61888
|
var i = types.length;
|
|
61853
|
-
var
|
|
61889
|
+
var _loop_17 = function () {
|
|
61854
61890
|
i--;
|
|
61855
61891
|
var t = types[i];
|
|
61856
61892
|
if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
|
|
@@ -61858,7 +61894,7 @@ var ts;
|
|
|
61858
61894
|
}
|
|
61859
61895
|
};
|
|
61860
61896
|
while (i > 0) {
|
|
61861
|
-
|
|
61897
|
+
_loop_17();
|
|
61862
61898
|
}
|
|
61863
61899
|
}
|
|
61864
61900
|
}
|
|
@@ -61935,14 +61971,14 @@ var ts;
|
|
|
61935
61971
|
var namedUnions = [];
|
|
61936
61972
|
addNamedUnions(namedUnions, types);
|
|
61937
61973
|
var reducedTypes = [];
|
|
61938
|
-
var
|
|
61974
|
+
var _loop_18 = function (t) {
|
|
61939
61975
|
if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
|
|
61940
61976
|
reducedTypes.push(t);
|
|
61941
61977
|
}
|
|
61942
61978
|
};
|
|
61943
61979
|
for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
|
|
61944
61980
|
var t = typeSet_1[_i];
|
|
61945
|
-
|
|
61981
|
+
_loop_18(t);
|
|
61946
61982
|
}
|
|
61947
61983
|
if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
|
|
61948
61984
|
return namedUnions[0];
|
|
@@ -63166,7 +63202,7 @@ var ts;
|
|
|
63166
63202
|
var result;
|
|
63167
63203
|
var extraTypes;
|
|
63168
63204
|
var tailCount = 0;
|
|
63169
|
-
var
|
|
63205
|
+
var _loop_19 = function () {
|
|
63170
63206
|
if (tailCount === 1000) {
|
|
63171
63207
|
error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
63172
63208
|
result = errorType;
|
|
@@ -63287,7 +63323,7 @@ var ts;
|
|
|
63287
63323
|
// another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
|
|
63288
63324
|
// cases we increment the tail recursion counter and stop after 1000 iterations.
|
|
63289
63325
|
while (true) {
|
|
63290
|
-
var state_5 =
|
|
63326
|
+
var state_5 = _loop_19();
|
|
63291
63327
|
if (typeof state_5 === "object")
|
|
63292
63328
|
return state_5.value;
|
|
63293
63329
|
if (state_5 === "break")
|
|
@@ -63917,7 +63953,7 @@ var ts;
|
|
|
63917
63953
|
switch (mapper.kind) {
|
|
63918
63954
|
case 0 /* Simple */:
|
|
63919
63955
|
return type === mapper.source ? mapper.target : type;
|
|
63920
|
-
case 1 /* Array */:
|
|
63956
|
+
case 1 /* Array */: {
|
|
63921
63957
|
var sources = mapper.sources;
|
|
63922
63958
|
var targets = mapper.targets;
|
|
63923
63959
|
for (var i = 0; i < sources.length; i++) {
|
|
@@ -63926,25 +63962,45 @@ var ts;
|
|
|
63926
63962
|
}
|
|
63927
63963
|
}
|
|
63928
63964
|
return type;
|
|
63929
|
-
|
|
63965
|
+
}
|
|
63966
|
+
case 2 /* Deferred */: {
|
|
63967
|
+
var sources = mapper.sources;
|
|
63968
|
+
var targets = mapper.targets;
|
|
63969
|
+
for (var i = 0; i < sources.length; i++) {
|
|
63970
|
+
if (type === sources[i]) {
|
|
63971
|
+
return targets[i]();
|
|
63972
|
+
}
|
|
63973
|
+
}
|
|
63974
|
+
return type;
|
|
63975
|
+
}
|
|
63976
|
+
case 3 /* Function */:
|
|
63930
63977
|
return mapper.func(type);
|
|
63931
|
-
case
|
|
63932
|
-
case
|
|
63978
|
+
case 4 /* Composite */:
|
|
63979
|
+
case 5 /* Merged */:
|
|
63933
63980
|
var t1 = getMappedType(type, mapper.mapper1);
|
|
63934
|
-
return t1 !== type && mapper.kind ===
|
|
63981
|
+
return t1 !== type && mapper.kind === 4 /* Composite */ ? instantiateType(t1, mapper.mapper2) : getMappedType(t1, mapper.mapper2);
|
|
63935
63982
|
}
|
|
63936
63983
|
}
|
|
63984
|
+
function attachDebugPrototypeIfDebug(mapper) {
|
|
63985
|
+
if (ts.Debug.isDebugging) {
|
|
63986
|
+
return Object.setPrototypeOf(mapper, DebugTypeMapper.prototype);
|
|
63987
|
+
}
|
|
63988
|
+
return mapper;
|
|
63989
|
+
}
|
|
63937
63990
|
function makeUnaryTypeMapper(source, target) {
|
|
63938
|
-
return { kind: 0 /* Simple */, source: source, target: target };
|
|
63991
|
+
return attachDebugPrototypeIfDebug({ kind: 0 /* Simple */, source: source, target: target });
|
|
63939
63992
|
}
|
|
63940
63993
|
function makeArrayTypeMapper(sources, targets) {
|
|
63941
|
-
return { kind: 1 /* Array */, sources: sources, targets: targets };
|
|
63994
|
+
return attachDebugPrototypeIfDebug({ kind: 1 /* Array */, sources: sources, targets: targets });
|
|
63942
63995
|
}
|
|
63943
|
-
function makeFunctionTypeMapper(func) {
|
|
63944
|
-
return { kind:
|
|
63996
|
+
function makeFunctionTypeMapper(func, debugInfo) {
|
|
63997
|
+
return attachDebugPrototypeIfDebug({ kind: 3 /* Function */, func: func, debugInfo: ts.Debug.isDebugging ? debugInfo : undefined });
|
|
63998
|
+
}
|
|
63999
|
+
function makeDeferredTypeMapper(sources, targets) {
|
|
64000
|
+
return attachDebugPrototypeIfDebug({ kind: 2 /* Deferred */, sources: sources, targets: targets });
|
|
63945
64001
|
}
|
|
63946
64002
|
function makeCompositeTypeMapper(kind, mapper1, mapper2) {
|
|
63947
|
-
return { kind: kind, mapper1: mapper1, mapper2: mapper2 };
|
|
64003
|
+
return attachDebugPrototypeIfDebug({ kind: kind, mapper1: mapper1, mapper2: mapper2 });
|
|
63948
64004
|
}
|
|
63949
64005
|
function createTypeEraser(sources) {
|
|
63950
64006
|
return createTypeMapper(sources, /*targets*/ undefined);
|
|
@@ -63954,19 +64010,20 @@ var ts;
|
|
|
63954
64010
|
* This is used during inference when instantiating type parameter defaults.
|
|
63955
64011
|
*/
|
|
63956
64012
|
function createBackreferenceMapper(context, index) {
|
|
63957
|
-
|
|
64013
|
+
var forwardInferences = context.inferences.slice(index);
|
|
64014
|
+
return createTypeMapper(ts.map(forwardInferences, function (i) { return i.typeParameter; }), ts.map(forwardInferences, function () { return unknownType; }));
|
|
63958
64015
|
}
|
|
63959
64016
|
function combineTypeMappers(mapper1, mapper2) {
|
|
63960
|
-
return mapper1 ? makeCompositeTypeMapper(
|
|
64017
|
+
return mapper1 ? makeCompositeTypeMapper(4 /* Composite */, mapper1, mapper2) : mapper2;
|
|
63961
64018
|
}
|
|
63962
64019
|
function mergeTypeMappers(mapper1, mapper2) {
|
|
63963
|
-
return mapper1 ? makeCompositeTypeMapper(
|
|
64020
|
+
return mapper1 ? makeCompositeTypeMapper(5 /* Merged */, mapper1, mapper2) : mapper2;
|
|
63964
64021
|
}
|
|
63965
64022
|
function prependTypeMapping(source, target, mapper) {
|
|
63966
|
-
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(
|
|
64023
|
+
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* Merged */, makeUnaryTypeMapper(source, target), mapper);
|
|
63967
64024
|
}
|
|
63968
64025
|
function appendTypeMapping(mapper, source, target) {
|
|
63969
|
-
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(
|
|
64026
|
+
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* Merged */, mapper, makeUnaryTypeMapper(source, target));
|
|
63970
64027
|
}
|
|
63971
64028
|
function getRestrictiveTypeParameter(tp) {
|
|
63972
64029
|
return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol),
|
|
@@ -65862,7 +65919,7 @@ var ts;
|
|
|
65862
65919
|
reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
|
|
65863
65920
|
checkTypes = reducedTarget.flags & 1048576 /* Union */ ? reducedTarget.types : [reducedTarget];
|
|
65864
65921
|
}
|
|
65865
|
-
var
|
|
65922
|
+
var _loop_20 = function (prop) {
|
|
65866
65923
|
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
|
|
65867
65924
|
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
|
|
65868
65925
|
if (reportErrors) {
|
|
@@ -65925,7 +65982,7 @@ var ts;
|
|
|
65925
65982
|
};
|
|
65926
65983
|
for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
|
|
65927
65984
|
var prop = _b[_i];
|
|
65928
|
-
var state_6 =
|
|
65985
|
+
var state_6 = _loop_20(prop);
|
|
65929
65986
|
if (typeof state_6 === "object")
|
|
65930
65987
|
return state_6.value;
|
|
65931
65988
|
}
|
|
@@ -66157,10 +66214,10 @@ var ts;
|
|
|
66157
66214
|
// We're in the middle of variance checking - integrate any unmeasurable/unreliable flags from this cached component
|
|
66158
66215
|
var saved = entry & 24 /* ReportsMask */;
|
|
66159
66216
|
if (saved & 8 /* ReportsUnmeasurable */) {
|
|
66160
|
-
instantiateType(source,
|
|
66217
|
+
instantiateType(source, reportUnmeasurableMapper);
|
|
66161
66218
|
}
|
|
66162
66219
|
if (saved & 16 /* ReportsUnreliable */) {
|
|
66163
|
-
instantiateType(source,
|
|
66220
|
+
instantiateType(source, reportUnreliableMapper);
|
|
66164
66221
|
}
|
|
66165
66222
|
}
|
|
66166
66223
|
return entry & 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */;
|
|
@@ -66586,7 +66643,7 @@ var ts;
|
|
|
66586
66643
|
}
|
|
66587
66644
|
// Report unreliable variance for type variables referenced in template literal type placeholders.
|
|
66588
66645
|
// For example, `foo-${number}` is related to `foo-${string}` even though number isn't related to string.
|
|
66589
|
-
instantiateType(source,
|
|
66646
|
+
instantiateType(source, reportUnreliableMapper);
|
|
66590
66647
|
}
|
|
66591
66648
|
if (isTypeMatchedByTemplateLiteralType(source, target)) {
|
|
66592
66649
|
return -1 /* True */;
|
|
@@ -66858,18 +66915,6 @@ var ts;
|
|
|
66858
66915
|
}
|
|
66859
66916
|
}
|
|
66860
66917
|
}
|
|
66861
|
-
function reportUnmeasurableMarkers(p) {
|
|
66862
|
-
if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
|
|
66863
|
-
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ false);
|
|
66864
|
-
}
|
|
66865
|
-
return p;
|
|
66866
|
-
}
|
|
66867
|
-
function reportUnreliableMarkers(p) {
|
|
66868
|
-
if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
|
|
66869
|
-
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ true);
|
|
66870
|
-
}
|
|
66871
|
-
return p;
|
|
66872
|
-
}
|
|
66873
66918
|
// A type [P in S]: X is related to a type [Q in T]: Y if T is related to S and X' is
|
|
66874
66919
|
// related to Y, where X' is an instantiation of X in which P is replaced with Q. Notice
|
|
66875
66920
|
// that S and T are contra-variant whereas X and Y are co-variant.
|
|
@@ -66879,7 +66924,7 @@ var ts;
|
|
|
66879
66924
|
if (modifiersRelated) {
|
|
66880
66925
|
var result_10;
|
|
66881
66926
|
var targetConstraint = getConstraintTypeFromMappedType(target);
|
|
66882
|
-
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source),
|
|
66927
|
+
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMapper : reportUnreliableMapper);
|
|
66883
66928
|
if (result_10 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
|
|
66884
66929
|
var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
|
|
66885
66930
|
if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
|
|
@@ -66933,11 +66978,11 @@ var ts;
|
|
|
66933
66978
|
// constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
|
|
66934
66979
|
var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
|
|
66935
66980
|
var matchingTypes = [];
|
|
66936
|
-
var
|
|
66981
|
+
var _loop_21 = function (combination) {
|
|
66937
66982
|
var hasMatch = false;
|
|
66938
66983
|
outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
|
|
66939
66984
|
var type = _d[_c];
|
|
66940
|
-
var
|
|
66985
|
+
var _loop_22 = function (i) {
|
|
66941
66986
|
var sourceProperty = sourcePropertiesFiltered[i];
|
|
66942
66987
|
var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
|
|
66943
66988
|
if (!targetProperty)
|
|
@@ -66953,7 +66998,7 @@ var ts;
|
|
|
66953
66998
|
}
|
|
66954
66999
|
};
|
|
66955
67000
|
for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
|
|
66956
|
-
var state_8 =
|
|
67001
|
+
var state_8 = _loop_22(i);
|
|
66957
67002
|
switch (state_8) {
|
|
66958
67003
|
case "continue-outer": continue outer;
|
|
66959
67004
|
}
|
|
@@ -66967,7 +67012,7 @@ var ts;
|
|
|
66967
67012
|
};
|
|
66968
67013
|
for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
|
|
66969
67014
|
var combination = discriminantCombinations_1[_a];
|
|
66970
|
-
var state_7 =
|
|
67015
|
+
var state_7 = _loop_21(combination);
|
|
66971
67016
|
if (typeof state_7 === "object")
|
|
66972
67017
|
return state_7.value;
|
|
66973
67018
|
}
|
|
@@ -67415,7 +67460,7 @@ var ts;
|
|
|
67415
67460
|
* See signatureAssignableTo, compareSignaturesIdentical
|
|
67416
67461
|
*/
|
|
67417
67462
|
function signatureRelatedTo(source, target, erase, reportErrors, incompatibleReporter) {
|
|
67418
|
-
return compareSignaturesRelated(erase ? getErasedSignature(source) : source, erase ? getErasedSignature(target) : target, relation === strictSubtypeRelation ? 8 /* StrictArity */ : 0, reportErrors, reportError, incompatibleReporter, isRelatedToWorker,
|
|
67463
|
+
return compareSignaturesRelated(erase ? getErasedSignature(source) : source, erase ? getErasedSignature(target) : target, relation === strictSubtypeRelation ? 8 /* StrictArity */ : 0, reportErrors, reportError, incompatibleReporter, isRelatedToWorker, reportUnreliableMapper);
|
|
67419
67464
|
}
|
|
67420
67465
|
function signaturesIdenticalTo(source, target, kind) {
|
|
67421
67466
|
var sourceSignatures = getSignaturesOfType(source, kind);
|
|
@@ -67674,7 +67719,7 @@ var ts;
|
|
|
67674
67719
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
|
|
67675
67720
|
links.variances = ts.emptyArray;
|
|
67676
67721
|
var variances = [];
|
|
67677
|
-
var
|
|
67722
|
+
var _loop_23 = function (tp) {
|
|
67678
67723
|
var modifiers = getVarianceModifiers(tp);
|
|
67679
67724
|
var variance = modifiers & 65536 /* Out */ ?
|
|
67680
67725
|
modifiers & 32768 /* In */ ? 0 /* Invariant */ : 1 /* Covariant */ :
|
|
@@ -67710,9 +67755,9 @@ var ts;
|
|
|
67710
67755
|
}
|
|
67711
67756
|
variances.push(variance);
|
|
67712
67757
|
};
|
|
67713
|
-
for (var _i = 0,
|
|
67714
|
-
var tp =
|
|
67715
|
-
|
|
67758
|
+
for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
|
|
67759
|
+
var tp = typeParameters_2[_i];
|
|
67760
|
+
_loop_23(tp);
|
|
67716
67761
|
}
|
|
67717
67762
|
links.variances = variances;
|
|
67718
67763
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
|
|
@@ -68707,27 +68752,29 @@ var ts;
|
|
|
68707
68752
|
signature: signature,
|
|
68708
68753
|
flags: flags,
|
|
68709
68754
|
compareTypes: compareTypes,
|
|
68710
|
-
mapper:
|
|
68711
|
-
nonFixingMapper:
|
|
68755
|
+
mapper: reportUnmeasurableMapper,
|
|
68756
|
+
nonFixingMapper: reportUnmeasurableMapper,
|
|
68712
68757
|
};
|
|
68758
|
+
context.mapper = makeFixingMapperForContext(context);
|
|
68759
|
+
context.nonFixingMapper = makeNonFixingMapperForContext(context);
|
|
68713
68760
|
return context;
|
|
68714
68761
|
}
|
|
68715
|
-
function
|
|
68716
|
-
|
|
68717
|
-
|
|
68718
|
-
|
|
68719
|
-
|
|
68720
|
-
|
|
68721
|
-
|
|
68722
|
-
|
|
68723
|
-
inferFromIntraExpressionSites(context);
|
|
68724
|
-
clearCachedInferences(inferences);
|
|
68725
|
-
inference.isFixed = true;
|
|
68726
|
-
}
|
|
68727
|
-
return getInferredType(context, i);
|
|
68762
|
+
function makeFixingMapperForContext(context) {
|
|
68763
|
+
return makeDeferredTypeMapper(ts.map(context.inferences, function (i) { return i.typeParameter; }), ts.map(context.inferences, function (inference, i) { return function () {
|
|
68764
|
+
if (!inference.isFixed) {
|
|
68765
|
+
// Before we commit to a particular inference (and thus lock out any further inferences),
|
|
68766
|
+
// we infer from any intra-expression inference sites we have collected.
|
|
68767
|
+
inferFromIntraExpressionSites(context);
|
|
68768
|
+
clearCachedInferences(context.inferences);
|
|
68769
|
+
inference.isFixed = true;
|
|
68728
68770
|
}
|
|
68729
|
-
|
|
68730
|
-
|
|
68771
|
+
return getInferredType(context, i);
|
|
68772
|
+
}; }));
|
|
68773
|
+
}
|
|
68774
|
+
function makeNonFixingMapperForContext(context) {
|
|
68775
|
+
return makeDeferredTypeMapper(ts.map(context.inferences, function (i) { return i.typeParameter; }), ts.map(context.inferences, function (_, i) { return function () {
|
|
68776
|
+
return getInferredType(context, i);
|
|
68777
|
+
}; }));
|
|
68731
68778
|
}
|
|
68732
68779
|
function clearCachedInferences(inferences) {
|
|
68733
68780
|
for (var _i = 0, inferences_1 = inferences; _i < inferences_1.length; _i++) {
|
|
@@ -69647,7 +69694,7 @@ var ts;
|
|
|
69647
69694
|
// upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
|
|
69648
69695
|
// succeed. That would be a pointless and confusing outcome.
|
|
69649
69696
|
if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
|
|
69650
|
-
var
|
|
69697
|
+
var _loop_24 = function (i) {
|
|
69651
69698
|
var source_1 = matches ? matches[i] : neverType;
|
|
69652
69699
|
var target_3 = types[i];
|
|
69653
69700
|
// If we are inferring from a string literal type to a type variable whose constraint includes one of the
|
|
@@ -69697,7 +69744,7 @@ var ts;
|
|
|
69697
69744
|
inferFromTypes(source_1, target_3);
|
|
69698
69745
|
};
|
|
69699
69746
|
for (var i = 0; i < types.length; i++) {
|
|
69700
|
-
|
|
69747
|
+
_loop_24(i);
|
|
69701
69748
|
}
|
|
69702
69749
|
}
|
|
69703
69750
|
}
|
|
@@ -70215,7 +70262,7 @@ var ts;
|
|
|
70215
70262
|
function mapTypesByKeyProperty(types, name) {
|
|
70216
70263
|
var map = new ts.Map();
|
|
70217
70264
|
var count = 0;
|
|
70218
|
-
var
|
|
70265
|
+
var _loop_25 = function (type) {
|
|
70219
70266
|
if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
70220
70267
|
var discriminant = getTypeOfPropertyOfType(type, name);
|
|
70221
70268
|
if (discriminant) {
|
|
@@ -70241,7 +70288,7 @@ var ts;
|
|
|
70241
70288
|
};
|
|
70242
70289
|
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
|
|
70243
70290
|
var type = types_15[_i];
|
|
70244
|
-
var state_9 =
|
|
70291
|
+
var state_9 = _loop_25(type);
|
|
70245
70292
|
if (typeof state_9 === "object")
|
|
70246
70293
|
return state_9.value;
|
|
70247
70294
|
}
|
|
@@ -76590,7 +76637,7 @@ var ts;
|
|
|
76590
76637
|
if (spreadIndex >= 0) {
|
|
76591
76638
|
// Create synthetic arguments from spreads of tuple types.
|
|
76592
76639
|
var effectiveArgs_1 = args.slice(0, spreadIndex);
|
|
76593
|
-
var
|
|
76640
|
+
var _loop_26 = function (i) {
|
|
76594
76641
|
var arg = args[i];
|
|
76595
76642
|
// We can call checkExpressionCached because spread expressions never have a contextual type.
|
|
76596
76643
|
var spreadType = arg.kind === 225 /* SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
|
|
@@ -76607,7 +76654,7 @@ var ts;
|
|
|
76607
76654
|
}
|
|
76608
76655
|
};
|
|
76609
76656
|
for (var i = spreadIndex; i < args.length; i++) {
|
|
76610
|
-
|
|
76657
|
+
_loop_26(i);
|
|
76611
76658
|
}
|
|
76612
76659
|
return effectiveArgs_1;
|
|
76613
76660
|
}
|
|
@@ -76936,7 +76983,7 @@ var ts;
|
|
|
76936
76983
|
var min_3 = Number.MAX_VALUE;
|
|
76937
76984
|
var minIndex = 0;
|
|
76938
76985
|
var i_1 = 0;
|
|
76939
|
-
var
|
|
76986
|
+
var _loop_27 = function (c) {
|
|
76940
76987
|
var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
|
|
76941
76988
|
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2);
|
|
76942
76989
|
if (diags_2) {
|
|
@@ -76954,7 +77001,7 @@ var ts;
|
|
|
76954
77001
|
};
|
|
76955
77002
|
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
|
|
76956
77003
|
var c = candidatesForArgumentError_1[_a];
|
|
76957
|
-
|
|
77004
|
+
_loop_27(c);
|
|
76958
77005
|
}
|
|
76959
77006
|
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
|
|
76960
77007
|
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
|
|
@@ -77112,7 +77159,7 @@ var ts;
|
|
|
77112
77159
|
}
|
|
77113
77160
|
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
|
|
77114
77161
|
var parameters = [];
|
|
77115
|
-
var
|
|
77162
|
+
var _loop_28 = function (i) {
|
|
77116
77163
|
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
|
|
77117
77164
|
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
|
|
77118
77165
|
i < s.parameters.length ? s.parameters[i] : undefined; });
|
|
@@ -77120,7 +77167,7 @@ var ts;
|
|
|
77120
77167
|
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
|
|
77121
77168
|
};
|
|
77122
77169
|
for (var i = 0; i < maxNonRestParam; i++) {
|
|
77123
|
-
|
|
77170
|
+
_loop_28(i);
|
|
77124
77171
|
}
|
|
77125
77172
|
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
|
|
77126
77173
|
var flags = 0 /* None */;
|
|
@@ -80473,8 +80520,8 @@ var ts;
|
|
|
80473
80520
|
var result = [];
|
|
80474
80521
|
var oldTypeParameters;
|
|
80475
80522
|
var newTypeParameters;
|
|
80476
|
-
for (var _i = 0,
|
|
80477
|
-
var tp =
|
|
80523
|
+
for (var _i = 0, typeParameters_3 = typeParameters; _i < typeParameters_3.length; _i++) {
|
|
80524
|
+
var tp = typeParameters_3[_i];
|
|
80478
80525
|
var name = tp.symbol.escapedName;
|
|
80479
80526
|
if (hasTypeParameterByName(context.inferredTypeParameters, name) || hasTypeParameterByName(result, name)) {
|
|
80480
80527
|
var newName = getUniqueTypeParameterName(ts.concatenate(context.inferredTypeParameters, result), name);
|
|
@@ -81153,7 +81200,7 @@ var ts;
|
|
|
81153
81200
|
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
|
|
81154
81201
|
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
|
|
81155
81202
|
var indexSignatureMap_1 = new ts.Map();
|
|
81156
|
-
var
|
|
81203
|
+
var _loop_29 = function (declaration) {
|
|
81157
81204
|
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
|
|
81158
81205
|
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
|
|
81159
81206
|
var entry = indexSignatureMap_1.get(getTypeId(type));
|
|
@@ -81168,7 +81215,7 @@ var ts;
|
|
|
81168
81215
|
};
|
|
81169
81216
|
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
|
|
81170
81217
|
var declaration = _a[_i];
|
|
81171
|
-
|
|
81218
|
+
_loop_29(declaration);
|
|
81172
81219
|
}
|
|
81173
81220
|
indexSignatureMap_1.forEach(function (entry) {
|
|
81174
81221
|
if (entry.declarations.length > 1) {
|
|
@@ -81391,6 +81438,12 @@ var ts;
|
|
|
81391
81438
|
function checkMissingDeclaration(node) {
|
|
81392
81439
|
checkDecorators(node);
|
|
81393
81440
|
}
|
|
81441
|
+
function getEffectiveTypeArgumentAtIndex(node, typeParameters, index) {
|
|
81442
|
+
if (index < typeParameters.length) {
|
|
81443
|
+
return getTypeFromTypeNode(node.typeArguments[index]);
|
|
81444
|
+
}
|
|
81445
|
+
return getEffectiveTypeArguments(node, typeParameters)[index];
|
|
81446
|
+
}
|
|
81394
81447
|
function getEffectiveTypeArguments(node, typeParameters) {
|
|
81395
81448
|
return fillMissingTypeArguments(ts.map(node.typeArguments, getTypeFromTypeNode), typeParameters, getMinTypeArgumentCount(typeParameters), ts.isInJSFile(node));
|
|
81396
81449
|
}
|
|
@@ -82132,6 +82185,32 @@ var ts;
|
|
|
82132
82185
|
isAwaitedTypeInstantiation(type) ? type.aliasTypeArguments[0] :
|
|
82133
82186
|
type;
|
|
82134
82187
|
}
|
|
82188
|
+
function isAwaitedTypeNeeded(type) {
|
|
82189
|
+
// If this is already an `Awaited<T>`, we shouldn't wrap it. This helps to avoid `Awaited<Awaited<T>>` in higher-order.
|
|
82190
|
+
if (isTypeAny(type) || isAwaitedTypeInstantiation(type)) {
|
|
82191
|
+
return false;
|
|
82192
|
+
}
|
|
82193
|
+
// We only need `Awaited<T>` if `T` contains possibly non-primitive types.
|
|
82194
|
+
if (isGenericObjectType(type)) {
|
|
82195
|
+
var baseConstraint = getBaseConstraintOfType(type);
|
|
82196
|
+
// We only need `Awaited<T>` if `T` has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
|
|
82197
|
+
// or is promise-like.
|
|
82198
|
+
if (!baseConstraint || (baseConstraint.flags & 3 /* AnyOrUnknown */) || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint)) {
|
|
82199
|
+
return true;
|
|
82200
|
+
}
|
|
82201
|
+
}
|
|
82202
|
+
return false;
|
|
82203
|
+
}
|
|
82204
|
+
function tryCreateAwaitedType(type) {
|
|
82205
|
+
// Nothing to do if `Awaited<T>` doesn't exist
|
|
82206
|
+
var awaitedSymbol = getGlobalAwaitedSymbol(/*reportErrors*/ true);
|
|
82207
|
+
if (awaitedSymbol) {
|
|
82208
|
+
// Unwrap unions that may contain `Awaited<T>`, otherwise its possible to manufacture an `Awaited<Awaited<T> | U>` where
|
|
82209
|
+
// an `Awaited<T | U>` would suffice.
|
|
82210
|
+
return getTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
|
|
82211
|
+
}
|
|
82212
|
+
return undefined;
|
|
82213
|
+
}
|
|
82135
82214
|
function createAwaitedTypeIfNeeded(type) {
|
|
82136
82215
|
// We wrap type `T` in `Awaited<T>` based on the following conditions:
|
|
82137
82216
|
// - `T` is not already an `Awaited<U>`, and
|
|
@@ -82140,26 +82219,10 @@ var ts;
|
|
|
82140
82219
|
// - `T` has no base constraint, or
|
|
82141
82220
|
// - The base constraint of `T` is `any`, `unknown`, `object`, or `{}`, or
|
|
82142
82221
|
// - The base constraint of `T` is an object type with a callable `then` method.
|
|
82143
|
-
if (
|
|
82144
|
-
|
|
82145
|
-
|
|
82146
|
-
|
|
82147
|
-
if (isAwaitedTypeInstantiation(type)) {
|
|
82148
|
-
return type;
|
|
82149
|
-
}
|
|
82150
|
-
// Only instantiate `Awaited<T>` if `T` contains possibly non-primitive types.
|
|
82151
|
-
if (isGenericObjectType(type)) {
|
|
82152
|
-
var baseConstraint = getBaseConstraintOfType(type);
|
|
82153
|
-
// Only instantiate `Awaited<T>` if `T` has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
|
|
82154
|
-
// or is promise-like.
|
|
82155
|
-
if (!baseConstraint || (baseConstraint.flags & 3 /* AnyOrUnknown */) || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint)) {
|
|
82156
|
-
// Nothing to do if `Awaited<T>` doesn't exist
|
|
82157
|
-
var awaitedSymbol = getGlobalAwaitedSymbol(/*reportErrors*/ true);
|
|
82158
|
-
if (awaitedSymbol) {
|
|
82159
|
-
// Unwrap unions that may contain `Awaited<T>`, otherwise its possible to manufacture an `Awaited<Awaited<T> | U>` where
|
|
82160
|
-
// an `Awaited<T | U>` would suffice.
|
|
82161
|
-
return getTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
|
|
82162
|
-
}
|
|
82222
|
+
if (isAwaitedTypeNeeded(type)) {
|
|
82223
|
+
var awaitedType = tryCreateAwaitedType(type);
|
|
82224
|
+
if (awaitedType) {
|
|
82225
|
+
return awaitedType;
|
|
82163
82226
|
}
|
|
82164
82227
|
}
|
|
82165
82228
|
ts.Debug.assert(getPromisedTypeOfPromise(type) === undefined, "type provided should not be a non-generic 'promise'-like.");
|
|
@@ -82211,6 +82274,10 @@ var ts;
|
|
|
82211
82274
|
awaitedTypeStack.pop();
|
|
82212
82275
|
return typeAsAwaitable.awaitedTypeOfType = mapped;
|
|
82213
82276
|
}
|
|
82277
|
+
// If `type` is generic and should be wrapped in `Awaited<T>`, return it.
|
|
82278
|
+
if (isAwaitedTypeNeeded(type)) {
|
|
82279
|
+
return typeAsAwaitable.awaitedTypeOfType = type;
|
|
82280
|
+
}
|
|
82214
82281
|
var thisTypeForErrorOut = { value: undefined };
|
|
82215
82282
|
var promisedType = getPromisedTypeOfPromise(type, /*errorNode*/ undefined, thisTypeForErrorOut);
|
|
82216
82283
|
if (promisedType) {
|
|
@@ -82858,8 +82925,8 @@ var ts;
|
|
|
82858
82925
|
return;
|
|
82859
82926
|
var typeParameters = ts.getEffectiveTypeParameterDeclarations(node);
|
|
82860
82927
|
var seenParentsWithEveryUnused = new ts.Set();
|
|
82861
|
-
for (var _i = 0,
|
|
82862
|
-
var typeParameter =
|
|
82928
|
+
for (var _i = 0, typeParameters_4 = typeParameters; _i < typeParameters_4.length; _i++) {
|
|
82929
|
+
var typeParameter = typeParameters_4[_i];
|
|
82863
82930
|
if (!isTypeParameterUnused(typeParameter))
|
|
82864
82931
|
continue;
|
|
82865
82932
|
var name = ts.idText(typeParameter.name);
|
|
@@ -84678,7 +84745,7 @@ var ts;
|
|
|
84678
84745
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84679
84746
|
var localPropDeclaration = declaration && declaration.kind === 221 /* BinaryExpression */ ||
|
|
84680
84747
|
name && name.kind === 162 /* ComputedPropertyName */ || getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
84681
|
-
var
|
|
84748
|
+
var _loop_30 = function (info) {
|
|
84682
84749
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
84683
84750
|
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
|
|
84684
84751
|
// in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
|
|
@@ -84691,7 +84758,7 @@ var ts;
|
|
|
84691
84758
|
};
|
|
84692
84759
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
84693
84760
|
var info = indexInfos_9[_i];
|
|
84694
|
-
|
|
84761
|
+
_loop_30(info);
|
|
84695
84762
|
}
|
|
84696
84763
|
}
|
|
84697
84764
|
function checkIndexConstraintForIndexSignature(type, checkInfo) {
|
|
@@ -84699,7 +84766,7 @@ var ts;
|
|
|
84699
84766
|
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
|
|
84700
84767
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84701
84768
|
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
|
|
84702
|
-
var
|
|
84769
|
+
var _loop_31 = function (info) {
|
|
84703
84770
|
if (info === checkInfo)
|
|
84704
84771
|
return "continue";
|
|
84705
84772
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
@@ -84714,7 +84781,7 @@ var ts;
|
|
|
84714
84781
|
};
|
|
84715
84782
|
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
84716
84783
|
var info = indexInfos_10[_i];
|
|
84717
|
-
|
|
84784
|
+
_loop_31(info);
|
|
84718
84785
|
}
|
|
84719
84786
|
}
|
|
84720
84787
|
function checkTypeNameIsReserved(name, message) {
|
|
@@ -85034,7 +85101,7 @@ var ts;
|
|
|
85034
85101
|
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
85035
85102
|
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
85036
85103
|
var baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
85037
|
-
var
|
|
85104
|
+
var _loop_32 = function (member) {
|
|
85038
85105
|
if (ts.hasAmbientModifier(member)) {
|
|
85039
85106
|
return "continue";
|
|
85040
85107
|
}
|
|
@@ -85051,7 +85118,7 @@ var ts;
|
|
|
85051
85118
|
};
|
|
85052
85119
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
85053
85120
|
var member = _a[_i];
|
|
85054
|
-
|
|
85121
|
+
_loop_32(member);
|
|
85055
85122
|
}
|
|
85056
85123
|
}
|
|
85057
85124
|
/**
|
|
@@ -85139,7 +85206,7 @@ var ts;
|
|
|
85139
85206
|
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
|
|
85140
85207
|
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
|
|
85141
85208
|
var issuedMemberError = false;
|
|
85142
|
-
var
|
|
85209
|
+
var _loop_33 = function (member) {
|
|
85143
85210
|
if (ts.isStatic(member)) {
|
|
85144
85211
|
return "continue";
|
|
85145
85212
|
}
|
|
@@ -85158,7 +85225,7 @@ var ts;
|
|
|
85158
85225
|
};
|
|
85159
85226
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
85160
85227
|
var member = _a[_i];
|
|
85161
|
-
|
|
85228
|
+
_loop_33(member);
|
|
85162
85229
|
}
|
|
85163
85230
|
if (!issuedMemberError) {
|
|
85164
85231
|
// check again with diagnostics to generate a less-specific error
|
|
@@ -85229,7 +85296,7 @@ var ts;
|
|
|
85229
85296
|
var _a, _b, _c, _d;
|
|
85230
85297
|
// NOTE: assignability is checked in checkClassDeclaration
|
|
85231
85298
|
var baseProperties = getPropertiesOfType(baseType);
|
|
85232
|
-
var
|
|
85299
|
+
var _loop_34 = function (baseProperty) {
|
|
85233
85300
|
var base = getTargetSymbol(baseProperty);
|
|
85234
85301
|
if (base.flags & 4194304 /* Prototype */) {
|
|
85235
85302
|
return "continue";
|
|
@@ -85339,7 +85406,7 @@ var ts;
|
|
|
85339
85406
|
};
|
|
85340
85407
|
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
|
|
85341
85408
|
var baseProperty = baseProperties_1[_i];
|
|
85342
|
-
var state_10 =
|
|
85409
|
+
var state_10 = _loop_34(baseProperty);
|
|
85343
85410
|
switch (state_10) {
|
|
85344
85411
|
case "continue-basePropertyCheck": continue basePropertyCheck;
|
|
85345
85412
|
}
|
|
@@ -111854,7 +111921,6 @@ var ts;
|
|
|
111854
111921
|
if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
|
|
111855
111922
|
// Update the output signature
|
|
111856
111923
|
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, createHash, changedDtsData);
|
|
111857
|
-
newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
|
|
111858
111924
|
}
|
|
111859
111925
|
// Update sourceFileInfo
|
|
111860
111926
|
var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
|
|
@@ -121241,7 +121307,7 @@ var ts;
|
|
|
121241
121307
|
state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
|
|
121242
121308
|
}
|
|
121243
121309
|
state.changedFilesSet = new ts.Set();
|
|
121244
|
-
state.
|
|
121310
|
+
state.latestChangedDtsFile = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.latestChangedDtsFile : undefined;
|
|
121245
121311
|
var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
|
|
121246
121312
|
var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
|
|
121247
121313
|
var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
|
|
@@ -121365,7 +121431,7 @@ var ts;
|
|
|
121365
121431
|
programEmitComplete: state.programEmitComplete,
|
|
121366
121432
|
emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
|
|
121367
121433
|
outSignature: state.outSignature,
|
|
121368
|
-
|
|
121434
|
+
latestChangedDtsFile: state.latestChangedDtsFile,
|
|
121369
121435
|
hasChangedEmitSignature: state.hasChangedEmitSignature,
|
|
121370
121436
|
changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
|
|
121371
121437
|
};
|
|
@@ -121378,7 +121444,7 @@ var ts;
|
|
|
121378
121444
|
state.programEmitComplete = savedEmitState.programEmitComplete;
|
|
121379
121445
|
state.emitSignatures = savedEmitState.emitSignatures;
|
|
121380
121446
|
state.outSignature = savedEmitState.outSignature;
|
|
121381
|
-
state.
|
|
121447
|
+
state.latestChangedDtsFile = savedEmitState.latestChangedDtsFile;
|
|
121382
121448
|
state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
|
|
121383
121449
|
if (savedEmitState.changedFilesSet)
|
|
121384
121450
|
state.changedFilesSet = savedEmitState.changedFilesSet;
|
|
@@ -121692,14 +121758,14 @@ var ts;
|
|
|
121692
121758
|
/**
|
|
121693
121759
|
* Gets the program information to be emitted in buildInfo so that we can use it to create new program
|
|
121694
121760
|
*/
|
|
121695
|
-
function getProgramBuildInfo(state, getCanonicalFileName
|
|
121761
|
+
function getProgramBuildInfo(state, getCanonicalFileName) {
|
|
121696
121762
|
var outFilePath = ts.outFile(state.compilerOptions);
|
|
121697
121763
|
if (outFilePath && !state.compilerOptions.composite)
|
|
121698
121764
|
return;
|
|
121699
121765
|
var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
|
|
121700
121766
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
|
|
121701
|
-
//
|
|
121702
|
-
|
|
121767
|
+
// Convert the file name to Path here if we set the fileName instead to optimize multiple d.ts file emits and having to compute Canonical path
|
|
121768
|
+
var latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : undefined;
|
|
121703
121769
|
if (outFilePath) {
|
|
121704
121770
|
var fileNames_1 = [];
|
|
121705
121771
|
var fileInfos_1 = [];
|
|
@@ -121715,7 +121781,7 @@ var ts;
|
|
|
121715
121781
|
fileInfos: fileInfos_1,
|
|
121716
121782
|
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
|
|
121717
121783
|
outSignature: state.outSignature,
|
|
121718
|
-
|
|
121784
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
121719
121785
|
};
|
|
121720
121786
|
return result_15;
|
|
121721
121787
|
}
|
|
@@ -121817,7 +121883,7 @@ var ts;
|
|
|
121817
121883
|
affectedFilesPendingEmit: affectedFilesPendingEmit,
|
|
121818
121884
|
changeFileSet: changeFileSet,
|
|
121819
121885
|
emitSignatures: emitSignatures,
|
|
121820
|
-
|
|
121886
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
121821
121887
|
};
|
|
121822
121888
|
return result;
|
|
121823
121889
|
function relativeToBuildInfoEnsuringAbsolutePath(path) {
|
|
@@ -121985,7 +122051,7 @@ var ts;
|
|
|
121985
122051
|
*/
|
|
121986
122052
|
var computeHash = ts.maybeBind(host, host.createHash);
|
|
121987
122053
|
var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
|
|
121988
|
-
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName
|
|
122054
|
+
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
|
|
121989
122055
|
// To ensure that we arent storing any references to old program or new program without state
|
|
121990
122056
|
newProgram = undefined; // TODO: GH#18217
|
|
121991
122057
|
oldProgram = undefined;
|
|
@@ -121995,6 +122061,7 @@ var ts;
|
|
|
121995
122061
|
builderProgram.getState = getState;
|
|
121996
122062
|
builderProgram.saveEmitState = function () { return backupBuilderProgramEmitState(state); };
|
|
121997
122063
|
builderProgram.restoreEmitState = function (saved) { return restoreBuilderProgramEmitState(state, saved); };
|
|
122064
|
+
builderProgram.hasChangedEmitSignature = function () { return !!state.hasChangedEmitSignature; };
|
|
121998
122065
|
builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
|
|
121999
122066
|
builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
|
|
122000
122067
|
builderProgram.emit = emit;
|
|
@@ -122102,18 +122169,22 @@ var ts;
|
|
|
122102
122169
|
var filePath = sourceFiles[0].resolvedPath;
|
|
122103
122170
|
var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath);
|
|
122104
122171
|
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text, computeHash, data));
|
|
122105
|
-
if
|
|
122106
|
-
|
|
122107
|
-
|
|
122108
|
-
|
|
122172
|
+
// Dont write dts files if they didn't change
|
|
122173
|
+
if (emitSignature === oldSignature)
|
|
122174
|
+
return;
|
|
122175
|
+
((_g = state.emitSignatures) !== null && _g !== void 0 ? _g : (state.emitSignatures = new ts.Map())).set(filePath, emitSignature);
|
|
122176
|
+
state.hasChangedEmitSignature = true;
|
|
122177
|
+
state.latestChangedDtsFile = fileName;
|
|
122109
122178
|
}
|
|
122110
122179
|
}
|
|
122111
122180
|
else if (state.compilerOptions.composite) {
|
|
122112
122181
|
var newSignature = computeSignature(text, computeHash, data);
|
|
122113
|
-
if
|
|
122114
|
-
|
|
122115
|
-
|
|
122116
|
-
|
|
122182
|
+
// Dont write dts files if they didn't change
|
|
122183
|
+
if (newSignature === state.outSignature)
|
|
122184
|
+
return;
|
|
122185
|
+
state.outSignature = newSignature;
|
|
122186
|
+
state.hasChangedEmitSignature = true;
|
|
122187
|
+
state.latestChangedDtsFile = fileName;
|
|
122117
122188
|
}
|
|
122118
122189
|
}
|
|
122119
122190
|
if (writeFile)
|
|
@@ -122276,11 +122347,12 @@ var ts;
|
|
|
122276
122347
|
var state;
|
|
122277
122348
|
var filePaths;
|
|
122278
122349
|
var filePathsSetList;
|
|
122350
|
+
var latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : undefined;
|
|
122279
122351
|
if (isProgramBundleEmitBuildInfo(program)) {
|
|
122280
122352
|
state = {
|
|
122281
122353
|
fileInfos: new ts.Map(),
|
|
122282
122354
|
compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
|
|
122283
|
-
|
|
122355
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
122284
122356
|
outSignature: program.outSignature,
|
|
122285
122357
|
};
|
|
122286
122358
|
}
|
|
@@ -122313,7 +122385,7 @@ var ts;
|
|
|
122313
122385
|
affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
|
|
122314
122386
|
affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
|
|
122315
122387
|
changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
|
|
122316
|
-
|
|
122388
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
122317
122389
|
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
|
122318
122390
|
};
|
|
122319
122391
|
}
|
|
@@ -122340,6 +122412,7 @@ var ts;
|
|
|
122340
122412
|
getSemanticDiagnosticsOfNextAffectedFile: ts.notImplemented,
|
|
122341
122413
|
emitBuildInfo: ts.notImplemented,
|
|
122342
122414
|
close: ts.noop,
|
|
122415
|
+
hasChangedEmitSignature: ts.returnFalse,
|
|
122343
122416
|
};
|
|
122344
122417
|
function toPath(path) {
|
|
122345
122418
|
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
@@ -123654,7 +123727,7 @@ var ts;
|
|
|
123654
123727
|
});
|
|
123655
123728
|
// Sort by paths closest to importing file Name directory
|
|
123656
123729
|
var sortedPaths = [];
|
|
123657
|
-
var
|
|
123730
|
+
var _loop_35 = function (directory) {
|
|
123658
123731
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
123659
123732
|
var pathsInDirectory;
|
|
123660
123733
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -123678,7 +123751,7 @@ var ts;
|
|
|
123678
123751
|
};
|
|
123679
123752
|
var out_directory_1;
|
|
123680
123753
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
123681
|
-
var state_11 =
|
|
123754
|
+
var state_11 = _loop_35(directory);
|
|
123682
123755
|
directory = out_directory_1;
|
|
123683
123756
|
if (state_11 === "break")
|
|
123684
123757
|
break;
|
|
@@ -124522,7 +124595,6 @@ var ts;
|
|
|
124522
124595
|
readDirectory: ts.maybeBind(host, host.readDirectory),
|
|
124523
124596
|
disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
|
|
124524
124597
|
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
|
|
124525
|
-
now: ts.maybeBind(host, host.now),
|
|
124526
124598
|
};
|
|
124527
124599
|
function writeFile(fileName, text, writeByteOrderMark, onError) {
|
|
124528
124600
|
try {
|
|
@@ -124680,7 +124752,6 @@ var ts;
|
|
|
124680
124752
|
host.createHash = ts.maybeBind(system, system.createHash);
|
|
124681
124753
|
host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
|
|
124682
124754
|
host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
|
|
124683
|
-
host.now = ts.maybeBind(system, system.now);
|
|
124684
124755
|
ts.setGetSourceFileAsHashVersioned(host, system);
|
|
124685
124756
|
ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
|
|
124686
124757
|
return host;
|
|
@@ -126008,8 +126079,7 @@ var ts;
|
|
|
126008
126079
|
}
|
|
126009
126080
|
// Actual Emit
|
|
126010
126081
|
var host = state.host, compilerHost = state.compilerHost;
|
|
126011
|
-
var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
|
|
126012
|
-
var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
|
|
126082
|
+
var resultFlags = ((_d = program.hasChangedEmitSignature) === null || _d === void 0 ? void 0 : _d.call(program)) ? BuildResultFlags.None : BuildResultFlags.DeclarationOutputUnchanged;
|
|
126013
126083
|
var emitterDiagnostics = ts.createDiagnosticCollection();
|
|
126014
126084
|
var emittedOutputs = new ts.Map();
|
|
126015
126085
|
var options = program.getCompilerOptions();
|
|
@@ -126017,17 +126087,11 @@ var ts;
|
|
|
126017
126087
|
var outputTimeStampMap;
|
|
126018
126088
|
var now;
|
|
126019
126089
|
outputFiles.forEach(function (_a) {
|
|
126020
|
-
var _b, _c;
|
|
126021
126090
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
126022
126091
|
var path = toPath(state, name);
|
|
126023
126092
|
emittedOutputs.set(toPath(state, name), name);
|
|
126024
|
-
if (buildInfo)
|
|
126025
|
-
setBuildInfo(state, buildInfo, projectPath, options);
|
|
126026
|
-
// Buildinfo has information on when last dts change time
|
|
126027
|
-
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)) {
|
|
126028
|
-
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
|
126029
|
-
}
|
|
126030
|
-
}
|
|
126093
|
+
if (buildInfo)
|
|
126094
|
+
setBuildInfo(state, buildInfo, projectPath, options, resultFlags);
|
|
126031
126095
|
ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
|
|
126032
126096
|
if (!isIncremental && state.watch) {
|
|
126033
126097
|
(outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
|
|
@@ -126041,7 +126105,7 @@ var ts;
|
|
|
126041
126105
|
ts.Debug.assert(step === BuildStep.EmitBuildInfo);
|
|
126042
126106
|
var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
|
|
126043
126107
|
if (data === null || data === void 0 ? void 0 : data.buildInfo)
|
|
126044
|
-
setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
|
|
126108
|
+
setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions(), BuildResultFlags.DeclarationOutputUnchanged);
|
|
126045
126109
|
if (writeFileCallback)
|
|
126046
126110
|
writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
126047
126111
|
else
|
|
@@ -126074,7 +126138,6 @@ var ts;
|
|
|
126074
126138
|
state.diagnostics.delete(projectPath);
|
|
126075
126139
|
state.projectStatus.set(projectPath, {
|
|
126076
126140
|
type: ts.UpToDateStatusType.UpToDate,
|
|
126077
|
-
newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
|
|
126078
126141
|
oldestOutputFileName: oldestOutputFileName
|
|
126079
126142
|
});
|
|
126080
126143
|
afterProgramDone(state, program, config);
|
|
@@ -126116,10 +126179,10 @@ var ts;
|
|
|
126116
126179
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
126117
126180
|
emittedOutputs.set(toPath(state, name), name);
|
|
126118
126181
|
if (buildInfo) {
|
|
126119
|
-
|
|
126120
|
-
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
|
|
126182
|
+
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) {
|
|
126121
126183
|
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
|
126122
126184
|
}
|
|
126185
|
+
setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags);
|
|
126123
126186
|
}
|
|
126124
126187
|
ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
|
|
126125
126188
|
});
|
|
@@ -126378,15 +126441,23 @@ var ts;
|
|
|
126378
126441
|
state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
|
|
126379
126442
|
return result;
|
|
126380
126443
|
}
|
|
126381
|
-
function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
|
|
126444
|
+
function setBuildInfo(state, buildInfo, resolvedConfigPath, options, resultFlags) {
|
|
126382
126445
|
var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
|
|
126383
126446
|
var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
|
|
126447
|
+
var modifiedTime = getCurrentTime(state.host);
|
|
126384
126448
|
if (existing) {
|
|
126385
126449
|
existing.buildInfo = buildInfo;
|
|
126386
|
-
existing.modifiedTime =
|
|
126450
|
+
existing.modifiedTime = modifiedTime;
|
|
126451
|
+
if (!(resultFlags & BuildResultFlags.DeclarationOutputUnchanged))
|
|
126452
|
+
existing.latestChangedDtsTime = modifiedTime;
|
|
126387
126453
|
}
|
|
126388
126454
|
else {
|
|
126389
|
-
state.buildInfoCache.set(resolvedConfigPath, {
|
|
126455
|
+
state.buildInfoCache.set(resolvedConfigPath, {
|
|
126456
|
+
path: toPath(state, buildInfoPath),
|
|
126457
|
+
buildInfo: buildInfo,
|
|
126458
|
+
modifiedTime: modifiedTime,
|
|
126459
|
+
latestChangedDtsTime: resultFlags & BuildResultFlags.DeclarationOutputUnchanged ? undefined : modifiedTime,
|
|
126460
|
+
});
|
|
126390
126461
|
}
|
|
126391
126462
|
}
|
|
126392
126463
|
function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
|
|
@@ -126418,7 +126489,7 @@ var ts;
|
|
|
126418
126489
|
}
|
|
126419
126490
|
}
|
|
126420
126491
|
function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
126421
|
-
var _a, _b
|
|
126492
|
+
var _a, _b;
|
|
126422
126493
|
// Container if no files are specified in the project
|
|
126423
126494
|
if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
|
|
126424
126495
|
return {
|
|
@@ -126430,8 +126501,8 @@ var ts;
|
|
|
126430
126501
|
var force = !!state.options.force;
|
|
126431
126502
|
if (project.projectReferences) {
|
|
126432
126503
|
state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
|
|
126433
|
-
for (var _i = 0,
|
|
126434
|
-
var ref =
|
|
126504
|
+
for (var _i = 0, _c = project.projectReferences; _i < _c.length; _i++) {
|
|
126505
|
+
var ref = _c[_i];
|
|
126435
126506
|
var resolvedRef = ts.resolveProjectReferencePath(ref);
|
|
126436
126507
|
var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
|
|
126437
126508
|
var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
|
|
@@ -126471,7 +126542,6 @@ var ts;
|
|
|
126471
126542
|
var buildInfoTime;
|
|
126472
126543
|
var buildInfoProgram;
|
|
126473
126544
|
var buildInfoVersionMap;
|
|
126474
|
-
var newestDeclarationFileContentChangedTime;
|
|
126475
126545
|
if (buildInfoPath) {
|
|
126476
126546
|
var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
|
|
126477
126547
|
buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
|
|
@@ -126508,8 +126578,6 @@ var ts;
|
|
|
126508
126578
|
}
|
|
126509
126579
|
oldestOutputFileTime = buildInfoTime;
|
|
126510
126580
|
oldestOutputFileName = buildInfoPath;
|
|
126511
|
-
// Get the last dtsChange time from build info
|
|
126512
|
-
newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
|
|
126513
126581
|
}
|
|
126514
126582
|
// Check input files
|
|
126515
126583
|
var newestInputFileName = undefined;
|
|
@@ -126517,8 +126585,8 @@ var ts;
|
|
|
126517
126585
|
/** True if input file has changed timestamp but text is not changed, we can then do only timestamp updates on output to make it look up-to-date later */
|
|
126518
126586
|
var pseudoInputUpToDate = false;
|
|
126519
126587
|
// Get timestamps of input files
|
|
126520
|
-
for (var
|
|
126521
|
-
var inputFile =
|
|
126588
|
+
for (var _d = 0, _e = project.fileNames; _d < _e.length; _d++) {
|
|
126589
|
+
var inputFile = _e[_d];
|
|
126522
126590
|
var inputTime = getModifiedTime(state, inputFile);
|
|
126523
126591
|
if (inputTime === ts.missingFileModifiedTime) {
|
|
126524
126592
|
return {
|
|
@@ -126559,8 +126627,8 @@ var ts;
|
|
|
126559
126627
|
// Collect the expected outputs of this project
|
|
126560
126628
|
var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
|
|
126561
126629
|
var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
|
|
126562
|
-
for (var
|
|
126563
|
-
var output = outputs_1[
|
|
126630
|
+
for (var _f = 0, outputs_1 = outputs; _f < outputs_1.length; _f++) {
|
|
126631
|
+
var output = outputs_1[_f];
|
|
126564
126632
|
var path = toPath(state, output);
|
|
126565
126633
|
// Output is missing; can stop checking
|
|
126566
126634
|
var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
|
|
@@ -126598,8 +126666,8 @@ var ts;
|
|
|
126598
126666
|
var usesPrepend = false;
|
|
126599
126667
|
var upstreamChangedProject;
|
|
126600
126668
|
if (referenceStatuses) {
|
|
126601
|
-
for (var
|
|
126602
|
-
var
|
|
126669
|
+
for (var _g = 0, referenceStatuses_1 = referenceStatuses; _g < referenceStatuses_1.length; _g++) {
|
|
126670
|
+
var _h = referenceStatuses_1[_g], ref = _h.ref, refStatus = _h.refStatus, resolvedConfig = _h.resolvedConfig, resolvedRefPath = _h.resolvedRefPath;
|
|
126603
126671
|
usesPrepend = usesPrepend || !!(ref.prepend);
|
|
126604
126672
|
// If the upstream project's newest file is older than our oldest output, we
|
|
126605
126673
|
// can't be out of date because of it
|
|
@@ -126616,7 +126684,8 @@ var ts;
|
|
|
126616
126684
|
}
|
|
126617
126685
|
// If the upstream project has only change .d.ts files, and we've built
|
|
126618
126686
|
// *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
|
|
126619
|
-
|
|
126687
|
+
var newestDeclarationFileContentChangedTime = getLatestChangedDtsTime(state, resolvedConfig.options, resolvedRefPath);
|
|
126688
|
+
if (newestDeclarationFileContentChangedTime && newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
|
|
126620
126689
|
pseudoUpToDate = true;
|
|
126621
126690
|
upstreamChangedProject = ref.path;
|
|
126622
126691
|
continue;
|
|
@@ -126659,7 +126728,6 @@ var ts;
|
|
|
126659
126728
|
pseudoInputUpToDate ?
|
|
126660
126729
|
ts.UpToDateStatusType.UpToDateWithInputFileText :
|
|
126661
126730
|
ts.UpToDateStatusType.UpToDate,
|
|
126662
|
-
newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
|
|
126663
126731
|
newestInputFileTime: newestInputFileTime,
|
|
126664
126732
|
newestInputFileName: newestInputFileName,
|
|
126665
126733
|
oldestOutputFileName: oldestOutputFileName
|
|
@@ -126743,13 +126811,17 @@ var ts;
|
|
|
126743
126811
|
outputTimeStampMap.delete(key);
|
|
126744
126812
|
});
|
|
126745
126813
|
}
|
|
126746
|
-
function
|
|
126747
|
-
var _a;
|
|
126814
|
+
function getLatestChangedDtsTime(state, options, resolvedConfigPath) {
|
|
126748
126815
|
if (!options.composite)
|
|
126749
126816
|
return undefined;
|
|
126750
|
-
var
|
|
126751
|
-
|
|
126752
|
-
|
|
126817
|
+
var entry = ts.Debug.checkDefined(state.buildInfoCache.get(resolvedConfigPath));
|
|
126818
|
+
if (entry.latestChangedDtsTime !== undefined)
|
|
126819
|
+
return entry.latestChangedDtsTime || undefined;
|
|
126820
|
+
var latestChangedDtsTime = entry.buildInfo && entry.buildInfo.program && entry.buildInfo.program.latestChangedDtsFile ?
|
|
126821
|
+
state.host.getModifiedTime(ts.getNormalizedAbsolutePath(entry.buildInfo.program.latestChangedDtsFile, ts.getDirectoryPath(entry.path))) :
|
|
126822
|
+
undefined;
|
|
126823
|
+
entry.latestChangedDtsTime = latestChangedDtsTime || false;
|
|
126824
|
+
return latestChangedDtsTime;
|
|
126753
126825
|
}
|
|
126754
126826
|
function updateOutputTimestamps(state, proj, resolvedPath) {
|
|
126755
126827
|
if (state.options.dry) {
|
|
@@ -126758,7 +126830,6 @@ var ts;
|
|
|
126758
126830
|
updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
|
|
126759
126831
|
state.projectStatus.set(resolvedPath, {
|
|
126760
126832
|
type: ts.UpToDateStatusType.UpToDate,
|
|
126761
|
-
newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
|
|
126762
126833
|
oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
|
|
126763
126834
|
});
|
|
126764
126835
|
}
|