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
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220704";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -5461,9 +5461,10 @@ var ts;
|
|
|
5461
5461
|
(function (TypeMapKind) {
|
|
5462
5462
|
TypeMapKind[TypeMapKind["Simple"] = 0] = "Simple";
|
|
5463
5463
|
TypeMapKind[TypeMapKind["Array"] = 1] = "Array";
|
|
5464
|
-
TypeMapKind[TypeMapKind["
|
|
5465
|
-
TypeMapKind[TypeMapKind["
|
|
5466
|
-
TypeMapKind[TypeMapKind["
|
|
5464
|
+
TypeMapKind[TypeMapKind["Deferred"] = 2] = "Deferred";
|
|
5465
|
+
TypeMapKind[TypeMapKind["Function"] = 3] = "Function";
|
|
5466
|
+
TypeMapKind[TypeMapKind["Composite"] = 4] = "Composite";
|
|
5467
|
+
TypeMapKind[TypeMapKind["Merged"] = 5] = "Merged";
|
|
5467
5468
|
})(TypeMapKind = ts.TypeMapKind || (ts.TypeMapKind = {}));
|
|
5468
5469
|
var InferencePriority;
|
|
5469
5470
|
(function (InferencePriority) {
|
|
@@ -48866,6 +48867,24 @@ var ts;
|
|
|
48866
48867
|
var Symbol = ts.objectAllocator.getSymbolConstructor();
|
|
48867
48868
|
var Type = ts.objectAllocator.getTypeConstructor();
|
|
48868
48869
|
var Signature = ts.objectAllocator.getSignatureConstructor();
|
|
48870
|
+
var DebugTypeMapper = /** @class */ (function () {
|
|
48871
|
+
function DebugTypeMapper() {
|
|
48872
|
+
}
|
|
48873
|
+
DebugTypeMapper.prototype.__debugToString = function () {
|
|
48874
|
+
var _a;
|
|
48875
|
+
ts.Debug.type(this);
|
|
48876
|
+
switch (this.kind) {
|
|
48877
|
+
case 3 /* Function */: return ((_a = this.debugInfo) === null || _a === void 0 ? void 0 : _a.call(this)) || "(function mapper)";
|
|
48878
|
+
case 0 /* Simple */: return this.source.__debugTypeToString() + " -> " + this.target.__debugTypeToString();
|
|
48879
|
+
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(", ");
|
|
48880
|
+
case 2 /* Deferred */: return ts.zipWith(this.sources, this.targets, function (s, t) { return s.__debugTypeToString() + " -> " + t().__debugTypeToString(); }).join(", ");
|
|
48881
|
+
case 5 /* Merged */:
|
|
48882
|
+
case 4 /* Composite */: return "m1: " + this.mapper1.__debugToString().split("\n").join("\n ") + "\nm2: " + this.mapper2.__debugToString().split("\n").join("\n ");
|
|
48883
|
+
default: return ts.Debug.assertNever(this);
|
|
48884
|
+
}
|
|
48885
|
+
};
|
|
48886
|
+
return DebugTypeMapper;
|
|
48887
|
+
}());
|
|
48869
48888
|
var typeCount = 0;
|
|
48870
48889
|
var symbolCount = 0;
|
|
48871
48890
|
var enumCount = 0;
|
|
@@ -49326,10 +49345,23 @@ var ts;
|
|
|
49326
49345
|
var numberOrBigIntType = getUnionType([numberType, bigintType]);
|
|
49327
49346
|
var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
|
|
49328
49347
|
var numericStringType = getTemplateLiteralType(["", ""], [numberType]); // The `${number}` type
|
|
49329
|
-
var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; });
|
|
49330
|
-
var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? wildcardType : t; });
|
|
49348
|
+
var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; }, function () { return "(restrictive mapper)"; });
|
|
49349
|
+
var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? wildcardType : t; }, function () { return "(permissive mapper)"; });
|
|
49331
49350
|
var uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never"); // `uniqueLiteralType` is a special `never` flagged by union reduction to behave as a literal
|
|
49332
|
-
var uniqueLiteralMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? uniqueLiteralType : t; }); // replace all type parameters with the unique literal type (disregarding constraints)
|
|
49351
|
+
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)
|
|
49352
|
+
var outofbandVarianceMarkerHandler;
|
|
49353
|
+
var reportUnreliableMapper = makeFunctionTypeMapper(function (t) {
|
|
49354
|
+
if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
|
|
49355
|
+
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ true);
|
|
49356
|
+
}
|
|
49357
|
+
return t;
|
|
49358
|
+
}, function () { return "(unmeasurable reporter)"; });
|
|
49359
|
+
var reportUnmeasurableMapper = makeFunctionTypeMapper(function (t) {
|
|
49360
|
+
if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
|
|
49361
|
+
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ false);
|
|
49362
|
+
}
|
|
49363
|
+
return t;
|
|
49364
|
+
}, function () { return "(unreliable reporter)"; });
|
|
49333
49365
|
var emptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49334
49366
|
var emptyJsxObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49335
49367
|
emptyJsxObjectType.objectFlags |= 2048 /* JsxAttributes */;
|
|
@@ -49489,7 +49521,6 @@ var ts;
|
|
|
49489
49521
|
var typeofType = createTypeofType();
|
|
49490
49522
|
var _jsxNamespace;
|
|
49491
49523
|
var _jsxFactoryEntity;
|
|
49492
|
-
var outofbandVarianceMarkerHandler;
|
|
49493
49524
|
var subtypeRelation = new ts.Map();
|
|
49494
49525
|
var strictSubtypeRelation = new ts.Map();
|
|
49495
49526
|
var assignableRelation = new ts.Map();
|
|
@@ -53256,7 +53287,7 @@ var ts;
|
|
|
53256
53287
|
var name = typeParameterToName(newParam, context);
|
|
53257
53288
|
var newTypeVariable = ts.factory.createTypeReferenceNode(name);
|
|
53258
53289
|
context.approximateLength += 37; // 15 each for two added conditionals, 7 for an added infer type
|
|
53259
|
-
var newMapper = prependTypeMapping(type.root.checkType, newParam, type.
|
|
53290
|
+
var newMapper = prependTypeMapping(type.root.checkType, newParam, type.mapper);
|
|
53260
53291
|
var saveInferTypeParameters_1 = context.inferTypeParameters;
|
|
53261
53292
|
context.inferTypeParameters = type.root.inferTypeParameters;
|
|
53262
53293
|
var extendsTypeNode_1 = typeToTypeNodeHelper(instantiateType(type.root.extendsType, newMapper), context);
|
|
@@ -60667,8 +60698,7 @@ var ts;
|
|
|
60667
60698
|
var _a;
|
|
60668
60699
|
var inferences;
|
|
60669
60700
|
if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
|
|
60670
|
-
|
|
60671
|
-
var declaration = _b[_i];
|
|
60701
|
+
var _loop_15 = function (declaration) {
|
|
60672
60702
|
if (declaration.parent.kind === 190 /* InferType */) {
|
|
60673
60703
|
// When an 'infer T' declaration is immediately contained in a type reference node
|
|
60674
60704
|
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
|
|
@@ -60676,12 +60706,12 @@ var ts;
|
|
|
60676
60706
|
// present, we form an intersection of the inferred constraint types.
|
|
60677
60707
|
var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1];
|
|
60678
60708
|
if (grandParent.kind === 178 /* TypeReference */ && !omitTypeReferences) {
|
|
60679
|
-
var
|
|
60680
|
-
var
|
|
60681
|
-
if (
|
|
60682
|
-
var index =
|
|
60683
|
-
if (index <
|
|
60684
|
-
var declaredConstraint = getConstraintOfTypeParameter(
|
|
60709
|
+
var typeReference_1 = grandParent;
|
|
60710
|
+
var typeParameters_1 = getTypeParametersForTypeReference(typeReference_1);
|
|
60711
|
+
if (typeParameters_1) {
|
|
60712
|
+
var index = typeReference_1.typeArguments.indexOf(childTypeParameter);
|
|
60713
|
+
if (index < typeParameters_1.length) {
|
|
60714
|
+
var declaredConstraint = getConstraintOfTypeParameter(typeParameters_1[index]);
|
|
60685
60715
|
if (declaredConstraint) {
|
|
60686
60716
|
// Type parameter constraints can reference other type parameters so
|
|
60687
60717
|
// constraints need to be instantiated. If instantiation produces the
|
|
@@ -60689,7 +60719,9 @@ var ts;
|
|
|
60689
60719
|
// type Foo<T extends string, U extends T> = [T, U];
|
|
60690
60720
|
// type Bar<T> = T extends Foo<infer X, infer X> ? Foo<X, X> : T;
|
|
60691
60721
|
// the instantiated constraint for U is X, so we discard that inference.
|
|
60692
|
-
var mapper =
|
|
60722
|
+
var mapper = makeDeferredTypeMapper(typeParameters_1, typeParameters_1.map(function (_, index) { return function () {
|
|
60723
|
+
return getEffectiveTypeArgumentAtIndex(typeReference_1, typeParameters_1, index);
|
|
60724
|
+
}; }));
|
|
60693
60725
|
var constraint = instantiateType(declaredConstraint, mapper);
|
|
60694
60726
|
if (constraint !== typeParameter) {
|
|
60695
60727
|
inferences = ts.append(inferences, constraint);
|
|
@@ -60727,6 +60759,10 @@ var ts;
|
|
|
60727
60759
|
inferences = ts.append(inferences, instantiateType(nodeType, makeUnaryTypeMapper(getDeclaredTypeOfTypeParameter(getSymbolOfNode(checkMappedType_1.typeParameter)), checkMappedType_1.typeParameter.constraint ? getTypeFromTypeNode(checkMappedType_1.typeParameter.constraint) : keyofConstraintType)));
|
|
60728
60760
|
}
|
|
60729
60761
|
}
|
|
60762
|
+
};
|
|
60763
|
+
for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
|
|
60764
|
+
var declaration = _b[_i];
|
|
60765
|
+
_loop_15(declaration);
|
|
60730
60766
|
}
|
|
60731
60767
|
}
|
|
60732
60768
|
return inferences && getIntersectionType(inferences);
|
|
@@ -61615,7 +61651,7 @@ var ts;
|
|
|
61615
61651
|
var lastRequiredIndex = -1;
|
|
61616
61652
|
var firstRestIndex = -1;
|
|
61617
61653
|
var lastOptionalOrRestIndex = -1;
|
|
61618
|
-
var
|
|
61654
|
+
var _loop_16 = function (i) {
|
|
61619
61655
|
var type = elementTypes[i];
|
|
61620
61656
|
var flags = target.elementFlags[i];
|
|
61621
61657
|
if (flags & 8 /* Variadic */) {
|
|
@@ -61645,7 +61681,7 @@ var ts;
|
|
|
61645
61681
|
}
|
|
61646
61682
|
};
|
|
61647
61683
|
for (var i = 0; i < elementTypes.length; i++) {
|
|
61648
|
-
var state_4 =
|
|
61684
|
+
var state_4 = _loop_16(i);
|
|
61649
61685
|
if (typeof state_4 === "object")
|
|
61650
61686
|
return state_4.value;
|
|
61651
61687
|
}
|
|
@@ -61841,7 +61877,7 @@ var ts;
|
|
|
61841
61877
|
var templates = ts.filter(types, isPatternLiteralType);
|
|
61842
61878
|
if (templates.length) {
|
|
61843
61879
|
var i = types.length;
|
|
61844
|
-
var
|
|
61880
|
+
var _loop_17 = function () {
|
|
61845
61881
|
i--;
|
|
61846
61882
|
var t = types[i];
|
|
61847
61883
|
if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
|
|
@@ -61849,7 +61885,7 @@ var ts;
|
|
|
61849
61885
|
}
|
|
61850
61886
|
};
|
|
61851
61887
|
while (i > 0) {
|
|
61852
|
-
|
|
61888
|
+
_loop_17();
|
|
61853
61889
|
}
|
|
61854
61890
|
}
|
|
61855
61891
|
}
|
|
@@ -61926,14 +61962,14 @@ var ts;
|
|
|
61926
61962
|
var namedUnions = [];
|
|
61927
61963
|
addNamedUnions(namedUnions, types);
|
|
61928
61964
|
var reducedTypes = [];
|
|
61929
|
-
var
|
|
61965
|
+
var _loop_18 = function (t) {
|
|
61930
61966
|
if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
|
|
61931
61967
|
reducedTypes.push(t);
|
|
61932
61968
|
}
|
|
61933
61969
|
};
|
|
61934
61970
|
for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
|
|
61935
61971
|
var t = typeSet_1[_i];
|
|
61936
|
-
|
|
61972
|
+
_loop_18(t);
|
|
61937
61973
|
}
|
|
61938
61974
|
if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
|
|
61939
61975
|
return namedUnions[0];
|
|
@@ -63157,7 +63193,7 @@ var ts;
|
|
|
63157
63193
|
var result;
|
|
63158
63194
|
var extraTypes;
|
|
63159
63195
|
var tailCount = 0;
|
|
63160
|
-
var
|
|
63196
|
+
var _loop_19 = function () {
|
|
63161
63197
|
if (tailCount === 1000) {
|
|
63162
63198
|
error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
63163
63199
|
result = errorType;
|
|
@@ -63278,7 +63314,7 @@ var ts;
|
|
|
63278
63314
|
// another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
|
|
63279
63315
|
// cases we increment the tail recursion counter and stop after 1000 iterations.
|
|
63280
63316
|
while (true) {
|
|
63281
|
-
var state_5 =
|
|
63317
|
+
var state_5 = _loop_19();
|
|
63282
63318
|
if (typeof state_5 === "object")
|
|
63283
63319
|
return state_5.value;
|
|
63284
63320
|
if (state_5 === "break")
|
|
@@ -63908,7 +63944,7 @@ var ts;
|
|
|
63908
63944
|
switch (mapper.kind) {
|
|
63909
63945
|
case 0 /* Simple */:
|
|
63910
63946
|
return type === mapper.source ? mapper.target : type;
|
|
63911
|
-
case 1 /* Array */:
|
|
63947
|
+
case 1 /* Array */: {
|
|
63912
63948
|
var sources = mapper.sources;
|
|
63913
63949
|
var targets = mapper.targets;
|
|
63914
63950
|
for (var i = 0; i < sources.length; i++) {
|
|
@@ -63917,25 +63953,45 @@ var ts;
|
|
|
63917
63953
|
}
|
|
63918
63954
|
}
|
|
63919
63955
|
return type;
|
|
63920
|
-
|
|
63956
|
+
}
|
|
63957
|
+
case 2 /* Deferred */: {
|
|
63958
|
+
var sources = mapper.sources;
|
|
63959
|
+
var targets = mapper.targets;
|
|
63960
|
+
for (var i = 0; i < sources.length; i++) {
|
|
63961
|
+
if (type === sources[i]) {
|
|
63962
|
+
return targets[i]();
|
|
63963
|
+
}
|
|
63964
|
+
}
|
|
63965
|
+
return type;
|
|
63966
|
+
}
|
|
63967
|
+
case 3 /* Function */:
|
|
63921
63968
|
return mapper.func(type);
|
|
63922
|
-
case
|
|
63923
|
-
case
|
|
63969
|
+
case 4 /* Composite */:
|
|
63970
|
+
case 5 /* Merged */:
|
|
63924
63971
|
var t1 = getMappedType(type, mapper.mapper1);
|
|
63925
|
-
return t1 !== type && mapper.kind ===
|
|
63972
|
+
return t1 !== type && mapper.kind === 4 /* Composite */ ? instantiateType(t1, mapper.mapper2) : getMappedType(t1, mapper.mapper2);
|
|
63973
|
+
}
|
|
63974
|
+
}
|
|
63975
|
+
function attachDebugPrototypeIfDebug(mapper) {
|
|
63976
|
+
if (ts.Debug.isDebugging) {
|
|
63977
|
+
return Object.setPrototypeOf(mapper, DebugTypeMapper.prototype);
|
|
63926
63978
|
}
|
|
63979
|
+
return mapper;
|
|
63927
63980
|
}
|
|
63928
63981
|
function makeUnaryTypeMapper(source, target) {
|
|
63929
|
-
return { kind: 0 /* Simple */, source: source, target: target };
|
|
63982
|
+
return attachDebugPrototypeIfDebug({ kind: 0 /* Simple */, source: source, target: target });
|
|
63930
63983
|
}
|
|
63931
63984
|
function makeArrayTypeMapper(sources, targets) {
|
|
63932
|
-
return { kind: 1 /* Array */, sources: sources, targets: targets };
|
|
63985
|
+
return attachDebugPrototypeIfDebug({ kind: 1 /* Array */, sources: sources, targets: targets });
|
|
63986
|
+
}
|
|
63987
|
+
function makeFunctionTypeMapper(func, debugInfo) {
|
|
63988
|
+
return attachDebugPrototypeIfDebug({ kind: 3 /* Function */, func: func, debugInfo: ts.Debug.isDebugging ? debugInfo : undefined });
|
|
63933
63989
|
}
|
|
63934
|
-
function
|
|
63935
|
-
return { kind: 2 /*
|
|
63990
|
+
function makeDeferredTypeMapper(sources, targets) {
|
|
63991
|
+
return attachDebugPrototypeIfDebug({ kind: 2 /* Deferred */, sources: sources, targets: targets });
|
|
63936
63992
|
}
|
|
63937
63993
|
function makeCompositeTypeMapper(kind, mapper1, mapper2) {
|
|
63938
|
-
return { kind: kind, mapper1: mapper1, mapper2: mapper2 };
|
|
63994
|
+
return attachDebugPrototypeIfDebug({ kind: kind, mapper1: mapper1, mapper2: mapper2 });
|
|
63939
63995
|
}
|
|
63940
63996
|
function createTypeEraser(sources) {
|
|
63941
63997
|
return createTypeMapper(sources, /*targets*/ undefined);
|
|
@@ -63945,19 +64001,20 @@ var ts;
|
|
|
63945
64001
|
* This is used during inference when instantiating type parameter defaults.
|
|
63946
64002
|
*/
|
|
63947
64003
|
function createBackreferenceMapper(context, index) {
|
|
63948
|
-
|
|
64004
|
+
var forwardInferences = context.inferences.slice(index);
|
|
64005
|
+
return createTypeMapper(ts.map(forwardInferences, function (i) { return i.typeParameter; }), ts.map(forwardInferences, function () { return unknownType; }));
|
|
63949
64006
|
}
|
|
63950
64007
|
function combineTypeMappers(mapper1, mapper2) {
|
|
63951
|
-
return mapper1 ? makeCompositeTypeMapper(
|
|
64008
|
+
return mapper1 ? makeCompositeTypeMapper(4 /* Composite */, mapper1, mapper2) : mapper2;
|
|
63952
64009
|
}
|
|
63953
64010
|
function mergeTypeMappers(mapper1, mapper2) {
|
|
63954
|
-
return mapper1 ? makeCompositeTypeMapper(
|
|
64011
|
+
return mapper1 ? makeCompositeTypeMapper(5 /* Merged */, mapper1, mapper2) : mapper2;
|
|
63955
64012
|
}
|
|
63956
64013
|
function prependTypeMapping(source, target, mapper) {
|
|
63957
|
-
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(
|
|
64014
|
+
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* Merged */, makeUnaryTypeMapper(source, target), mapper);
|
|
63958
64015
|
}
|
|
63959
64016
|
function appendTypeMapping(mapper, source, target) {
|
|
63960
|
-
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(
|
|
64017
|
+
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* Merged */, mapper, makeUnaryTypeMapper(source, target));
|
|
63961
64018
|
}
|
|
63962
64019
|
function getRestrictiveTypeParameter(tp) {
|
|
63963
64020
|
return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol),
|
|
@@ -65853,7 +65910,7 @@ var ts;
|
|
|
65853
65910
|
reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
|
|
65854
65911
|
checkTypes = reducedTarget.flags & 1048576 /* Union */ ? reducedTarget.types : [reducedTarget];
|
|
65855
65912
|
}
|
|
65856
|
-
var
|
|
65913
|
+
var _loop_20 = function (prop) {
|
|
65857
65914
|
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
|
|
65858
65915
|
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
|
|
65859
65916
|
if (reportErrors) {
|
|
@@ -65916,7 +65973,7 @@ var ts;
|
|
|
65916
65973
|
};
|
|
65917
65974
|
for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
|
|
65918
65975
|
var prop = _b[_i];
|
|
65919
|
-
var state_6 =
|
|
65976
|
+
var state_6 = _loop_20(prop);
|
|
65920
65977
|
if (typeof state_6 === "object")
|
|
65921
65978
|
return state_6.value;
|
|
65922
65979
|
}
|
|
@@ -66148,10 +66205,10 @@ var ts;
|
|
|
66148
66205
|
// We're in the middle of variance checking - integrate any unmeasurable/unreliable flags from this cached component
|
|
66149
66206
|
var saved = entry & 24 /* ReportsMask */;
|
|
66150
66207
|
if (saved & 8 /* ReportsUnmeasurable */) {
|
|
66151
|
-
instantiateType(source,
|
|
66208
|
+
instantiateType(source, reportUnmeasurableMapper);
|
|
66152
66209
|
}
|
|
66153
66210
|
if (saved & 16 /* ReportsUnreliable */) {
|
|
66154
|
-
instantiateType(source,
|
|
66211
|
+
instantiateType(source, reportUnreliableMapper);
|
|
66155
66212
|
}
|
|
66156
66213
|
}
|
|
66157
66214
|
return entry & 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */;
|
|
@@ -66577,7 +66634,7 @@ var ts;
|
|
|
66577
66634
|
}
|
|
66578
66635
|
// Report unreliable variance for type variables referenced in template literal type placeholders.
|
|
66579
66636
|
// For example, `foo-${number}` is related to `foo-${string}` even though number isn't related to string.
|
|
66580
|
-
instantiateType(source,
|
|
66637
|
+
instantiateType(source, reportUnreliableMapper);
|
|
66581
66638
|
}
|
|
66582
66639
|
if (isTypeMatchedByTemplateLiteralType(source, target)) {
|
|
66583
66640
|
return -1 /* True */;
|
|
@@ -66849,18 +66906,6 @@ var ts;
|
|
|
66849
66906
|
}
|
|
66850
66907
|
}
|
|
66851
66908
|
}
|
|
66852
|
-
function reportUnmeasurableMarkers(p) {
|
|
66853
|
-
if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
|
|
66854
|
-
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ false);
|
|
66855
|
-
}
|
|
66856
|
-
return p;
|
|
66857
|
-
}
|
|
66858
|
-
function reportUnreliableMarkers(p) {
|
|
66859
|
-
if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
|
|
66860
|
-
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ true);
|
|
66861
|
-
}
|
|
66862
|
-
return p;
|
|
66863
|
-
}
|
|
66864
66909
|
// A type [P in S]: X is related to a type [Q in T]: Y if T is related to S and X' is
|
|
66865
66910
|
// related to Y, where X' is an instantiation of X in which P is replaced with Q. Notice
|
|
66866
66911
|
// that S and T are contra-variant whereas X and Y are co-variant.
|
|
@@ -66870,7 +66915,7 @@ var ts;
|
|
|
66870
66915
|
if (modifiersRelated) {
|
|
66871
66916
|
var result_10;
|
|
66872
66917
|
var targetConstraint = getConstraintTypeFromMappedType(target);
|
|
66873
|
-
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source),
|
|
66918
|
+
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMapper : reportUnreliableMapper);
|
|
66874
66919
|
if (result_10 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
|
|
66875
66920
|
var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
|
|
66876
66921
|
if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
|
|
@@ -66924,11 +66969,11 @@ var ts;
|
|
|
66924
66969
|
// constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
|
|
66925
66970
|
var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
|
|
66926
66971
|
var matchingTypes = [];
|
|
66927
|
-
var
|
|
66972
|
+
var _loop_21 = function (combination) {
|
|
66928
66973
|
var hasMatch = false;
|
|
66929
66974
|
outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
|
|
66930
66975
|
var type = _d[_c];
|
|
66931
|
-
var
|
|
66976
|
+
var _loop_22 = function (i) {
|
|
66932
66977
|
var sourceProperty = sourcePropertiesFiltered[i];
|
|
66933
66978
|
var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
|
|
66934
66979
|
if (!targetProperty)
|
|
@@ -66944,7 +66989,7 @@ var ts;
|
|
|
66944
66989
|
}
|
|
66945
66990
|
};
|
|
66946
66991
|
for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
|
|
66947
|
-
var state_8 =
|
|
66992
|
+
var state_8 = _loop_22(i);
|
|
66948
66993
|
switch (state_8) {
|
|
66949
66994
|
case "continue-outer": continue outer;
|
|
66950
66995
|
}
|
|
@@ -66958,7 +67003,7 @@ var ts;
|
|
|
66958
67003
|
};
|
|
66959
67004
|
for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
|
|
66960
67005
|
var combination = discriminantCombinations_1[_a];
|
|
66961
|
-
var state_7 =
|
|
67006
|
+
var state_7 = _loop_21(combination);
|
|
66962
67007
|
if (typeof state_7 === "object")
|
|
66963
67008
|
return state_7.value;
|
|
66964
67009
|
}
|
|
@@ -67406,7 +67451,7 @@ var ts;
|
|
|
67406
67451
|
* See signatureAssignableTo, compareSignaturesIdentical
|
|
67407
67452
|
*/
|
|
67408
67453
|
function signatureRelatedTo(source, target, erase, reportErrors, incompatibleReporter) {
|
|
67409
|
-
return compareSignaturesRelated(erase ? getErasedSignature(source) : source, erase ? getErasedSignature(target) : target, relation === strictSubtypeRelation ? 8 /* StrictArity */ : 0, reportErrors, reportError, incompatibleReporter, isRelatedToWorker,
|
|
67454
|
+
return compareSignaturesRelated(erase ? getErasedSignature(source) : source, erase ? getErasedSignature(target) : target, relation === strictSubtypeRelation ? 8 /* StrictArity */ : 0, reportErrors, reportError, incompatibleReporter, isRelatedToWorker, reportUnreliableMapper);
|
|
67410
67455
|
}
|
|
67411
67456
|
function signaturesIdenticalTo(source, target, kind) {
|
|
67412
67457
|
var sourceSignatures = getSignaturesOfType(source, kind);
|
|
@@ -67665,7 +67710,7 @@ var ts;
|
|
|
67665
67710
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
|
|
67666
67711
|
links.variances = ts.emptyArray;
|
|
67667
67712
|
var variances = [];
|
|
67668
|
-
var
|
|
67713
|
+
var _loop_23 = function (tp) {
|
|
67669
67714
|
var modifiers = getVarianceModifiers(tp);
|
|
67670
67715
|
var variance = modifiers & 65536 /* Out */ ?
|
|
67671
67716
|
modifiers & 32768 /* In */ ? 0 /* Invariant */ : 1 /* Covariant */ :
|
|
@@ -67701,9 +67746,9 @@ var ts;
|
|
|
67701
67746
|
}
|
|
67702
67747
|
variances.push(variance);
|
|
67703
67748
|
};
|
|
67704
|
-
for (var _i = 0,
|
|
67705
|
-
var tp =
|
|
67706
|
-
|
|
67749
|
+
for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
|
|
67750
|
+
var tp = typeParameters_2[_i];
|
|
67751
|
+
_loop_23(tp);
|
|
67707
67752
|
}
|
|
67708
67753
|
links.variances = variances;
|
|
67709
67754
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
|
|
@@ -68698,27 +68743,29 @@ var ts;
|
|
|
68698
68743
|
signature: signature,
|
|
68699
68744
|
flags: flags,
|
|
68700
68745
|
compareTypes: compareTypes,
|
|
68701
|
-
mapper:
|
|
68702
|
-
nonFixingMapper:
|
|
68746
|
+
mapper: reportUnmeasurableMapper,
|
|
68747
|
+
nonFixingMapper: reportUnmeasurableMapper,
|
|
68703
68748
|
};
|
|
68749
|
+
context.mapper = makeFixingMapperForContext(context);
|
|
68750
|
+
context.nonFixingMapper = makeNonFixingMapperForContext(context);
|
|
68704
68751
|
return context;
|
|
68705
68752
|
}
|
|
68706
|
-
function
|
|
68707
|
-
|
|
68708
|
-
|
|
68709
|
-
|
|
68710
|
-
|
|
68711
|
-
|
|
68712
|
-
|
|
68713
|
-
|
|
68714
|
-
inferFromIntraExpressionSites(context);
|
|
68715
|
-
clearCachedInferences(inferences);
|
|
68716
|
-
inference.isFixed = true;
|
|
68717
|
-
}
|
|
68718
|
-
return getInferredType(context, i);
|
|
68753
|
+
function makeFixingMapperForContext(context) {
|
|
68754
|
+
return makeDeferredTypeMapper(ts.map(context.inferences, function (i) { return i.typeParameter; }), ts.map(context.inferences, function (inference, i) { return function () {
|
|
68755
|
+
if (!inference.isFixed) {
|
|
68756
|
+
// Before we commit to a particular inference (and thus lock out any further inferences),
|
|
68757
|
+
// we infer from any intra-expression inference sites we have collected.
|
|
68758
|
+
inferFromIntraExpressionSites(context);
|
|
68759
|
+
clearCachedInferences(context.inferences);
|
|
68760
|
+
inference.isFixed = true;
|
|
68719
68761
|
}
|
|
68720
|
-
|
|
68721
|
-
|
|
68762
|
+
return getInferredType(context, i);
|
|
68763
|
+
}; }));
|
|
68764
|
+
}
|
|
68765
|
+
function makeNonFixingMapperForContext(context) {
|
|
68766
|
+
return makeDeferredTypeMapper(ts.map(context.inferences, function (i) { return i.typeParameter; }), ts.map(context.inferences, function (_, i) { return function () {
|
|
68767
|
+
return getInferredType(context, i);
|
|
68768
|
+
}; }));
|
|
68722
68769
|
}
|
|
68723
68770
|
function clearCachedInferences(inferences) {
|
|
68724
68771
|
for (var _i = 0, inferences_1 = inferences; _i < inferences_1.length; _i++) {
|
|
@@ -69638,7 +69685,7 @@ var ts;
|
|
|
69638
69685
|
// upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
|
|
69639
69686
|
// succeed. That would be a pointless and confusing outcome.
|
|
69640
69687
|
if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
|
|
69641
|
-
var
|
|
69688
|
+
var _loop_24 = function (i) {
|
|
69642
69689
|
var source_1 = matches ? matches[i] : neverType;
|
|
69643
69690
|
var target_3 = types[i];
|
|
69644
69691
|
// If we are inferring from a string literal type to a type variable whose constraint includes one of the
|
|
@@ -69688,7 +69735,7 @@ var ts;
|
|
|
69688
69735
|
inferFromTypes(source_1, target_3);
|
|
69689
69736
|
};
|
|
69690
69737
|
for (var i = 0; i < types.length; i++) {
|
|
69691
|
-
|
|
69738
|
+
_loop_24(i);
|
|
69692
69739
|
}
|
|
69693
69740
|
}
|
|
69694
69741
|
}
|
|
@@ -70206,7 +70253,7 @@ var ts;
|
|
|
70206
70253
|
function mapTypesByKeyProperty(types, name) {
|
|
70207
70254
|
var map = new ts.Map();
|
|
70208
70255
|
var count = 0;
|
|
70209
|
-
var
|
|
70256
|
+
var _loop_25 = function (type) {
|
|
70210
70257
|
if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
70211
70258
|
var discriminant = getTypeOfPropertyOfType(type, name);
|
|
70212
70259
|
if (discriminant) {
|
|
@@ -70232,7 +70279,7 @@ var ts;
|
|
|
70232
70279
|
};
|
|
70233
70280
|
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
|
|
70234
70281
|
var type = types_15[_i];
|
|
70235
|
-
var state_9 =
|
|
70282
|
+
var state_9 = _loop_25(type);
|
|
70236
70283
|
if (typeof state_9 === "object")
|
|
70237
70284
|
return state_9.value;
|
|
70238
70285
|
}
|
|
@@ -76581,7 +76628,7 @@ var ts;
|
|
|
76581
76628
|
if (spreadIndex >= 0) {
|
|
76582
76629
|
// Create synthetic arguments from spreads of tuple types.
|
|
76583
76630
|
var effectiveArgs_1 = args.slice(0, spreadIndex);
|
|
76584
|
-
var
|
|
76631
|
+
var _loop_26 = function (i) {
|
|
76585
76632
|
var arg = args[i];
|
|
76586
76633
|
// We can call checkExpressionCached because spread expressions never have a contextual type.
|
|
76587
76634
|
var spreadType = arg.kind === 225 /* SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
|
|
@@ -76598,7 +76645,7 @@ var ts;
|
|
|
76598
76645
|
}
|
|
76599
76646
|
};
|
|
76600
76647
|
for (var i = spreadIndex; i < args.length; i++) {
|
|
76601
|
-
|
|
76648
|
+
_loop_26(i);
|
|
76602
76649
|
}
|
|
76603
76650
|
return effectiveArgs_1;
|
|
76604
76651
|
}
|
|
@@ -76927,7 +76974,7 @@ var ts;
|
|
|
76927
76974
|
var min_3 = Number.MAX_VALUE;
|
|
76928
76975
|
var minIndex = 0;
|
|
76929
76976
|
var i_1 = 0;
|
|
76930
|
-
var
|
|
76977
|
+
var _loop_27 = function (c) {
|
|
76931
76978
|
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)); };
|
|
76932
76979
|
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2);
|
|
76933
76980
|
if (diags_2) {
|
|
@@ -76945,7 +76992,7 @@ var ts;
|
|
|
76945
76992
|
};
|
|
76946
76993
|
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
|
|
76947
76994
|
var c = candidatesForArgumentError_1[_a];
|
|
76948
|
-
|
|
76995
|
+
_loop_27(c);
|
|
76949
76996
|
}
|
|
76950
76997
|
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
|
|
76951
76998
|
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
|
|
@@ -77103,7 +77150,7 @@ var ts;
|
|
|
77103
77150
|
}
|
|
77104
77151
|
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
|
|
77105
77152
|
var parameters = [];
|
|
77106
|
-
var
|
|
77153
|
+
var _loop_28 = function (i) {
|
|
77107
77154
|
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
|
|
77108
77155
|
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
|
|
77109
77156
|
i < s.parameters.length ? s.parameters[i] : undefined; });
|
|
@@ -77111,7 +77158,7 @@ var ts;
|
|
|
77111
77158
|
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
|
|
77112
77159
|
};
|
|
77113
77160
|
for (var i = 0; i < maxNonRestParam; i++) {
|
|
77114
|
-
|
|
77161
|
+
_loop_28(i);
|
|
77115
77162
|
}
|
|
77116
77163
|
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
|
|
77117
77164
|
var flags = 0 /* None */;
|
|
@@ -80464,8 +80511,8 @@ var ts;
|
|
|
80464
80511
|
var result = [];
|
|
80465
80512
|
var oldTypeParameters;
|
|
80466
80513
|
var newTypeParameters;
|
|
80467
|
-
for (var _i = 0,
|
|
80468
|
-
var tp =
|
|
80514
|
+
for (var _i = 0, typeParameters_3 = typeParameters; _i < typeParameters_3.length; _i++) {
|
|
80515
|
+
var tp = typeParameters_3[_i];
|
|
80469
80516
|
var name = tp.symbol.escapedName;
|
|
80470
80517
|
if (hasTypeParameterByName(context.inferredTypeParameters, name) || hasTypeParameterByName(result, name)) {
|
|
80471
80518
|
var newName = getUniqueTypeParameterName(ts.concatenate(context.inferredTypeParameters, result), name);
|
|
@@ -81144,7 +81191,7 @@ var ts;
|
|
|
81144
81191
|
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
|
|
81145
81192
|
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
|
|
81146
81193
|
var indexSignatureMap_1 = new ts.Map();
|
|
81147
|
-
var
|
|
81194
|
+
var _loop_29 = function (declaration) {
|
|
81148
81195
|
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
|
|
81149
81196
|
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
|
|
81150
81197
|
var entry = indexSignatureMap_1.get(getTypeId(type));
|
|
@@ -81159,7 +81206,7 @@ var ts;
|
|
|
81159
81206
|
};
|
|
81160
81207
|
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
|
|
81161
81208
|
var declaration = _a[_i];
|
|
81162
|
-
|
|
81209
|
+
_loop_29(declaration);
|
|
81163
81210
|
}
|
|
81164
81211
|
indexSignatureMap_1.forEach(function (entry) {
|
|
81165
81212
|
if (entry.declarations.length > 1) {
|
|
@@ -81382,6 +81429,12 @@ var ts;
|
|
|
81382
81429
|
function checkMissingDeclaration(node) {
|
|
81383
81430
|
checkDecorators(node);
|
|
81384
81431
|
}
|
|
81432
|
+
function getEffectiveTypeArgumentAtIndex(node, typeParameters, index) {
|
|
81433
|
+
if (index < typeParameters.length) {
|
|
81434
|
+
return getTypeFromTypeNode(node.typeArguments[index]);
|
|
81435
|
+
}
|
|
81436
|
+
return getEffectiveTypeArguments(node, typeParameters)[index];
|
|
81437
|
+
}
|
|
81385
81438
|
function getEffectiveTypeArguments(node, typeParameters) {
|
|
81386
81439
|
return fillMissingTypeArguments(ts.map(node.typeArguments, getTypeFromTypeNode), typeParameters, getMinTypeArgumentCount(typeParameters), ts.isInJSFile(node));
|
|
81387
81440
|
}
|
|
@@ -82123,6 +82176,32 @@ var ts;
|
|
|
82123
82176
|
isAwaitedTypeInstantiation(type) ? type.aliasTypeArguments[0] :
|
|
82124
82177
|
type;
|
|
82125
82178
|
}
|
|
82179
|
+
function isAwaitedTypeNeeded(type) {
|
|
82180
|
+
// If this is already an `Awaited<T>`, we shouldn't wrap it. This helps to avoid `Awaited<Awaited<T>>` in higher-order.
|
|
82181
|
+
if (isTypeAny(type) || isAwaitedTypeInstantiation(type)) {
|
|
82182
|
+
return false;
|
|
82183
|
+
}
|
|
82184
|
+
// We only need `Awaited<T>` if `T` contains possibly non-primitive types.
|
|
82185
|
+
if (isGenericObjectType(type)) {
|
|
82186
|
+
var baseConstraint = getBaseConstraintOfType(type);
|
|
82187
|
+
// We only need `Awaited<T>` if `T` has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
|
|
82188
|
+
// or is promise-like.
|
|
82189
|
+
if (!baseConstraint || (baseConstraint.flags & 3 /* AnyOrUnknown */) || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint)) {
|
|
82190
|
+
return true;
|
|
82191
|
+
}
|
|
82192
|
+
}
|
|
82193
|
+
return false;
|
|
82194
|
+
}
|
|
82195
|
+
function tryCreateAwaitedType(type) {
|
|
82196
|
+
// Nothing to do if `Awaited<T>` doesn't exist
|
|
82197
|
+
var awaitedSymbol = getGlobalAwaitedSymbol(/*reportErrors*/ true);
|
|
82198
|
+
if (awaitedSymbol) {
|
|
82199
|
+
// Unwrap unions that may contain `Awaited<T>`, otherwise its possible to manufacture an `Awaited<Awaited<T> | U>` where
|
|
82200
|
+
// an `Awaited<T | U>` would suffice.
|
|
82201
|
+
return getTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
|
|
82202
|
+
}
|
|
82203
|
+
return undefined;
|
|
82204
|
+
}
|
|
82126
82205
|
function createAwaitedTypeIfNeeded(type) {
|
|
82127
82206
|
// We wrap type `T` in `Awaited<T>` based on the following conditions:
|
|
82128
82207
|
// - `T` is not already an `Awaited<U>`, and
|
|
@@ -82131,26 +82210,10 @@ var ts;
|
|
|
82131
82210
|
// - `T` has no base constraint, or
|
|
82132
82211
|
// - The base constraint of `T` is `any`, `unknown`, `object`, or `{}`, or
|
|
82133
82212
|
// - The base constraint of `T` is an object type with a callable `then` method.
|
|
82134
|
-
if (
|
|
82135
|
-
|
|
82136
|
-
|
|
82137
|
-
|
|
82138
|
-
if (isAwaitedTypeInstantiation(type)) {
|
|
82139
|
-
return type;
|
|
82140
|
-
}
|
|
82141
|
-
// Only instantiate `Awaited<T>` if `T` contains possibly non-primitive types.
|
|
82142
|
-
if (isGenericObjectType(type)) {
|
|
82143
|
-
var baseConstraint = getBaseConstraintOfType(type);
|
|
82144
|
-
// Only instantiate `Awaited<T>` if `T` has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
|
|
82145
|
-
// or is promise-like.
|
|
82146
|
-
if (!baseConstraint || (baseConstraint.flags & 3 /* AnyOrUnknown */) || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint)) {
|
|
82147
|
-
// Nothing to do if `Awaited<T>` doesn't exist
|
|
82148
|
-
var awaitedSymbol = getGlobalAwaitedSymbol(/*reportErrors*/ true);
|
|
82149
|
-
if (awaitedSymbol) {
|
|
82150
|
-
// Unwrap unions that may contain `Awaited<T>`, otherwise its possible to manufacture an `Awaited<Awaited<T> | U>` where
|
|
82151
|
-
// an `Awaited<T | U>` would suffice.
|
|
82152
|
-
return getTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
|
|
82153
|
-
}
|
|
82213
|
+
if (isAwaitedTypeNeeded(type)) {
|
|
82214
|
+
var awaitedType = tryCreateAwaitedType(type);
|
|
82215
|
+
if (awaitedType) {
|
|
82216
|
+
return awaitedType;
|
|
82154
82217
|
}
|
|
82155
82218
|
}
|
|
82156
82219
|
ts.Debug.assert(getPromisedTypeOfPromise(type) === undefined, "type provided should not be a non-generic 'promise'-like.");
|
|
@@ -82202,6 +82265,10 @@ var ts;
|
|
|
82202
82265
|
awaitedTypeStack.pop();
|
|
82203
82266
|
return typeAsAwaitable.awaitedTypeOfType = mapped;
|
|
82204
82267
|
}
|
|
82268
|
+
// If `type` is generic and should be wrapped in `Awaited<T>`, return it.
|
|
82269
|
+
if (isAwaitedTypeNeeded(type)) {
|
|
82270
|
+
return typeAsAwaitable.awaitedTypeOfType = type;
|
|
82271
|
+
}
|
|
82205
82272
|
var thisTypeForErrorOut = { value: undefined };
|
|
82206
82273
|
var promisedType = getPromisedTypeOfPromise(type, /*errorNode*/ undefined, thisTypeForErrorOut);
|
|
82207
82274
|
if (promisedType) {
|
|
@@ -82849,8 +82916,8 @@ var ts;
|
|
|
82849
82916
|
return;
|
|
82850
82917
|
var typeParameters = ts.getEffectiveTypeParameterDeclarations(node);
|
|
82851
82918
|
var seenParentsWithEveryUnused = new ts.Set();
|
|
82852
|
-
for (var _i = 0,
|
|
82853
|
-
var typeParameter =
|
|
82919
|
+
for (var _i = 0, typeParameters_4 = typeParameters; _i < typeParameters_4.length; _i++) {
|
|
82920
|
+
var typeParameter = typeParameters_4[_i];
|
|
82854
82921
|
if (!isTypeParameterUnused(typeParameter))
|
|
82855
82922
|
continue;
|
|
82856
82923
|
var name = ts.idText(typeParameter.name);
|
|
@@ -84669,7 +84736,7 @@ var ts;
|
|
|
84669
84736
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84670
84737
|
var localPropDeclaration = declaration && declaration.kind === 221 /* BinaryExpression */ ||
|
|
84671
84738
|
name && name.kind === 162 /* ComputedPropertyName */ || getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
84672
|
-
var
|
|
84739
|
+
var _loop_30 = function (info) {
|
|
84673
84740
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
84674
84741
|
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
|
|
84675
84742
|
// in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
|
|
@@ -84682,7 +84749,7 @@ var ts;
|
|
|
84682
84749
|
};
|
|
84683
84750
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
84684
84751
|
var info = indexInfos_9[_i];
|
|
84685
|
-
|
|
84752
|
+
_loop_30(info);
|
|
84686
84753
|
}
|
|
84687
84754
|
}
|
|
84688
84755
|
function checkIndexConstraintForIndexSignature(type, checkInfo) {
|
|
@@ -84690,7 +84757,7 @@ var ts;
|
|
|
84690
84757
|
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
|
|
84691
84758
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84692
84759
|
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
|
|
84693
|
-
var
|
|
84760
|
+
var _loop_31 = function (info) {
|
|
84694
84761
|
if (info === checkInfo)
|
|
84695
84762
|
return "continue";
|
|
84696
84763
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
@@ -84705,7 +84772,7 @@ var ts;
|
|
|
84705
84772
|
};
|
|
84706
84773
|
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
84707
84774
|
var info = indexInfos_10[_i];
|
|
84708
|
-
|
|
84775
|
+
_loop_31(info);
|
|
84709
84776
|
}
|
|
84710
84777
|
}
|
|
84711
84778
|
function checkTypeNameIsReserved(name, message) {
|
|
@@ -85025,7 +85092,7 @@ var ts;
|
|
|
85025
85092
|
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
85026
85093
|
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
85027
85094
|
var baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
85028
|
-
var
|
|
85095
|
+
var _loop_32 = function (member) {
|
|
85029
85096
|
if (ts.hasAmbientModifier(member)) {
|
|
85030
85097
|
return "continue";
|
|
85031
85098
|
}
|
|
@@ -85042,7 +85109,7 @@ var ts;
|
|
|
85042
85109
|
};
|
|
85043
85110
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
85044
85111
|
var member = _a[_i];
|
|
85045
|
-
|
|
85112
|
+
_loop_32(member);
|
|
85046
85113
|
}
|
|
85047
85114
|
}
|
|
85048
85115
|
/**
|
|
@@ -85130,7 +85197,7 @@ var ts;
|
|
|
85130
85197
|
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
|
|
85131
85198
|
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
|
|
85132
85199
|
var issuedMemberError = false;
|
|
85133
|
-
var
|
|
85200
|
+
var _loop_33 = function (member) {
|
|
85134
85201
|
if (ts.isStatic(member)) {
|
|
85135
85202
|
return "continue";
|
|
85136
85203
|
}
|
|
@@ -85149,7 +85216,7 @@ var ts;
|
|
|
85149
85216
|
};
|
|
85150
85217
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
85151
85218
|
var member = _a[_i];
|
|
85152
|
-
|
|
85219
|
+
_loop_33(member);
|
|
85153
85220
|
}
|
|
85154
85221
|
if (!issuedMemberError) {
|
|
85155
85222
|
// check again with diagnostics to generate a less-specific error
|
|
@@ -85220,7 +85287,7 @@ var ts;
|
|
|
85220
85287
|
var _a, _b, _c, _d;
|
|
85221
85288
|
// NOTE: assignability is checked in checkClassDeclaration
|
|
85222
85289
|
var baseProperties = getPropertiesOfType(baseType);
|
|
85223
|
-
var
|
|
85290
|
+
var _loop_34 = function (baseProperty) {
|
|
85224
85291
|
var base = getTargetSymbol(baseProperty);
|
|
85225
85292
|
if (base.flags & 4194304 /* Prototype */) {
|
|
85226
85293
|
return "continue";
|
|
@@ -85330,7 +85397,7 @@ var ts;
|
|
|
85330
85397
|
};
|
|
85331
85398
|
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
|
|
85332
85399
|
var baseProperty = baseProperties_1[_i];
|
|
85333
|
-
var state_10 =
|
|
85400
|
+
var state_10 = _loop_34(baseProperty);
|
|
85334
85401
|
switch (state_10) {
|
|
85335
85402
|
case "continue-basePropertyCheck": continue basePropertyCheck;
|
|
85336
85403
|
}
|
|
@@ -111845,7 +111912,6 @@ var ts;
|
|
|
111845
111912
|
if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
|
|
111846
111913
|
// Update the output signature
|
|
111847
111914
|
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, createHash, changedDtsData);
|
|
111848
|
-
newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
|
|
111849
111915
|
}
|
|
111850
111916
|
// Update sourceFileInfo
|
|
111851
111917
|
var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
|
|
@@ -121232,7 +121298,7 @@ var ts;
|
|
|
121232
121298
|
state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
|
|
121233
121299
|
}
|
|
121234
121300
|
state.changedFilesSet = new ts.Set();
|
|
121235
|
-
state.
|
|
121301
|
+
state.latestChangedDtsFile = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.latestChangedDtsFile : undefined;
|
|
121236
121302
|
var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
|
|
121237
121303
|
var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
|
|
121238
121304
|
var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
|
|
@@ -121356,7 +121422,7 @@ var ts;
|
|
|
121356
121422
|
programEmitComplete: state.programEmitComplete,
|
|
121357
121423
|
emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
|
|
121358
121424
|
outSignature: state.outSignature,
|
|
121359
|
-
|
|
121425
|
+
latestChangedDtsFile: state.latestChangedDtsFile,
|
|
121360
121426
|
hasChangedEmitSignature: state.hasChangedEmitSignature,
|
|
121361
121427
|
changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
|
|
121362
121428
|
};
|
|
@@ -121369,7 +121435,7 @@ var ts;
|
|
|
121369
121435
|
state.programEmitComplete = savedEmitState.programEmitComplete;
|
|
121370
121436
|
state.emitSignatures = savedEmitState.emitSignatures;
|
|
121371
121437
|
state.outSignature = savedEmitState.outSignature;
|
|
121372
|
-
state.
|
|
121438
|
+
state.latestChangedDtsFile = savedEmitState.latestChangedDtsFile;
|
|
121373
121439
|
state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
|
|
121374
121440
|
if (savedEmitState.changedFilesSet)
|
|
121375
121441
|
state.changedFilesSet = savedEmitState.changedFilesSet;
|
|
@@ -121683,14 +121749,14 @@ var ts;
|
|
|
121683
121749
|
/**
|
|
121684
121750
|
* Gets the program information to be emitted in buildInfo so that we can use it to create new program
|
|
121685
121751
|
*/
|
|
121686
|
-
function getProgramBuildInfo(state, getCanonicalFileName
|
|
121752
|
+
function getProgramBuildInfo(state, getCanonicalFileName) {
|
|
121687
121753
|
var outFilePath = ts.outFile(state.compilerOptions);
|
|
121688
121754
|
if (outFilePath && !state.compilerOptions.composite)
|
|
121689
121755
|
return;
|
|
121690
121756
|
var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
|
|
121691
121757
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
|
|
121692
|
-
//
|
|
121693
|
-
|
|
121758
|
+
// 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
|
|
121759
|
+
var latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : undefined;
|
|
121694
121760
|
if (outFilePath) {
|
|
121695
121761
|
var fileNames_1 = [];
|
|
121696
121762
|
var fileInfos_1 = [];
|
|
@@ -121706,7 +121772,7 @@ var ts;
|
|
|
121706
121772
|
fileInfos: fileInfos_1,
|
|
121707
121773
|
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
|
|
121708
121774
|
outSignature: state.outSignature,
|
|
121709
|
-
|
|
121775
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
121710
121776
|
};
|
|
121711
121777
|
return result_15;
|
|
121712
121778
|
}
|
|
@@ -121808,7 +121874,7 @@ var ts;
|
|
|
121808
121874
|
affectedFilesPendingEmit: affectedFilesPendingEmit,
|
|
121809
121875
|
changeFileSet: changeFileSet,
|
|
121810
121876
|
emitSignatures: emitSignatures,
|
|
121811
|
-
|
|
121877
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
121812
121878
|
};
|
|
121813
121879
|
return result;
|
|
121814
121880
|
function relativeToBuildInfoEnsuringAbsolutePath(path) {
|
|
@@ -121976,7 +122042,7 @@ var ts;
|
|
|
121976
122042
|
*/
|
|
121977
122043
|
var computeHash = ts.maybeBind(host, host.createHash);
|
|
121978
122044
|
var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
|
|
121979
|
-
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName
|
|
122045
|
+
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
|
|
121980
122046
|
// To ensure that we arent storing any references to old program or new program without state
|
|
121981
122047
|
newProgram = undefined; // TODO: GH#18217
|
|
121982
122048
|
oldProgram = undefined;
|
|
@@ -121986,6 +122052,7 @@ var ts;
|
|
|
121986
122052
|
builderProgram.getState = getState;
|
|
121987
122053
|
builderProgram.saveEmitState = function () { return backupBuilderProgramEmitState(state); };
|
|
121988
122054
|
builderProgram.restoreEmitState = function (saved) { return restoreBuilderProgramEmitState(state, saved); };
|
|
122055
|
+
builderProgram.hasChangedEmitSignature = function () { return !!state.hasChangedEmitSignature; };
|
|
121989
122056
|
builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
|
|
121990
122057
|
builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
|
|
121991
122058
|
builderProgram.emit = emit;
|
|
@@ -122093,18 +122160,22 @@ var ts;
|
|
|
122093
122160
|
var filePath = sourceFiles[0].resolvedPath;
|
|
122094
122161
|
var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath);
|
|
122095
122162
|
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text, computeHash, data));
|
|
122096
|
-
if
|
|
122097
|
-
|
|
122098
|
-
|
|
122099
|
-
|
|
122163
|
+
// Dont write dts files if they didn't change
|
|
122164
|
+
if (emitSignature === oldSignature)
|
|
122165
|
+
return;
|
|
122166
|
+
((_g = state.emitSignatures) !== null && _g !== void 0 ? _g : (state.emitSignatures = new ts.Map())).set(filePath, emitSignature);
|
|
122167
|
+
state.hasChangedEmitSignature = true;
|
|
122168
|
+
state.latestChangedDtsFile = fileName;
|
|
122100
122169
|
}
|
|
122101
122170
|
}
|
|
122102
122171
|
else if (state.compilerOptions.composite) {
|
|
122103
122172
|
var newSignature = computeSignature(text, computeHash, data);
|
|
122104
|
-
if
|
|
122105
|
-
|
|
122106
|
-
|
|
122107
|
-
|
|
122173
|
+
// Dont write dts files if they didn't change
|
|
122174
|
+
if (newSignature === state.outSignature)
|
|
122175
|
+
return;
|
|
122176
|
+
state.outSignature = newSignature;
|
|
122177
|
+
state.hasChangedEmitSignature = true;
|
|
122178
|
+
state.latestChangedDtsFile = fileName;
|
|
122108
122179
|
}
|
|
122109
122180
|
}
|
|
122110
122181
|
if (writeFile)
|
|
@@ -122267,11 +122338,12 @@ var ts;
|
|
|
122267
122338
|
var state;
|
|
122268
122339
|
var filePaths;
|
|
122269
122340
|
var filePathsSetList;
|
|
122341
|
+
var latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : undefined;
|
|
122270
122342
|
if (isProgramBundleEmitBuildInfo(program)) {
|
|
122271
122343
|
state = {
|
|
122272
122344
|
fileInfos: new ts.Map(),
|
|
122273
122345
|
compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
|
|
122274
|
-
|
|
122346
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
122275
122347
|
outSignature: program.outSignature,
|
|
122276
122348
|
};
|
|
122277
122349
|
}
|
|
@@ -122304,7 +122376,7 @@ var ts;
|
|
|
122304
122376
|
affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
|
|
122305
122377
|
affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
|
|
122306
122378
|
changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
|
|
122307
|
-
|
|
122379
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
122308
122380
|
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
|
122309
122381
|
};
|
|
122310
122382
|
}
|
|
@@ -122331,6 +122403,7 @@ var ts;
|
|
|
122331
122403
|
getSemanticDiagnosticsOfNextAffectedFile: ts.notImplemented,
|
|
122332
122404
|
emitBuildInfo: ts.notImplemented,
|
|
122333
122405
|
close: ts.noop,
|
|
122406
|
+
hasChangedEmitSignature: ts.returnFalse,
|
|
122334
122407
|
};
|
|
122335
122408
|
function toPath(path) {
|
|
122336
122409
|
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
@@ -123645,7 +123718,7 @@ var ts;
|
|
|
123645
123718
|
});
|
|
123646
123719
|
// Sort by paths closest to importing file Name directory
|
|
123647
123720
|
var sortedPaths = [];
|
|
123648
|
-
var
|
|
123721
|
+
var _loop_35 = function (directory) {
|
|
123649
123722
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
123650
123723
|
var pathsInDirectory;
|
|
123651
123724
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -123669,7 +123742,7 @@ var ts;
|
|
|
123669
123742
|
};
|
|
123670
123743
|
var out_directory_1;
|
|
123671
123744
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
123672
|
-
var state_11 =
|
|
123745
|
+
var state_11 = _loop_35(directory);
|
|
123673
123746
|
directory = out_directory_1;
|
|
123674
123747
|
if (state_11 === "break")
|
|
123675
123748
|
break;
|
|
@@ -124513,7 +124586,6 @@ var ts;
|
|
|
124513
124586
|
readDirectory: ts.maybeBind(host, host.readDirectory),
|
|
124514
124587
|
disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
|
|
124515
124588
|
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
|
|
124516
|
-
now: ts.maybeBind(host, host.now),
|
|
124517
124589
|
};
|
|
124518
124590
|
function writeFile(fileName, text, writeByteOrderMark, onError) {
|
|
124519
124591
|
try {
|
|
@@ -124671,7 +124743,6 @@ var ts;
|
|
|
124671
124743
|
host.createHash = ts.maybeBind(system, system.createHash);
|
|
124672
124744
|
host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
|
|
124673
124745
|
host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
|
|
124674
|
-
host.now = ts.maybeBind(system, system.now);
|
|
124675
124746
|
ts.setGetSourceFileAsHashVersioned(host, system);
|
|
124676
124747
|
ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
|
|
124677
124748
|
return host;
|
|
@@ -125999,8 +126070,7 @@ var ts;
|
|
|
125999
126070
|
}
|
|
126000
126071
|
// Actual Emit
|
|
126001
126072
|
var host = state.host, compilerHost = state.compilerHost;
|
|
126002
|
-
var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
|
|
126003
|
-
var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
|
|
126073
|
+
var resultFlags = ((_d = program.hasChangedEmitSignature) === null || _d === void 0 ? void 0 : _d.call(program)) ? BuildResultFlags.None : BuildResultFlags.DeclarationOutputUnchanged;
|
|
126004
126074
|
var emitterDiagnostics = ts.createDiagnosticCollection();
|
|
126005
126075
|
var emittedOutputs = new ts.Map();
|
|
126006
126076
|
var options = program.getCompilerOptions();
|
|
@@ -126008,17 +126078,11 @@ var ts;
|
|
|
126008
126078
|
var outputTimeStampMap;
|
|
126009
126079
|
var now;
|
|
126010
126080
|
outputFiles.forEach(function (_a) {
|
|
126011
|
-
var _b, _c;
|
|
126012
126081
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
126013
126082
|
var path = toPath(state, name);
|
|
126014
126083
|
emittedOutputs.set(toPath(state, name), name);
|
|
126015
|
-
if (buildInfo)
|
|
126016
|
-
setBuildInfo(state, buildInfo, projectPath, options);
|
|
126017
|
-
// Buildinfo has information on when last dts change time
|
|
126018
|
-
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)) {
|
|
126019
|
-
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
|
126020
|
-
}
|
|
126021
|
-
}
|
|
126084
|
+
if (buildInfo)
|
|
126085
|
+
setBuildInfo(state, buildInfo, projectPath, options, resultFlags);
|
|
126022
126086
|
ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
|
|
126023
126087
|
if (!isIncremental && state.watch) {
|
|
126024
126088
|
(outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
|
|
@@ -126032,7 +126096,7 @@ var ts;
|
|
|
126032
126096
|
ts.Debug.assert(step === BuildStep.EmitBuildInfo);
|
|
126033
126097
|
var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
|
|
126034
126098
|
if (data === null || data === void 0 ? void 0 : data.buildInfo)
|
|
126035
|
-
setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
|
|
126099
|
+
setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions(), BuildResultFlags.DeclarationOutputUnchanged);
|
|
126036
126100
|
if (writeFileCallback)
|
|
126037
126101
|
writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
126038
126102
|
else
|
|
@@ -126065,7 +126129,6 @@ var ts;
|
|
|
126065
126129
|
state.diagnostics.delete(projectPath);
|
|
126066
126130
|
state.projectStatus.set(projectPath, {
|
|
126067
126131
|
type: ts.UpToDateStatusType.UpToDate,
|
|
126068
|
-
newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
|
|
126069
126132
|
oldestOutputFileName: oldestOutputFileName
|
|
126070
126133
|
});
|
|
126071
126134
|
afterProgramDone(state, program, config);
|
|
@@ -126107,10 +126170,10 @@ var ts;
|
|
|
126107
126170
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
126108
126171
|
emittedOutputs.set(toPath(state, name), name);
|
|
126109
126172
|
if (buildInfo) {
|
|
126110
|
-
|
|
126111
|
-
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
|
|
126173
|
+
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) {
|
|
126112
126174
|
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
|
126113
126175
|
}
|
|
126176
|
+
setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags);
|
|
126114
126177
|
}
|
|
126115
126178
|
ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
|
|
126116
126179
|
});
|
|
@@ -126369,15 +126432,23 @@ var ts;
|
|
|
126369
126432
|
state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
|
|
126370
126433
|
return result;
|
|
126371
126434
|
}
|
|
126372
|
-
function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
|
|
126435
|
+
function setBuildInfo(state, buildInfo, resolvedConfigPath, options, resultFlags) {
|
|
126373
126436
|
var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
|
|
126374
126437
|
var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
|
|
126438
|
+
var modifiedTime = getCurrentTime(state.host);
|
|
126375
126439
|
if (existing) {
|
|
126376
126440
|
existing.buildInfo = buildInfo;
|
|
126377
|
-
existing.modifiedTime =
|
|
126441
|
+
existing.modifiedTime = modifiedTime;
|
|
126442
|
+
if (!(resultFlags & BuildResultFlags.DeclarationOutputUnchanged))
|
|
126443
|
+
existing.latestChangedDtsTime = modifiedTime;
|
|
126378
126444
|
}
|
|
126379
126445
|
else {
|
|
126380
|
-
state.buildInfoCache.set(resolvedConfigPath, {
|
|
126446
|
+
state.buildInfoCache.set(resolvedConfigPath, {
|
|
126447
|
+
path: toPath(state, buildInfoPath),
|
|
126448
|
+
buildInfo: buildInfo,
|
|
126449
|
+
modifiedTime: modifiedTime,
|
|
126450
|
+
latestChangedDtsTime: resultFlags & BuildResultFlags.DeclarationOutputUnchanged ? undefined : modifiedTime,
|
|
126451
|
+
});
|
|
126381
126452
|
}
|
|
126382
126453
|
}
|
|
126383
126454
|
function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
|
|
@@ -126409,7 +126480,7 @@ var ts;
|
|
|
126409
126480
|
}
|
|
126410
126481
|
}
|
|
126411
126482
|
function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
126412
|
-
var _a, _b
|
|
126483
|
+
var _a, _b;
|
|
126413
126484
|
// Container if no files are specified in the project
|
|
126414
126485
|
if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
|
|
126415
126486
|
return {
|
|
@@ -126421,8 +126492,8 @@ var ts;
|
|
|
126421
126492
|
var force = !!state.options.force;
|
|
126422
126493
|
if (project.projectReferences) {
|
|
126423
126494
|
state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
|
|
126424
|
-
for (var _i = 0,
|
|
126425
|
-
var ref =
|
|
126495
|
+
for (var _i = 0, _c = project.projectReferences; _i < _c.length; _i++) {
|
|
126496
|
+
var ref = _c[_i];
|
|
126426
126497
|
var resolvedRef = ts.resolveProjectReferencePath(ref);
|
|
126427
126498
|
var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
|
|
126428
126499
|
var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
|
|
@@ -126462,7 +126533,6 @@ var ts;
|
|
|
126462
126533
|
var buildInfoTime;
|
|
126463
126534
|
var buildInfoProgram;
|
|
126464
126535
|
var buildInfoVersionMap;
|
|
126465
|
-
var newestDeclarationFileContentChangedTime;
|
|
126466
126536
|
if (buildInfoPath) {
|
|
126467
126537
|
var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
|
|
126468
126538
|
buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
|
|
@@ -126499,8 +126569,6 @@ var ts;
|
|
|
126499
126569
|
}
|
|
126500
126570
|
oldestOutputFileTime = buildInfoTime;
|
|
126501
126571
|
oldestOutputFileName = buildInfoPath;
|
|
126502
|
-
// Get the last dtsChange time from build info
|
|
126503
|
-
newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
|
|
126504
126572
|
}
|
|
126505
126573
|
// Check input files
|
|
126506
126574
|
var newestInputFileName = undefined;
|
|
@@ -126508,8 +126576,8 @@ var ts;
|
|
|
126508
126576
|
/** 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 */
|
|
126509
126577
|
var pseudoInputUpToDate = false;
|
|
126510
126578
|
// Get timestamps of input files
|
|
126511
|
-
for (var
|
|
126512
|
-
var inputFile =
|
|
126579
|
+
for (var _d = 0, _e = project.fileNames; _d < _e.length; _d++) {
|
|
126580
|
+
var inputFile = _e[_d];
|
|
126513
126581
|
var inputTime = getModifiedTime(state, inputFile);
|
|
126514
126582
|
if (inputTime === ts.missingFileModifiedTime) {
|
|
126515
126583
|
return {
|
|
@@ -126550,8 +126618,8 @@ var ts;
|
|
|
126550
126618
|
// Collect the expected outputs of this project
|
|
126551
126619
|
var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
|
|
126552
126620
|
var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
|
|
126553
|
-
for (var
|
|
126554
|
-
var output = outputs_1[
|
|
126621
|
+
for (var _f = 0, outputs_1 = outputs; _f < outputs_1.length; _f++) {
|
|
126622
|
+
var output = outputs_1[_f];
|
|
126555
126623
|
var path = toPath(state, output);
|
|
126556
126624
|
// Output is missing; can stop checking
|
|
126557
126625
|
var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
|
|
@@ -126589,8 +126657,8 @@ var ts;
|
|
|
126589
126657
|
var usesPrepend = false;
|
|
126590
126658
|
var upstreamChangedProject;
|
|
126591
126659
|
if (referenceStatuses) {
|
|
126592
|
-
for (var
|
|
126593
|
-
var
|
|
126660
|
+
for (var _g = 0, referenceStatuses_1 = referenceStatuses; _g < referenceStatuses_1.length; _g++) {
|
|
126661
|
+
var _h = referenceStatuses_1[_g], ref = _h.ref, refStatus = _h.refStatus, resolvedConfig = _h.resolvedConfig, resolvedRefPath = _h.resolvedRefPath;
|
|
126594
126662
|
usesPrepend = usesPrepend || !!(ref.prepend);
|
|
126595
126663
|
// If the upstream project's newest file is older than our oldest output, we
|
|
126596
126664
|
// can't be out of date because of it
|
|
@@ -126607,7 +126675,8 @@ var ts;
|
|
|
126607
126675
|
}
|
|
126608
126676
|
// If the upstream project has only change .d.ts files, and we've built
|
|
126609
126677
|
// *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
|
|
126610
|
-
|
|
126678
|
+
var newestDeclarationFileContentChangedTime = getLatestChangedDtsTime(state, resolvedConfig.options, resolvedRefPath);
|
|
126679
|
+
if (newestDeclarationFileContentChangedTime && newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
|
|
126611
126680
|
pseudoUpToDate = true;
|
|
126612
126681
|
upstreamChangedProject = ref.path;
|
|
126613
126682
|
continue;
|
|
@@ -126650,7 +126719,6 @@ var ts;
|
|
|
126650
126719
|
pseudoInputUpToDate ?
|
|
126651
126720
|
ts.UpToDateStatusType.UpToDateWithInputFileText :
|
|
126652
126721
|
ts.UpToDateStatusType.UpToDate,
|
|
126653
|
-
newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
|
|
126654
126722
|
newestInputFileTime: newestInputFileTime,
|
|
126655
126723
|
newestInputFileName: newestInputFileName,
|
|
126656
126724
|
oldestOutputFileName: oldestOutputFileName
|
|
@@ -126734,13 +126802,17 @@ var ts;
|
|
|
126734
126802
|
outputTimeStampMap.delete(key);
|
|
126735
126803
|
});
|
|
126736
126804
|
}
|
|
126737
|
-
function
|
|
126738
|
-
var _a;
|
|
126805
|
+
function getLatestChangedDtsTime(state, options, resolvedConfigPath) {
|
|
126739
126806
|
if (!options.composite)
|
|
126740
126807
|
return undefined;
|
|
126741
|
-
var
|
|
126742
|
-
|
|
126743
|
-
|
|
126808
|
+
var entry = ts.Debug.checkDefined(state.buildInfoCache.get(resolvedConfigPath));
|
|
126809
|
+
if (entry.latestChangedDtsTime !== undefined)
|
|
126810
|
+
return entry.latestChangedDtsTime || undefined;
|
|
126811
|
+
var latestChangedDtsTime = entry.buildInfo && entry.buildInfo.program && entry.buildInfo.program.latestChangedDtsFile ?
|
|
126812
|
+
state.host.getModifiedTime(ts.getNormalizedAbsolutePath(entry.buildInfo.program.latestChangedDtsFile, ts.getDirectoryPath(entry.path))) :
|
|
126813
|
+
undefined;
|
|
126814
|
+
entry.latestChangedDtsTime = latestChangedDtsTime || false;
|
|
126815
|
+
return latestChangedDtsTime;
|
|
126744
126816
|
}
|
|
126745
126817
|
function updateOutputTimestamps(state, proj, resolvedPath) {
|
|
126746
126818
|
if (state.options.dry) {
|
|
@@ -126749,7 +126821,6 @@ var ts;
|
|
|
126749
126821
|
updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
|
|
126750
126822
|
state.projectStatus.set(resolvedPath, {
|
|
126751
126823
|
type: ts.UpToDateStatusType.UpToDate,
|
|
126752
|
-
newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
|
|
126753
126824
|
oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
|
|
126754
126825
|
});
|
|
126755
126826
|
}
|