typescript 4.8.0-dev.20220628 → 4.8.0-dev.20220701
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 +264 -180
- package/lib/tsserver.js +302 -218
- package/lib/tsserverlibrary.js +302 -218
- package/lib/typescript.js +302 -218
- package/lib/typescriptServices.js +302 -218
- package/lib/typingsInstaller.js +274 -189
- 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.20220701";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -3309,6 +3309,22 @@ var ts;
|
|
|
3309
3309
|
return wrapFunction(deprecation, func);
|
|
3310
3310
|
}
|
|
3311
3311
|
Debug.deprecate = deprecate;
|
|
3312
|
+
function formatVariance(varianceFlags) {
|
|
3313
|
+
var variance = varianceFlags & 7 /* VarianceMask */;
|
|
3314
|
+
var result = variance === 0 /* Invariant */ ? "in out" :
|
|
3315
|
+
variance === 3 /* Bivariant */ ? "[bivariant]" :
|
|
3316
|
+
variance === 2 /* Contravariant */ ? "in" :
|
|
3317
|
+
variance === 1 /* Covariant */ ? "out" :
|
|
3318
|
+
variance === 4 /* Independent */ ? "[independent]" : "";
|
|
3319
|
+
if (varianceFlags & 8 /* Unmeasurable */) {
|
|
3320
|
+
result += " (unmeasurable)";
|
|
3321
|
+
}
|
|
3322
|
+
else if (varianceFlags & 16 /* Unreliable */) {
|
|
3323
|
+
result += " (unreliable)";
|
|
3324
|
+
}
|
|
3325
|
+
return result;
|
|
3326
|
+
}
|
|
3327
|
+
Debug.formatVariance = formatVariance;
|
|
3312
3328
|
})(Debug = ts.Debug || (ts.Debug = {}));
|
|
3313
3329
|
})(ts || (ts = {}));
|
|
3314
3330
|
/* @internal */
|
|
@@ -4050,9 +4066,9 @@ var ts;
|
|
|
4050
4066
|
eventStack.push({ phase: phase, name: name, args: args, time: 1000 * ts.timestamp(), separateBeginAndEnd: separateBeginAndEnd });
|
|
4051
4067
|
}
|
|
4052
4068
|
tracingEnabled.push = push;
|
|
4053
|
-
function pop() {
|
|
4069
|
+
function pop(results) {
|
|
4054
4070
|
ts.Debug.assert(eventStack.length > 0);
|
|
4055
|
-
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp());
|
|
4071
|
+
writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp(), results);
|
|
4056
4072
|
eventStack.length--;
|
|
4057
4073
|
}
|
|
4058
4074
|
tracingEnabled.pop = pop;
|
|
@@ -4066,14 +4082,15 @@ var ts;
|
|
|
4066
4082
|
tracingEnabled.popAll = popAll;
|
|
4067
4083
|
// sample every 10ms
|
|
4068
4084
|
var sampleInterval = 1000 * 10;
|
|
4069
|
-
function writeStackEvent(index, endTime) {
|
|
4085
|
+
function writeStackEvent(index, endTime, results) {
|
|
4070
4086
|
var _a = eventStack[index], phase = _a.phase, name = _a.name, args = _a.args, time = _a.time, separateBeginAndEnd = _a.separateBeginAndEnd;
|
|
4071
4087
|
if (separateBeginAndEnd) {
|
|
4088
|
+
ts.Debug.assert(!results, "`results` are not supported for events with `separateBeginAndEnd`");
|
|
4072
4089
|
writeEvent("E", phase, name, args, /*extras*/ undefined, endTime);
|
|
4073
4090
|
}
|
|
4074
4091
|
// test if [time,endTime) straddles a sampling point
|
|
4075
4092
|
else if (sampleInterval - (time % sampleInterval) <= endTime - time) {
|
|
4076
|
-
writeEvent("X", phase, name, args, "\"dur\":" + (endTime - time), time);
|
|
4093
|
+
writeEvent("X", phase, name, __assign(__assign({}, args), { results: results }), "\"dur\":" + (endTime - time), time);
|
|
4077
4094
|
}
|
|
4078
4095
|
}
|
|
4079
4096
|
function writeEvent(eventType, phase, name, args, extras, time) {
|
|
@@ -5444,9 +5461,10 @@ var ts;
|
|
|
5444
5461
|
(function (TypeMapKind) {
|
|
5445
5462
|
TypeMapKind[TypeMapKind["Simple"] = 0] = "Simple";
|
|
5446
5463
|
TypeMapKind[TypeMapKind["Array"] = 1] = "Array";
|
|
5447
|
-
TypeMapKind[TypeMapKind["
|
|
5448
|
-
TypeMapKind[TypeMapKind["
|
|
5449
|
-
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";
|
|
5450
5468
|
})(TypeMapKind = ts.TypeMapKind || (ts.TypeMapKind = {}));
|
|
5451
5469
|
var InferencePriority;
|
|
5452
5470
|
(function (InferencePriority) {
|
|
@@ -48849,6 +48867,24 @@ var ts;
|
|
|
48849
48867
|
var Symbol = ts.objectAllocator.getSymbolConstructor();
|
|
48850
48868
|
var Type = ts.objectAllocator.getTypeConstructor();
|
|
48851
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
|
+
}());
|
|
48852
48888
|
var typeCount = 0;
|
|
48853
48889
|
var symbolCount = 0;
|
|
48854
48890
|
var enumCount = 0;
|
|
@@ -49309,10 +49345,23 @@ var ts;
|
|
|
49309
49345
|
var numberOrBigIntType = getUnionType([numberType, bigintType]);
|
|
49310
49346
|
var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
|
|
49311
49347
|
var numericStringType = getTemplateLiteralType(["", ""], [numberType]); // The `${number}` type
|
|
49312
|
-
var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; });
|
|
49313
|
-
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)"; });
|
|
49314
49350
|
var uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never"); // `uniqueLiteralType` is a special `never` flagged by union reduction to behave as a literal
|
|
49315
|
-
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)"; });
|
|
49316
49365
|
var emptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49317
49366
|
var emptyJsxObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
49318
49367
|
emptyJsxObjectType.objectFlags |= 2048 /* JsxAttributes */;
|
|
@@ -49472,7 +49521,6 @@ var ts;
|
|
|
49472
49521
|
var typeofType = createTypeofType();
|
|
49473
49522
|
var _jsxNamespace;
|
|
49474
49523
|
var _jsxFactoryEntity;
|
|
49475
|
-
var outofbandVarianceMarkerHandler;
|
|
49476
49524
|
var subtypeRelation = new ts.Map();
|
|
49477
49525
|
var strictSubtypeRelation = new ts.Map();
|
|
49478
49526
|
var assignableRelation = new ts.Map();
|
|
@@ -53239,7 +53287,7 @@ var ts;
|
|
|
53239
53287
|
var name = typeParameterToName(newParam, context);
|
|
53240
53288
|
var newTypeVariable = ts.factory.createTypeReferenceNode(name);
|
|
53241
53289
|
context.approximateLength += 37; // 15 each for two added conditionals, 7 for an added infer type
|
|
53242
|
-
var newMapper = prependTypeMapping(type.root.checkType, newParam, type.
|
|
53290
|
+
var newMapper = prependTypeMapping(type.root.checkType, newParam, type.mapper);
|
|
53243
53291
|
var saveInferTypeParameters_1 = context.inferTypeParameters;
|
|
53244
53292
|
context.inferTypeParameters = type.root.inferTypeParameters;
|
|
53245
53293
|
var extendsTypeNode_1 = typeToTypeNodeHelper(instantiateType(type.root.extendsType, newMapper), context);
|
|
@@ -60650,8 +60698,7 @@ var ts;
|
|
|
60650
60698
|
var _a;
|
|
60651
60699
|
var inferences;
|
|
60652
60700
|
if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
|
|
60653
|
-
|
|
60654
|
-
var declaration = _b[_i];
|
|
60701
|
+
var _loop_15 = function (declaration) {
|
|
60655
60702
|
if (declaration.parent.kind === 190 /* InferType */) {
|
|
60656
60703
|
// When an 'infer T' declaration is immediately contained in a type reference node
|
|
60657
60704
|
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
|
|
@@ -60659,12 +60706,12 @@ var ts;
|
|
|
60659
60706
|
// present, we form an intersection of the inferred constraint types.
|
|
60660
60707
|
var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1];
|
|
60661
60708
|
if (grandParent.kind === 178 /* TypeReference */ && !omitTypeReferences) {
|
|
60662
|
-
var
|
|
60663
|
-
var
|
|
60664
|
-
if (
|
|
60665
|
-
var index =
|
|
60666
|
-
if (index <
|
|
60667
|
-
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]);
|
|
60668
60715
|
if (declaredConstraint) {
|
|
60669
60716
|
// Type parameter constraints can reference other type parameters so
|
|
60670
60717
|
// constraints need to be instantiated. If instantiation produces the
|
|
@@ -60672,7 +60719,9 @@ var ts;
|
|
|
60672
60719
|
// type Foo<T extends string, U extends T> = [T, U];
|
|
60673
60720
|
// type Bar<T> = T extends Foo<infer X, infer X> ? Foo<X, X> : T;
|
|
60674
60721
|
// the instantiated constraint for U is X, so we discard that inference.
|
|
60675
|
-
var mapper =
|
|
60722
|
+
var mapper = makeDeferredTypeMapper(typeParameters_1, typeParameters_1.map(function (_, index) { return function () {
|
|
60723
|
+
return getEffectiveTypeArgumentAtIndex(typeReference_1, typeParameters_1, index);
|
|
60724
|
+
}; }));
|
|
60676
60725
|
var constraint = instantiateType(declaredConstraint, mapper);
|
|
60677
60726
|
if (constraint !== typeParameter) {
|
|
60678
60727
|
inferences = ts.append(inferences, constraint);
|
|
@@ -60710,6 +60759,10 @@ var ts;
|
|
|
60710
60759
|
inferences = ts.append(inferences, instantiateType(nodeType, makeUnaryTypeMapper(getDeclaredTypeOfTypeParameter(getSymbolOfNode(checkMappedType_1.typeParameter)), checkMappedType_1.typeParameter.constraint ? getTypeFromTypeNode(checkMappedType_1.typeParameter.constraint) : keyofConstraintType)));
|
|
60711
60760
|
}
|
|
60712
60761
|
}
|
|
60762
|
+
};
|
|
60763
|
+
for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
|
|
60764
|
+
var declaration = _b[_i];
|
|
60765
|
+
_loop_15(declaration);
|
|
60713
60766
|
}
|
|
60714
60767
|
}
|
|
60715
60768
|
return inferences && getIntersectionType(inferences);
|
|
@@ -61598,7 +61651,7 @@ var ts;
|
|
|
61598
61651
|
var lastRequiredIndex = -1;
|
|
61599
61652
|
var firstRestIndex = -1;
|
|
61600
61653
|
var lastOptionalOrRestIndex = -1;
|
|
61601
|
-
var
|
|
61654
|
+
var _loop_16 = function (i) {
|
|
61602
61655
|
var type = elementTypes[i];
|
|
61603
61656
|
var flags = target.elementFlags[i];
|
|
61604
61657
|
if (flags & 8 /* Variadic */) {
|
|
@@ -61628,7 +61681,7 @@ var ts;
|
|
|
61628
61681
|
}
|
|
61629
61682
|
};
|
|
61630
61683
|
for (var i = 0; i < elementTypes.length; i++) {
|
|
61631
|
-
var state_4 =
|
|
61684
|
+
var state_4 = _loop_16(i);
|
|
61632
61685
|
if (typeof state_4 === "object")
|
|
61633
61686
|
return state_4.value;
|
|
61634
61687
|
}
|
|
@@ -61824,7 +61877,7 @@ var ts;
|
|
|
61824
61877
|
var templates = ts.filter(types, isPatternLiteralType);
|
|
61825
61878
|
if (templates.length) {
|
|
61826
61879
|
var i = types.length;
|
|
61827
|
-
var
|
|
61880
|
+
var _loop_17 = function () {
|
|
61828
61881
|
i--;
|
|
61829
61882
|
var t = types[i];
|
|
61830
61883
|
if (t.flags & 128 /* StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
|
|
@@ -61832,7 +61885,7 @@ var ts;
|
|
|
61832
61885
|
}
|
|
61833
61886
|
};
|
|
61834
61887
|
while (i > 0) {
|
|
61835
|
-
|
|
61888
|
+
_loop_17();
|
|
61836
61889
|
}
|
|
61837
61890
|
}
|
|
61838
61891
|
}
|
|
@@ -61909,14 +61962,14 @@ var ts;
|
|
|
61909
61962
|
var namedUnions = [];
|
|
61910
61963
|
addNamedUnions(namedUnions, types);
|
|
61911
61964
|
var reducedTypes = [];
|
|
61912
|
-
var
|
|
61965
|
+
var _loop_18 = function (t) {
|
|
61913
61966
|
if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
|
|
61914
61967
|
reducedTypes.push(t);
|
|
61915
61968
|
}
|
|
61916
61969
|
};
|
|
61917
61970
|
for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
|
|
61918
61971
|
var t = typeSet_1[_i];
|
|
61919
|
-
|
|
61972
|
+
_loop_18(t);
|
|
61920
61973
|
}
|
|
61921
61974
|
if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
|
|
61922
61975
|
return namedUnions[0];
|
|
@@ -63140,7 +63193,7 @@ var ts;
|
|
|
63140
63193
|
var result;
|
|
63141
63194
|
var extraTypes;
|
|
63142
63195
|
var tailCount = 0;
|
|
63143
|
-
var
|
|
63196
|
+
var _loop_19 = function () {
|
|
63144
63197
|
if (tailCount === 1000) {
|
|
63145
63198
|
error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
63146
63199
|
result = errorType;
|
|
@@ -63261,7 +63314,7 @@ var ts;
|
|
|
63261
63314
|
// another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
|
|
63262
63315
|
// cases we increment the tail recursion counter and stop after 1000 iterations.
|
|
63263
63316
|
while (true) {
|
|
63264
|
-
var state_5 =
|
|
63317
|
+
var state_5 = _loop_19();
|
|
63265
63318
|
if (typeof state_5 === "object")
|
|
63266
63319
|
return state_5.value;
|
|
63267
63320
|
if (state_5 === "break")
|
|
@@ -63891,7 +63944,7 @@ var ts;
|
|
|
63891
63944
|
switch (mapper.kind) {
|
|
63892
63945
|
case 0 /* Simple */:
|
|
63893
63946
|
return type === mapper.source ? mapper.target : type;
|
|
63894
|
-
case 1 /* Array */:
|
|
63947
|
+
case 1 /* Array */: {
|
|
63895
63948
|
var sources = mapper.sources;
|
|
63896
63949
|
var targets = mapper.targets;
|
|
63897
63950
|
for (var i = 0; i < sources.length; i++) {
|
|
@@ -63900,25 +63953,45 @@ var ts;
|
|
|
63900
63953
|
}
|
|
63901
63954
|
}
|
|
63902
63955
|
return type;
|
|
63903
|
-
|
|
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 */:
|
|
63904
63968
|
return mapper.func(type);
|
|
63905
|
-
case
|
|
63906
|
-
case
|
|
63969
|
+
case 4 /* Composite */:
|
|
63970
|
+
case 5 /* Merged */:
|
|
63907
63971
|
var t1 = getMappedType(type, mapper.mapper1);
|
|
63908
|
-
return t1 !== type && mapper.kind ===
|
|
63972
|
+
return t1 !== type && mapper.kind === 4 /* Composite */ ? instantiateType(t1, mapper.mapper2) : getMappedType(t1, mapper.mapper2);
|
|
63909
63973
|
}
|
|
63910
63974
|
}
|
|
63975
|
+
function attachDebugPrototypeIfDebug(mapper) {
|
|
63976
|
+
if (ts.Debug.isDebugging) {
|
|
63977
|
+
return Object.setPrototypeOf(mapper, DebugTypeMapper.prototype);
|
|
63978
|
+
}
|
|
63979
|
+
return mapper;
|
|
63980
|
+
}
|
|
63911
63981
|
function makeUnaryTypeMapper(source, target) {
|
|
63912
|
-
return { kind: 0 /* Simple */, source: source, target: target };
|
|
63982
|
+
return attachDebugPrototypeIfDebug({ kind: 0 /* Simple */, source: source, target: target });
|
|
63913
63983
|
}
|
|
63914
63984
|
function makeArrayTypeMapper(sources, targets) {
|
|
63915
|
-
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 });
|
|
63916
63989
|
}
|
|
63917
|
-
function
|
|
63918
|
-
return { kind: 2 /*
|
|
63990
|
+
function makeDeferredTypeMapper(sources, targets) {
|
|
63991
|
+
return attachDebugPrototypeIfDebug({ kind: 2 /* Deferred */, sources: sources, targets: targets });
|
|
63919
63992
|
}
|
|
63920
63993
|
function makeCompositeTypeMapper(kind, mapper1, mapper2) {
|
|
63921
|
-
return { kind: kind, mapper1: mapper1, mapper2: mapper2 };
|
|
63994
|
+
return attachDebugPrototypeIfDebug({ kind: kind, mapper1: mapper1, mapper2: mapper2 });
|
|
63922
63995
|
}
|
|
63923
63996
|
function createTypeEraser(sources) {
|
|
63924
63997
|
return createTypeMapper(sources, /*targets*/ undefined);
|
|
@@ -63928,19 +64001,20 @@ var ts;
|
|
|
63928
64001
|
* This is used during inference when instantiating type parameter defaults.
|
|
63929
64002
|
*/
|
|
63930
64003
|
function createBackreferenceMapper(context, index) {
|
|
63931
|
-
|
|
64004
|
+
var forwardInferences = context.inferences.slice(index);
|
|
64005
|
+
return createTypeMapper(ts.map(forwardInferences, function (i) { return i.typeParameter; }), ts.map(forwardInferences, function () { return unknownType; }));
|
|
63932
64006
|
}
|
|
63933
64007
|
function combineTypeMappers(mapper1, mapper2) {
|
|
63934
|
-
return mapper1 ? makeCompositeTypeMapper(
|
|
64008
|
+
return mapper1 ? makeCompositeTypeMapper(4 /* Composite */, mapper1, mapper2) : mapper2;
|
|
63935
64009
|
}
|
|
63936
64010
|
function mergeTypeMappers(mapper1, mapper2) {
|
|
63937
|
-
return mapper1 ? makeCompositeTypeMapper(
|
|
64011
|
+
return mapper1 ? makeCompositeTypeMapper(5 /* Merged */, mapper1, mapper2) : mapper2;
|
|
63938
64012
|
}
|
|
63939
64013
|
function prependTypeMapping(source, target, mapper) {
|
|
63940
|
-
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(
|
|
64014
|
+
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* Merged */, makeUnaryTypeMapper(source, target), mapper);
|
|
63941
64015
|
}
|
|
63942
64016
|
function appendTypeMapping(mapper, source, target) {
|
|
63943
|
-
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(
|
|
64017
|
+
return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* Merged */, mapper, makeUnaryTypeMapper(source, target));
|
|
63944
64018
|
}
|
|
63945
64019
|
function getRestrictiveTypeParameter(tp) {
|
|
63946
64020
|
return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol),
|
|
@@ -65836,7 +65910,7 @@ var ts;
|
|
|
65836
65910
|
reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
|
|
65837
65911
|
checkTypes = reducedTarget.flags & 1048576 /* Union */ ? reducedTarget.types : [reducedTarget];
|
|
65838
65912
|
}
|
|
65839
|
-
var
|
|
65913
|
+
var _loop_20 = function (prop) {
|
|
65840
65914
|
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
|
|
65841
65915
|
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
|
|
65842
65916
|
if (reportErrors) {
|
|
@@ -65899,7 +65973,7 @@ var ts;
|
|
|
65899
65973
|
};
|
|
65900
65974
|
for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
|
|
65901
65975
|
var prop = _b[_i];
|
|
65902
|
-
var state_6 =
|
|
65976
|
+
var state_6 = _loop_20(prop);
|
|
65903
65977
|
if (typeof state_6 === "object")
|
|
65904
65978
|
return state_6.value;
|
|
65905
65979
|
}
|
|
@@ -66131,10 +66205,10 @@ var ts;
|
|
|
66131
66205
|
// We're in the middle of variance checking - integrate any unmeasurable/unreliable flags from this cached component
|
|
66132
66206
|
var saved = entry & 24 /* ReportsMask */;
|
|
66133
66207
|
if (saved & 8 /* ReportsUnmeasurable */) {
|
|
66134
|
-
instantiateType(source,
|
|
66208
|
+
instantiateType(source, reportUnmeasurableMapper);
|
|
66135
66209
|
}
|
|
66136
66210
|
if (saved & 16 /* ReportsUnreliable */) {
|
|
66137
|
-
instantiateType(source,
|
|
66211
|
+
instantiateType(source, reportUnreliableMapper);
|
|
66138
66212
|
}
|
|
66139
66213
|
}
|
|
66140
66214
|
return entry & 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */;
|
|
@@ -66560,7 +66634,7 @@ var ts;
|
|
|
66560
66634
|
}
|
|
66561
66635
|
// Report unreliable variance for type variables referenced in template literal type placeholders.
|
|
66562
66636
|
// For example, `foo-${number}` is related to `foo-${string}` even though number isn't related to string.
|
|
66563
|
-
instantiateType(source,
|
|
66637
|
+
instantiateType(source, reportUnreliableMapper);
|
|
66564
66638
|
}
|
|
66565
66639
|
if (isTypeMatchedByTemplateLiteralType(source, target)) {
|
|
66566
66640
|
return -1 /* True */;
|
|
@@ -66832,18 +66906,6 @@ var ts;
|
|
|
66832
66906
|
}
|
|
66833
66907
|
}
|
|
66834
66908
|
}
|
|
66835
|
-
function reportUnmeasurableMarkers(p) {
|
|
66836
|
-
if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
|
|
66837
|
-
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ false);
|
|
66838
|
-
}
|
|
66839
|
-
return p;
|
|
66840
|
-
}
|
|
66841
|
-
function reportUnreliableMarkers(p) {
|
|
66842
|
-
if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
|
|
66843
|
-
outofbandVarianceMarkerHandler(/*onlyUnreliable*/ true);
|
|
66844
|
-
}
|
|
66845
|
-
return p;
|
|
66846
|
-
}
|
|
66847
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
|
|
66848
66910
|
// related to Y, where X' is an instantiation of X in which P is replaced with Q. Notice
|
|
66849
66911
|
// that S and T are contra-variant whereas X and Y are co-variant.
|
|
@@ -66853,7 +66915,7 @@ var ts;
|
|
|
66853
66915
|
if (modifiersRelated) {
|
|
66854
66916
|
var result_10;
|
|
66855
66917
|
var targetConstraint = getConstraintTypeFromMappedType(target);
|
|
66856
|
-
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source),
|
|
66918
|
+
var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMapper : reportUnreliableMapper);
|
|
66857
66919
|
if (result_10 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors)) {
|
|
66858
66920
|
var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
|
|
66859
66921
|
if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
|
|
@@ -66907,11 +66969,11 @@ var ts;
|
|
|
66907
66969
|
// constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
|
|
66908
66970
|
var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
|
|
66909
66971
|
var matchingTypes = [];
|
|
66910
|
-
var
|
|
66972
|
+
var _loop_21 = function (combination) {
|
|
66911
66973
|
var hasMatch = false;
|
|
66912
66974
|
outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
|
|
66913
66975
|
var type = _d[_c];
|
|
66914
|
-
var
|
|
66976
|
+
var _loop_22 = function (i) {
|
|
66915
66977
|
var sourceProperty = sourcePropertiesFiltered[i];
|
|
66916
66978
|
var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
|
|
66917
66979
|
if (!targetProperty)
|
|
@@ -66927,7 +66989,7 @@ var ts;
|
|
|
66927
66989
|
}
|
|
66928
66990
|
};
|
|
66929
66991
|
for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
|
|
66930
|
-
var state_8 =
|
|
66992
|
+
var state_8 = _loop_22(i);
|
|
66931
66993
|
switch (state_8) {
|
|
66932
66994
|
case "continue-outer": continue outer;
|
|
66933
66995
|
}
|
|
@@ -66941,7 +67003,7 @@ var ts;
|
|
|
66941
67003
|
};
|
|
66942
67004
|
for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
|
|
66943
67005
|
var combination = discriminantCombinations_1[_a];
|
|
66944
|
-
var state_7 =
|
|
67006
|
+
var state_7 = _loop_21(combination);
|
|
66945
67007
|
if (typeof state_7 === "object")
|
|
66946
67008
|
return state_7.value;
|
|
66947
67009
|
}
|
|
@@ -67389,7 +67451,7 @@ var ts;
|
|
|
67389
67451
|
* See signatureAssignableTo, compareSignaturesIdentical
|
|
67390
67452
|
*/
|
|
67391
67453
|
function signatureRelatedTo(source, target, erase, reportErrors, incompatibleReporter) {
|
|
67392
|
-
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);
|
|
67393
67455
|
}
|
|
67394
67456
|
function signaturesIdenticalTo(source, target, kind) {
|
|
67395
67457
|
var sourceSignatures = getSignaturesOfType(source, kind);
|
|
@@ -67648,7 +67710,7 @@ var ts;
|
|
|
67648
67710
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
|
|
67649
67711
|
links.variances = ts.emptyArray;
|
|
67650
67712
|
var variances = [];
|
|
67651
|
-
var
|
|
67713
|
+
var _loop_23 = function (tp) {
|
|
67652
67714
|
var modifiers = getVarianceModifiers(tp);
|
|
67653
67715
|
var variance = modifiers & 65536 /* Out */ ?
|
|
67654
67716
|
modifiers & 32768 /* In */ ? 0 /* Invariant */ : 1 /* Covariant */ :
|
|
@@ -67684,12 +67746,12 @@ var ts;
|
|
|
67684
67746
|
}
|
|
67685
67747
|
variances.push(variance);
|
|
67686
67748
|
};
|
|
67687
|
-
for (var _i = 0,
|
|
67688
|
-
var tp =
|
|
67689
|
-
|
|
67749
|
+
for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
|
|
67750
|
+
var tp = typeParameters_2[_i];
|
|
67751
|
+
_loop_23(tp);
|
|
67690
67752
|
}
|
|
67691
67753
|
links.variances = variances;
|
|
67692
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
67754
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
|
|
67693
67755
|
}
|
|
67694
67756
|
return links.variances;
|
|
67695
67757
|
}
|
|
@@ -68681,27 +68743,29 @@ var ts;
|
|
|
68681
68743
|
signature: signature,
|
|
68682
68744
|
flags: flags,
|
|
68683
68745
|
compareTypes: compareTypes,
|
|
68684
|
-
mapper:
|
|
68685
|
-
nonFixingMapper:
|
|
68746
|
+
mapper: reportUnmeasurableMapper,
|
|
68747
|
+
nonFixingMapper: reportUnmeasurableMapper,
|
|
68686
68748
|
};
|
|
68749
|
+
context.mapper = makeFixingMapperForContext(context);
|
|
68750
|
+
context.nonFixingMapper = makeNonFixingMapperForContext(context);
|
|
68687
68751
|
return context;
|
|
68688
68752
|
}
|
|
68689
|
-
function
|
|
68690
|
-
|
|
68691
|
-
|
|
68692
|
-
|
|
68693
|
-
|
|
68694
|
-
|
|
68695
|
-
|
|
68696
|
-
|
|
68697
|
-
inferFromIntraExpressionSites(context);
|
|
68698
|
-
clearCachedInferences(inferences);
|
|
68699
|
-
inference.isFixed = true;
|
|
68700
|
-
}
|
|
68701
|
-
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;
|
|
68702
68761
|
}
|
|
68703
|
-
|
|
68704
|
-
|
|
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
|
+
}; }));
|
|
68705
68769
|
}
|
|
68706
68770
|
function clearCachedInferences(inferences) {
|
|
68707
68771
|
for (var _i = 0, inferences_1 = inferences; _i < inferences_1.length; _i++) {
|
|
@@ -69621,7 +69685,7 @@ var ts;
|
|
|
69621
69685
|
// upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
|
|
69622
69686
|
// succeed. That would be a pointless and confusing outcome.
|
|
69623
69687
|
if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
|
|
69624
|
-
var
|
|
69688
|
+
var _loop_24 = function (i) {
|
|
69625
69689
|
var source_1 = matches ? matches[i] : neverType;
|
|
69626
69690
|
var target_3 = types[i];
|
|
69627
69691
|
// If we are inferring from a string literal type to a type variable whose constraint includes one of the
|
|
@@ -69671,7 +69735,7 @@ var ts;
|
|
|
69671
69735
|
inferFromTypes(source_1, target_3);
|
|
69672
69736
|
};
|
|
69673
69737
|
for (var i = 0; i < types.length; i++) {
|
|
69674
|
-
|
|
69738
|
+
_loop_24(i);
|
|
69675
69739
|
}
|
|
69676
69740
|
}
|
|
69677
69741
|
}
|
|
@@ -70189,7 +70253,7 @@ var ts;
|
|
|
70189
70253
|
function mapTypesByKeyProperty(types, name) {
|
|
70190
70254
|
var map = new ts.Map();
|
|
70191
70255
|
var count = 0;
|
|
70192
|
-
var
|
|
70256
|
+
var _loop_25 = function (type) {
|
|
70193
70257
|
if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
70194
70258
|
var discriminant = getTypeOfPropertyOfType(type, name);
|
|
70195
70259
|
if (discriminant) {
|
|
@@ -70215,7 +70279,7 @@ var ts;
|
|
|
70215
70279
|
};
|
|
70216
70280
|
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
|
|
70217
70281
|
var type = types_15[_i];
|
|
70218
|
-
var state_9 =
|
|
70282
|
+
var state_9 = _loop_25(type);
|
|
70219
70283
|
if (typeof state_9 === "object")
|
|
70220
70284
|
return state_9.value;
|
|
70221
70285
|
}
|
|
@@ -73562,8 +73626,8 @@ var ts;
|
|
|
73562
73626
|
var conditional = node.parent;
|
|
73563
73627
|
return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional, contextFlags) : undefined;
|
|
73564
73628
|
}
|
|
73565
|
-
function getContextualTypeForChildJsxExpression(node, child) {
|
|
73566
|
-
var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName);
|
|
73629
|
+
function getContextualTypeForChildJsxExpression(node, child, contextFlags) {
|
|
73630
|
+
var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName, contextFlags);
|
|
73567
73631
|
// JSX expression is in children of JSX Element, we will look for an "children" attribute (we get the name from JSX.ElementAttributesProperty)
|
|
73568
73632
|
var jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
|
|
73569
73633
|
if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) {
|
|
@@ -73581,27 +73645,27 @@ var ts;
|
|
|
73581
73645
|
}
|
|
73582
73646
|
}, /*noReductions*/ true));
|
|
73583
73647
|
}
|
|
73584
|
-
function getContextualTypeForJsxExpression(node) {
|
|
73648
|
+
function getContextualTypeForJsxExpression(node, contextFlags) {
|
|
73585
73649
|
var exprParent = node.parent;
|
|
73586
73650
|
return ts.isJsxAttributeLike(exprParent)
|
|
73587
|
-
? getContextualType(node)
|
|
73651
|
+
? getContextualType(node, contextFlags)
|
|
73588
73652
|
: ts.isJsxElement(exprParent)
|
|
73589
|
-
? getContextualTypeForChildJsxExpression(exprParent, node)
|
|
73653
|
+
? getContextualTypeForChildJsxExpression(exprParent, node, contextFlags)
|
|
73590
73654
|
: undefined;
|
|
73591
73655
|
}
|
|
73592
|
-
function getContextualTypeForJsxAttribute(attribute) {
|
|
73656
|
+
function getContextualTypeForJsxAttribute(attribute, contextFlags) {
|
|
73593
73657
|
// When we trying to resolve JsxOpeningLikeElement as a stateless function element, we will already give its attributes a contextual type
|
|
73594
73658
|
// which is a type of the parameter of the signature we are trying out.
|
|
73595
73659
|
// If there is no contextual type (e.g. we are trying to resolve stateful component), get attributes type from resolving element's tagName
|
|
73596
73660
|
if (ts.isJsxAttribute(attribute)) {
|
|
73597
|
-
var attributesType = getApparentTypeOfContextualType(attribute.parent);
|
|
73661
|
+
var attributesType = getApparentTypeOfContextualType(attribute.parent, contextFlags);
|
|
73598
73662
|
if (!attributesType || isTypeAny(attributesType)) {
|
|
73599
73663
|
return undefined;
|
|
73600
73664
|
}
|
|
73601
73665
|
return getTypeOfPropertyOfContextualType(attributesType, attribute.name.escapedText);
|
|
73602
73666
|
}
|
|
73603
73667
|
else {
|
|
73604
|
-
return getContextualType(attribute.parent);
|
|
73668
|
+
return getContextualType(attribute.parent, contextFlags);
|
|
73605
73669
|
}
|
|
73606
73670
|
}
|
|
73607
73671
|
// Return true if the given expression is possibly a discriminant value. We limit the kinds of
|
|
@@ -73762,10 +73826,10 @@ var ts;
|
|
|
73762
73826
|
case 271 /* ExportAssignment */:
|
|
73763
73827
|
return tryGetTypeFromEffectiveTypeNode(parent);
|
|
73764
73828
|
case 288 /* JsxExpression */:
|
|
73765
|
-
return getContextualTypeForJsxExpression(parent);
|
|
73829
|
+
return getContextualTypeForJsxExpression(parent, contextFlags);
|
|
73766
73830
|
case 285 /* JsxAttribute */:
|
|
73767
73831
|
case 287 /* JsxSpreadAttribute */:
|
|
73768
|
-
return getContextualTypeForJsxAttribute(parent);
|
|
73832
|
+
return getContextualTypeForJsxAttribute(parent, contextFlags);
|
|
73769
73833
|
case 280 /* JsxOpeningElement */:
|
|
73770
73834
|
case 279 /* JsxSelfClosingElement */:
|
|
73771
73835
|
return getContextualJsxElementAttributesType(parent, contextFlags);
|
|
@@ -76564,7 +76628,7 @@ var ts;
|
|
|
76564
76628
|
if (spreadIndex >= 0) {
|
|
76565
76629
|
// Create synthetic arguments from spreads of tuple types.
|
|
76566
76630
|
var effectiveArgs_1 = args.slice(0, spreadIndex);
|
|
76567
|
-
var
|
|
76631
|
+
var _loop_26 = function (i) {
|
|
76568
76632
|
var arg = args[i];
|
|
76569
76633
|
// We can call checkExpressionCached because spread expressions never have a contextual type.
|
|
76570
76634
|
var spreadType = arg.kind === 225 /* SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
|
|
@@ -76581,7 +76645,7 @@ var ts;
|
|
|
76581
76645
|
}
|
|
76582
76646
|
};
|
|
76583
76647
|
for (var i = spreadIndex; i < args.length; i++) {
|
|
76584
|
-
|
|
76648
|
+
_loop_26(i);
|
|
76585
76649
|
}
|
|
76586
76650
|
return effectiveArgs_1;
|
|
76587
76651
|
}
|
|
@@ -76910,7 +76974,7 @@ var ts;
|
|
|
76910
76974
|
var min_3 = Number.MAX_VALUE;
|
|
76911
76975
|
var minIndex = 0;
|
|
76912
76976
|
var i_1 = 0;
|
|
76913
|
-
var
|
|
76977
|
+
var _loop_27 = function (c) {
|
|
76914
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)); };
|
|
76915
76979
|
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2);
|
|
76916
76980
|
if (diags_2) {
|
|
@@ -76928,7 +76992,7 @@ var ts;
|
|
|
76928
76992
|
};
|
|
76929
76993
|
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
|
|
76930
76994
|
var c = candidatesForArgumentError_1[_a];
|
|
76931
|
-
|
|
76995
|
+
_loop_27(c);
|
|
76932
76996
|
}
|
|
76933
76997
|
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
|
|
76934
76998
|
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
|
|
@@ -77086,7 +77150,7 @@ var ts;
|
|
|
77086
77150
|
}
|
|
77087
77151
|
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
|
|
77088
77152
|
var parameters = [];
|
|
77089
|
-
var
|
|
77153
|
+
var _loop_28 = function (i) {
|
|
77090
77154
|
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
|
|
77091
77155
|
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
|
|
77092
77156
|
i < s.parameters.length ? s.parameters[i] : undefined; });
|
|
@@ -77094,7 +77158,7 @@ var ts;
|
|
|
77094
77158
|
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
|
|
77095
77159
|
};
|
|
77096
77160
|
for (var i = 0; i < maxNonRestParam; i++) {
|
|
77097
|
-
|
|
77161
|
+
_loop_28(i);
|
|
77098
77162
|
}
|
|
77099
77163
|
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
|
|
77100
77164
|
var flags = 0 /* None */;
|
|
@@ -80447,8 +80511,8 @@ var ts;
|
|
|
80447
80511
|
var result = [];
|
|
80448
80512
|
var oldTypeParameters;
|
|
80449
80513
|
var newTypeParameters;
|
|
80450
|
-
for (var _i = 0,
|
|
80451
|
-
var tp =
|
|
80514
|
+
for (var _i = 0, typeParameters_3 = typeParameters; _i < typeParameters_3.length; _i++) {
|
|
80515
|
+
var tp = typeParameters_3[_i];
|
|
80452
80516
|
var name = tp.symbol.escapedName;
|
|
80453
80517
|
if (hasTypeParameterByName(context.inferredTypeParameters, name) || hasTypeParameterByName(result, name)) {
|
|
80454
80518
|
var newName = getUniqueTypeParameterName(ts.concatenate(context.inferredTypeParameters, result), name);
|
|
@@ -80770,12 +80834,14 @@ var ts;
|
|
|
80770
80834
|
error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
80771
80835
|
}
|
|
80772
80836
|
else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
80837
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
|
|
80773
80838
|
var source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck);
|
|
80774
80839
|
var target = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSuperTypeForCheck : markerSubTypeForCheck);
|
|
80775
80840
|
var saveVarianceTypeParameter = typeParameter;
|
|
80776
80841
|
varianceTypeParameter = typeParameter;
|
|
80777
80842
|
checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
|
|
80778
80843
|
varianceTypeParameter = saveVarianceTypeParameter;
|
|
80844
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
80779
80845
|
}
|
|
80780
80846
|
}
|
|
80781
80847
|
}
|
|
@@ -81125,7 +81191,7 @@ var ts;
|
|
|
81125
81191
|
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
|
|
81126
81192
|
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
|
|
81127
81193
|
var indexSignatureMap_1 = new ts.Map();
|
|
81128
|
-
var
|
|
81194
|
+
var _loop_29 = function (declaration) {
|
|
81129
81195
|
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
|
|
81130
81196
|
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
|
|
81131
81197
|
var entry = indexSignatureMap_1.get(getTypeId(type));
|
|
@@ -81140,7 +81206,7 @@ var ts;
|
|
|
81140
81206
|
};
|
|
81141
81207
|
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
|
|
81142
81208
|
var declaration = _a[_i];
|
|
81143
|
-
|
|
81209
|
+
_loop_29(declaration);
|
|
81144
81210
|
}
|
|
81145
81211
|
indexSignatureMap_1.forEach(function (entry) {
|
|
81146
81212
|
if (entry.declarations.length > 1) {
|
|
@@ -81363,6 +81429,12 @@ var ts;
|
|
|
81363
81429
|
function checkMissingDeclaration(node) {
|
|
81364
81430
|
checkDecorators(node);
|
|
81365
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
|
+
}
|
|
81366
81438
|
function getEffectiveTypeArguments(node, typeParameters) {
|
|
81367
81439
|
return fillMissingTypeArguments(ts.map(node.typeArguments, getTypeFromTypeNode), typeParameters, getMinTypeArgumentCount(typeParameters), ts.isInJSFile(node));
|
|
81368
81440
|
}
|
|
@@ -82171,8 +82243,17 @@ var ts;
|
|
|
82171
82243
|
}
|
|
82172
82244
|
// For a union, get a union of the awaited types of each constituent.
|
|
82173
82245
|
if (type.flags & 1048576 /* Union */) {
|
|
82246
|
+
if (awaitedTypeStack.lastIndexOf(type.id) >= 0) {
|
|
82247
|
+
if (errorNode) {
|
|
82248
|
+
error(errorNode, ts.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
|
|
82249
|
+
}
|
|
82250
|
+
return undefined;
|
|
82251
|
+
}
|
|
82174
82252
|
var mapper = errorNode ? function (constituentType) { return getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0); } : getAwaitedTypeNoAlias;
|
|
82175
|
-
|
|
82253
|
+
awaitedTypeStack.push(type.id);
|
|
82254
|
+
var mapped = mapType(type, mapper);
|
|
82255
|
+
awaitedTypeStack.pop();
|
|
82256
|
+
return typeAsAwaitable.awaitedTypeOfType = mapped;
|
|
82176
82257
|
}
|
|
82177
82258
|
var thisTypeForErrorOut = { value: undefined };
|
|
82178
82259
|
var promisedType = getPromisedTypeOfPromise(type, /*errorNode*/ undefined, thisTypeForErrorOut);
|
|
@@ -82821,8 +82902,8 @@ var ts;
|
|
|
82821
82902
|
return;
|
|
82822
82903
|
var typeParameters = ts.getEffectiveTypeParameterDeclarations(node);
|
|
82823
82904
|
var seenParentsWithEveryUnused = new ts.Set();
|
|
82824
|
-
for (var _i = 0,
|
|
82825
|
-
var typeParameter =
|
|
82905
|
+
for (var _i = 0, typeParameters_4 = typeParameters; _i < typeParameters_4.length; _i++) {
|
|
82906
|
+
var typeParameter = typeParameters_4[_i];
|
|
82826
82907
|
if (!isTypeParameterUnused(typeParameter))
|
|
82827
82908
|
continue;
|
|
82828
82909
|
var name = ts.idText(typeParameter.name);
|
|
@@ -84641,7 +84722,7 @@ var ts;
|
|
|
84641
84722
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84642
84723
|
var localPropDeclaration = declaration && declaration.kind === 221 /* BinaryExpression */ ||
|
|
84643
84724
|
name && name.kind === 162 /* ComputedPropertyName */ || getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
84644
|
-
var
|
|
84725
|
+
var _loop_30 = function (info) {
|
|
84645
84726
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
84646
84727
|
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
|
|
84647
84728
|
// in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
|
|
@@ -84654,7 +84735,7 @@ var ts;
|
|
|
84654
84735
|
};
|
|
84655
84736
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
84656
84737
|
var info = indexInfos_9[_i];
|
|
84657
|
-
|
|
84738
|
+
_loop_30(info);
|
|
84658
84739
|
}
|
|
84659
84740
|
}
|
|
84660
84741
|
function checkIndexConstraintForIndexSignature(type, checkInfo) {
|
|
@@ -84662,7 +84743,7 @@ var ts;
|
|
|
84662
84743
|
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
|
|
84663
84744
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* InterfaceDeclaration */) : undefined;
|
|
84664
84745
|
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
|
|
84665
|
-
var
|
|
84746
|
+
var _loop_31 = function (info) {
|
|
84666
84747
|
if (info === checkInfo)
|
|
84667
84748
|
return "continue";
|
|
84668
84749
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
@@ -84677,7 +84758,7 @@ var ts;
|
|
|
84677
84758
|
};
|
|
84678
84759
|
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
84679
84760
|
var info = indexInfos_10[_i];
|
|
84680
|
-
|
|
84761
|
+
_loop_31(info);
|
|
84681
84762
|
}
|
|
84682
84763
|
}
|
|
84683
84764
|
function checkTypeNameIsReserved(name, message) {
|
|
@@ -84997,7 +85078,7 @@ var ts;
|
|
|
84997
85078
|
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
84998
85079
|
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
84999
85080
|
var baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
85000
|
-
var
|
|
85081
|
+
var _loop_32 = function (member) {
|
|
85001
85082
|
if (ts.hasAmbientModifier(member)) {
|
|
85002
85083
|
return "continue";
|
|
85003
85084
|
}
|
|
@@ -85014,7 +85095,7 @@ var ts;
|
|
|
85014
85095
|
};
|
|
85015
85096
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
85016
85097
|
var member = _a[_i];
|
|
85017
|
-
|
|
85098
|
+
_loop_32(member);
|
|
85018
85099
|
}
|
|
85019
85100
|
}
|
|
85020
85101
|
/**
|
|
@@ -85102,7 +85183,7 @@ var ts;
|
|
|
85102
85183
|
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
|
|
85103
85184
|
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
|
|
85104
85185
|
var issuedMemberError = false;
|
|
85105
|
-
var
|
|
85186
|
+
var _loop_33 = function (member) {
|
|
85106
85187
|
if (ts.isStatic(member)) {
|
|
85107
85188
|
return "continue";
|
|
85108
85189
|
}
|
|
@@ -85121,7 +85202,7 @@ var ts;
|
|
|
85121
85202
|
};
|
|
85122
85203
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
85123
85204
|
var member = _a[_i];
|
|
85124
|
-
|
|
85205
|
+
_loop_33(member);
|
|
85125
85206
|
}
|
|
85126
85207
|
if (!issuedMemberError) {
|
|
85127
85208
|
// check again with diagnostics to generate a less-specific error
|
|
@@ -85192,7 +85273,7 @@ var ts;
|
|
|
85192
85273
|
var _a, _b, _c, _d;
|
|
85193
85274
|
// NOTE: assignability is checked in checkClassDeclaration
|
|
85194
85275
|
var baseProperties = getPropertiesOfType(baseType);
|
|
85195
|
-
var
|
|
85276
|
+
var _loop_34 = function (baseProperty) {
|
|
85196
85277
|
var base = getTargetSymbol(baseProperty);
|
|
85197
85278
|
if (base.flags & 4194304 /* Prototype */) {
|
|
85198
85279
|
return "continue";
|
|
@@ -85302,7 +85383,7 @@ var ts;
|
|
|
85302
85383
|
};
|
|
85303
85384
|
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
|
|
85304
85385
|
var baseProperty = baseProperties_1[_i];
|
|
85305
|
-
var state_10 =
|
|
85386
|
+
var state_10 = _loop_34(baseProperty);
|
|
85306
85387
|
switch (state_10) {
|
|
85307
85388
|
case "continue-basePropertyCheck": continue basePropertyCheck;
|
|
85308
85389
|
}
|
|
@@ -111817,7 +111898,6 @@ var ts;
|
|
|
111817
111898
|
if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
|
|
111818
111899
|
// Update the output signature
|
|
111819
111900
|
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, createHash, changedDtsData);
|
|
111820
|
-
newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
|
|
111821
111901
|
}
|
|
111822
111902
|
// Update sourceFileInfo
|
|
111823
111903
|
var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
|
|
@@ -119622,7 +119702,7 @@ var ts;
|
|
|
119622
119702
|
}
|
|
119623
119703
|
}
|
|
119624
119704
|
function processTypeReferenceDirective(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) {
|
|
119625
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!
|
|
119705
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : undefined });
|
|
119626
119706
|
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason);
|
|
119627
119707
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
119628
119708
|
}
|
|
@@ -121204,7 +121284,7 @@ var ts;
|
|
|
121204
121284
|
state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
|
|
121205
121285
|
}
|
|
121206
121286
|
state.changedFilesSet = new ts.Set();
|
|
121207
|
-
state.
|
|
121287
|
+
state.latestChangedDtsFile = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.latestChangedDtsFile : undefined;
|
|
121208
121288
|
var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
|
|
121209
121289
|
var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
|
|
121210
121290
|
var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
|
|
@@ -121328,7 +121408,7 @@ var ts;
|
|
|
121328
121408
|
programEmitComplete: state.programEmitComplete,
|
|
121329
121409
|
emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
|
|
121330
121410
|
outSignature: state.outSignature,
|
|
121331
|
-
|
|
121411
|
+
latestChangedDtsFile: state.latestChangedDtsFile,
|
|
121332
121412
|
hasChangedEmitSignature: state.hasChangedEmitSignature,
|
|
121333
121413
|
changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
|
|
121334
121414
|
};
|
|
@@ -121341,7 +121421,7 @@ var ts;
|
|
|
121341
121421
|
state.programEmitComplete = savedEmitState.programEmitComplete;
|
|
121342
121422
|
state.emitSignatures = savedEmitState.emitSignatures;
|
|
121343
121423
|
state.outSignature = savedEmitState.outSignature;
|
|
121344
|
-
state.
|
|
121424
|
+
state.latestChangedDtsFile = savedEmitState.latestChangedDtsFile;
|
|
121345
121425
|
state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
|
|
121346
121426
|
if (savedEmitState.changedFilesSet)
|
|
121347
121427
|
state.changedFilesSet = savedEmitState.changedFilesSet;
|
|
@@ -121655,14 +121735,14 @@ var ts;
|
|
|
121655
121735
|
/**
|
|
121656
121736
|
* Gets the program information to be emitted in buildInfo so that we can use it to create new program
|
|
121657
121737
|
*/
|
|
121658
|
-
function getProgramBuildInfo(state, getCanonicalFileName
|
|
121738
|
+
function getProgramBuildInfo(state, getCanonicalFileName) {
|
|
121659
121739
|
var outFilePath = ts.outFile(state.compilerOptions);
|
|
121660
121740
|
if (outFilePath && !state.compilerOptions.composite)
|
|
121661
121741
|
return;
|
|
121662
121742
|
var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
|
|
121663
121743
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
|
|
121664
|
-
//
|
|
121665
|
-
|
|
121744
|
+
// 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
|
|
121745
|
+
var latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : undefined;
|
|
121666
121746
|
if (outFilePath) {
|
|
121667
121747
|
var fileNames_1 = [];
|
|
121668
121748
|
var fileInfos_1 = [];
|
|
@@ -121678,7 +121758,7 @@ var ts;
|
|
|
121678
121758
|
fileInfos: fileInfos_1,
|
|
121679
121759
|
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
|
|
121680
121760
|
outSignature: state.outSignature,
|
|
121681
|
-
|
|
121761
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
121682
121762
|
};
|
|
121683
121763
|
return result_15;
|
|
121684
121764
|
}
|
|
@@ -121780,7 +121860,7 @@ var ts;
|
|
|
121780
121860
|
affectedFilesPendingEmit: affectedFilesPendingEmit,
|
|
121781
121861
|
changeFileSet: changeFileSet,
|
|
121782
121862
|
emitSignatures: emitSignatures,
|
|
121783
|
-
|
|
121863
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
121784
121864
|
};
|
|
121785
121865
|
return result;
|
|
121786
121866
|
function relativeToBuildInfoEnsuringAbsolutePath(path) {
|
|
@@ -121948,7 +122028,7 @@ var ts;
|
|
|
121948
122028
|
*/
|
|
121949
122029
|
var computeHash = ts.maybeBind(host, host.createHash);
|
|
121950
122030
|
var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
|
|
121951
|
-
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName
|
|
122031
|
+
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
|
|
121952
122032
|
// To ensure that we arent storing any references to old program or new program without state
|
|
121953
122033
|
newProgram = undefined; // TODO: GH#18217
|
|
121954
122034
|
oldProgram = undefined;
|
|
@@ -121958,6 +122038,7 @@ var ts;
|
|
|
121958
122038
|
builderProgram.getState = getState;
|
|
121959
122039
|
builderProgram.saveEmitState = function () { return backupBuilderProgramEmitState(state); };
|
|
121960
122040
|
builderProgram.restoreEmitState = function (saved) { return restoreBuilderProgramEmitState(state, saved); };
|
|
122041
|
+
builderProgram.hasChangedEmitSignature = function () { return !!state.hasChangedEmitSignature; };
|
|
121961
122042
|
builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
|
|
121962
122043
|
builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
|
|
121963
122044
|
builderProgram.emit = emit;
|
|
@@ -122065,18 +122146,22 @@ var ts;
|
|
|
122065
122146
|
var filePath = sourceFiles[0].resolvedPath;
|
|
122066
122147
|
var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath);
|
|
122067
122148
|
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text, computeHash, data));
|
|
122068
|
-
if
|
|
122069
|
-
|
|
122070
|
-
|
|
122071
|
-
|
|
122149
|
+
// Dont write dts files if they didn't change
|
|
122150
|
+
if (emitSignature === oldSignature)
|
|
122151
|
+
return;
|
|
122152
|
+
((_g = state.emitSignatures) !== null && _g !== void 0 ? _g : (state.emitSignatures = new ts.Map())).set(filePath, emitSignature);
|
|
122153
|
+
state.hasChangedEmitSignature = true;
|
|
122154
|
+
state.latestChangedDtsFile = fileName;
|
|
122072
122155
|
}
|
|
122073
122156
|
}
|
|
122074
122157
|
else if (state.compilerOptions.composite) {
|
|
122075
122158
|
var newSignature = computeSignature(text, computeHash, data);
|
|
122076
|
-
if
|
|
122077
|
-
|
|
122078
|
-
|
|
122079
|
-
|
|
122159
|
+
// Dont write dts files if they didn't change
|
|
122160
|
+
if (newSignature === state.outSignature)
|
|
122161
|
+
return;
|
|
122162
|
+
state.outSignature = newSignature;
|
|
122163
|
+
state.hasChangedEmitSignature = true;
|
|
122164
|
+
state.latestChangedDtsFile = fileName;
|
|
122080
122165
|
}
|
|
122081
122166
|
}
|
|
122082
122167
|
if (writeFile)
|
|
@@ -122239,11 +122324,12 @@ var ts;
|
|
|
122239
122324
|
var state;
|
|
122240
122325
|
var filePaths;
|
|
122241
122326
|
var filePathsSetList;
|
|
122327
|
+
var latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : undefined;
|
|
122242
122328
|
if (isProgramBundleEmitBuildInfo(program)) {
|
|
122243
122329
|
state = {
|
|
122244
122330
|
fileInfos: new ts.Map(),
|
|
122245
122331
|
compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
|
|
122246
|
-
|
|
122332
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
122247
122333
|
outSignature: program.outSignature,
|
|
122248
122334
|
};
|
|
122249
122335
|
}
|
|
@@ -122276,7 +122362,7 @@ var ts;
|
|
|
122276
122362
|
affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
|
|
122277
122363
|
affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
|
|
122278
122364
|
changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
|
|
122279
|
-
|
|
122365
|
+
latestChangedDtsFile: latestChangedDtsFile,
|
|
122280
122366
|
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
|
122281
122367
|
};
|
|
122282
122368
|
}
|
|
@@ -122303,6 +122389,7 @@ var ts;
|
|
|
122303
122389
|
getSemanticDiagnosticsOfNextAffectedFile: ts.notImplemented,
|
|
122304
122390
|
emitBuildInfo: ts.notImplemented,
|
|
122305
122391
|
close: ts.noop,
|
|
122392
|
+
hasChangedEmitSignature: ts.returnFalse,
|
|
122306
122393
|
};
|
|
122307
122394
|
function toPath(path) {
|
|
122308
122395
|
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
@@ -123617,7 +123704,7 @@ var ts;
|
|
|
123617
123704
|
});
|
|
123618
123705
|
// Sort by paths closest to importing file Name directory
|
|
123619
123706
|
var sortedPaths = [];
|
|
123620
|
-
var
|
|
123707
|
+
var _loop_35 = function (directory) {
|
|
123621
123708
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
123622
123709
|
var pathsInDirectory;
|
|
123623
123710
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -123641,7 +123728,7 @@ var ts;
|
|
|
123641
123728
|
};
|
|
123642
123729
|
var out_directory_1;
|
|
123643
123730
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
123644
|
-
var state_11 =
|
|
123731
|
+
var state_11 = _loop_35(directory);
|
|
123645
123732
|
directory = out_directory_1;
|
|
123646
123733
|
if (state_11 === "break")
|
|
123647
123734
|
break;
|
|
@@ -124485,7 +124572,6 @@ var ts;
|
|
|
124485
124572
|
readDirectory: ts.maybeBind(host, host.readDirectory),
|
|
124486
124573
|
disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
|
|
124487
124574
|
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
|
|
124488
|
-
now: ts.maybeBind(host, host.now),
|
|
124489
124575
|
};
|
|
124490
124576
|
function writeFile(fileName, text, writeByteOrderMark, onError) {
|
|
124491
124577
|
try {
|
|
@@ -124643,7 +124729,6 @@ var ts;
|
|
|
124643
124729
|
host.createHash = ts.maybeBind(system, system.createHash);
|
|
124644
124730
|
host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
|
|
124645
124731
|
host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
|
|
124646
|
-
host.now = ts.maybeBind(system, system.now);
|
|
124647
124732
|
ts.setGetSourceFileAsHashVersioned(host, system);
|
|
124648
124733
|
ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
|
|
124649
124734
|
return host;
|
|
@@ -125971,8 +126056,7 @@ var ts;
|
|
|
125971
126056
|
}
|
|
125972
126057
|
// Actual Emit
|
|
125973
126058
|
var host = state.host, compilerHost = state.compilerHost;
|
|
125974
|
-
var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
|
|
125975
|
-
var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
|
|
126059
|
+
var resultFlags = ((_d = program.hasChangedEmitSignature) === null || _d === void 0 ? void 0 : _d.call(program)) ? BuildResultFlags.None : BuildResultFlags.DeclarationOutputUnchanged;
|
|
125976
126060
|
var emitterDiagnostics = ts.createDiagnosticCollection();
|
|
125977
126061
|
var emittedOutputs = new ts.Map();
|
|
125978
126062
|
var options = program.getCompilerOptions();
|
|
@@ -125980,17 +126064,11 @@ var ts;
|
|
|
125980
126064
|
var outputTimeStampMap;
|
|
125981
126065
|
var now;
|
|
125982
126066
|
outputFiles.forEach(function (_a) {
|
|
125983
|
-
var _b, _c;
|
|
125984
126067
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
125985
126068
|
var path = toPath(state, name);
|
|
125986
126069
|
emittedOutputs.set(toPath(state, name), name);
|
|
125987
|
-
if (buildInfo)
|
|
125988
|
-
setBuildInfo(state, buildInfo, projectPath, options);
|
|
125989
|
-
// Buildinfo has information on when last dts change time
|
|
125990
|
-
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)) {
|
|
125991
|
-
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
|
125992
|
-
}
|
|
125993
|
-
}
|
|
126070
|
+
if (buildInfo)
|
|
126071
|
+
setBuildInfo(state, buildInfo, projectPath, options, resultFlags);
|
|
125994
126072
|
ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
|
|
125995
126073
|
if (!isIncremental && state.watch) {
|
|
125996
126074
|
(outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
|
|
@@ -126004,7 +126082,7 @@ var ts;
|
|
|
126004
126082
|
ts.Debug.assert(step === BuildStep.EmitBuildInfo);
|
|
126005
126083
|
var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
|
|
126006
126084
|
if (data === null || data === void 0 ? void 0 : data.buildInfo)
|
|
126007
|
-
setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
|
|
126085
|
+
setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions(), BuildResultFlags.DeclarationOutputUnchanged);
|
|
126008
126086
|
if (writeFileCallback)
|
|
126009
126087
|
writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
126010
126088
|
else
|
|
@@ -126037,7 +126115,6 @@ var ts;
|
|
|
126037
126115
|
state.diagnostics.delete(projectPath);
|
|
126038
126116
|
state.projectStatus.set(projectPath, {
|
|
126039
126117
|
type: ts.UpToDateStatusType.UpToDate,
|
|
126040
|
-
newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
|
|
126041
126118
|
oldestOutputFileName: oldestOutputFileName
|
|
126042
126119
|
});
|
|
126043
126120
|
afterProgramDone(state, program, config);
|
|
@@ -126079,10 +126156,10 @@ var ts;
|
|
|
126079
126156
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
|
|
126080
126157
|
emittedOutputs.set(toPath(state, name), name);
|
|
126081
126158
|
if (buildInfo) {
|
|
126082
|
-
|
|
126083
|
-
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
|
|
126159
|
+
if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) {
|
|
126084
126160
|
resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
|
|
126085
126161
|
}
|
|
126162
|
+
setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags);
|
|
126086
126163
|
}
|
|
126087
126164
|
ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
|
|
126088
126165
|
});
|
|
@@ -126341,15 +126418,23 @@ var ts;
|
|
|
126341
126418
|
state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
|
|
126342
126419
|
return result;
|
|
126343
126420
|
}
|
|
126344
|
-
function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
|
|
126421
|
+
function setBuildInfo(state, buildInfo, resolvedConfigPath, options, resultFlags) {
|
|
126345
126422
|
var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
|
|
126346
126423
|
var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
|
|
126424
|
+
var modifiedTime = getCurrentTime(state.host);
|
|
126347
126425
|
if (existing) {
|
|
126348
126426
|
existing.buildInfo = buildInfo;
|
|
126349
|
-
existing.modifiedTime =
|
|
126427
|
+
existing.modifiedTime = modifiedTime;
|
|
126428
|
+
if (!(resultFlags & BuildResultFlags.DeclarationOutputUnchanged))
|
|
126429
|
+
existing.latestChangedDtsTime = modifiedTime;
|
|
126350
126430
|
}
|
|
126351
126431
|
else {
|
|
126352
|
-
state.buildInfoCache.set(resolvedConfigPath, {
|
|
126432
|
+
state.buildInfoCache.set(resolvedConfigPath, {
|
|
126433
|
+
path: toPath(state, buildInfoPath),
|
|
126434
|
+
buildInfo: buildInfo,
|
|
126435
|
+
modifiedTime: modifiedTime,
|
|
126436
|
+
latestChangedDtsTime: resultFlags & BuildResultFlags.DeclarationOutputUnchanged ? undefined : modifiedTime,
|
|
126437
|
+
});
|
|
126353
126438
|
}
|
|
126354
126439
|
}
|
|
126355
126440
|
function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
|
|
@@ -126381,7 +126466,7 @@ var ts;
|
|
|
126381
126466
|
}
|
|
126382
126467
|
}
|
|
126383
126468
|
function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
126384
|
-
var _a, _b
|
|
126469
|
+
var _a, _b;
|
|
126385
126470
|
// Container if no files are specified in the project
|
|
126386
126471
|
if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
|
|
126387
126472
|
return {
|
|
@@ -126393,8 +126478,8 @@ var ts;
|
|
|
126393
126478
|
var force = !!state.options.force;
|
|
126394
126479
|
if (project.projectReferences) {
|
|
126395
126480
|
state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
|
|
126396
|
-
for (var _i = 0,
|
|
126397
|
-
var ref =
|
|
126481
|
+
for (var _i = 0, _c = project.projectReferences; _i < _c.length; _i++) {
|
|
126482
|
+
var ref = _c[_i];
|
|
126398
126483
|
var resolvedRef = ts.resolveProjectReferencePath(ref);
|
|
126399
126484
|
var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
|
|
126400
126485
|
var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
|
|
@@ -126434,7 +126519,6 @@ var ts;
|
|
|
126434
126519
|
var buildInfoTime;
|
|
126435
126520
|
var buildInfoProgram;
|
|
126436
126521
|
var buildInfoVersionMap;
|
|
126437
|
-
var newestDeclarationFileContentChangedTime;
|
|
126438
126522
|
if (buildInfoPath) {
|
|
126439
126523
|
var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
|
|
126440
126524
|
buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
|
|
@@ -126471,8 +126555,6 @@ var ts;
|
|
|
126471
126555
|
}
|
|
126472
126556
|
oldestOutputFileTime = buildInfoTime;
|
|
126473
126557
|
oldestOutputFileName = buildInfoPath;
|
|
126474
|
-
// Get the last dtsChange time from build info
|
|
126475
|
-
newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
|
|
126476
126558
|
}
|
|
126477
126559
|
// Check input files
|
|
126478
126560
|
var newestInputFileName = undefined;
|
|
@@ -126480,8 +126562,8 @@ var ts;
|
|
|
126480
126562
|
/** 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 */
|
|
126481
126563
|
var pseudoInputUpToDate = false;
|
|
126482
126564
|
// Get timestamps of input files
|
|
126483
|
-
for (var
|
|
126484
|
-
var inputFile =
|
|
126565
|
+
for (var _d = 0, _e = project.fileNames; _d < _e.length; _d++) {
|
|
126566
|
+
var inputFile = _e[_d];
|
|
126485
126567
|
var inputTime = getModifiedTime(state, inputFile);
|
|
126486
126568
|
if (inputTime === ts.missingFileModifiedTime) {
|
|
126487
126569
|
return {
|
|
@@ -126522,8 +126604,8 @@ var ts;
|
|
|
126522
126604
|
// Collect the expected outputs of this project
|
|
126523
126605
|
var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
|
|
126524
126606
|
var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
|
|
126525
|
-
for (var
|
|
126526
|
-
var output = outputs_1[
|
|
126607
|
+
for (var _f = 0, outputs_1 = outputs; _f < outputs_1.length; _f++) {
|
|
126608
|
+
var output = outputs_1[_f];
|
|
126527
126609
|
var path = toPath(state, output);
|
|
126528
126610
|
// Output is missing; can stop checking
|
|
126529
126611
|
var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
|
|
@@ -126561,8 +126643,8 @@ var ts;
|
|
|
126561
126643
|
var usesPrepend = false;
|
|
126562
126644
|
var upstreamChangedProject;
|
|
126563
126645
|
if (referenceStatuses) {
|
|
126564
|
-
for (var
|
|
126565
|
-
var
|
|
126646
|
+
for (var _g = 0, referenceStatuses_1 = referenceStatuses; _g < referenceStatuses_1.length; _g++) {
|
|
126647
|
+
var _h = referenceStatuses_1[_g], ref = _h.ref, refStatus = _h.refStatus, resolvedConfig = _h.resolvedConfig, resolvedRefPath = _h.resolvedRefPath;
|
|
126566
126648
|
usesPrepend = usesPrepend || !!(ref.prepend);
|
|
126567
126649
|
// If the upstream project's newest file is older than our oldest output, we
|
|
126568
126650
|
// can't be out of date because of it
|
|
@@ -126579,7 +126661,8 @@ var ts;
|
|
|
126579
126661
|
}
|
|
126580
126662
|
// If the upstream project has only change .d.ts files, and we've built
|
|
126581
126663
|
// *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
|
|
126582
|
-
|
|
126664
|
+
var newestDeclarationFileContentChangedTime = getLatestChangedDtsTime(state, resolvedConfig.options, resolvedRefPath);
|
|
126665
|
+
if (newestDeclarationFileContentChangedTime && newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
|
|
126583
126666
|
pseudoUpToDate = true;
|
|
126584
126667
|
upstreamChangedProject = ref.path;
|
|
126585
126668
|
continue;
|
|
@@ -126622,7 +126705,6 @@ var ts;
|
|
|
126622
126705
|
pseudoInputUpToDate ?
|
|
126623
126706
|
ts.UpToDateStatusType.UpToDateWithInputFileText :
|
|
126624
126707
|
ts.UpToDateStatusType.UpToDate,
|
|
126625
|
-
newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
|
|
126626
126708
|
newestInputFileTime: newestInputFileTime,
|
|
126627
126709
|
newestInputFileName: newestInputFileName,
|
|
126628
126710
|
oldestOutputFileName: oldestOutputFileName
|
|
@@ -126706,13 +126788,17 @@ var ts;
|
|
|
126706
126788
|
outputTimeStampMap.delete(key);
|
|
126707
126789
|
});
|
|
126708
126790
|
}
|
|
126709
|
-
function
|
|
126710
|
-
var _a;
|
|
126791
|
+
function getLatestChangedDtsTime(state, options, resolvedConfigPath) {
|
|
126711
126792
|
if (!options.composite)
|
|
126712
126793
|
return undefined;
|
|
126713
|
-
var
|
|
126714
|
-
|
|
126715
|
-
|
|
126794
|
+
var entry = ts.Debug.checkDefined(state.buildInfoCache.get(resolvedConfigPath));
|
|
126795
|
+
if (entry.latestChangedDtsTime !== undefined)
|
|
126796
|
+
return entry.latestChangedDtsTime || undefined;
|
|
126797
|
+
var latestChangedDtsTime = entry.buildInfo && entry.buildInfo.program && entry.buildInfo.program.latestChangedDtsFile ?
|
|
126798
|
+
state.host.getModifiedTime(ts.getNormalizedAbsolutePath(entry.buildInfo.program.latestChangedDtsFile, ts.getDirectoryPath(entry.path))) :
|
|
126799
|
+
undefined;
|
|
126800
|
+
entry.latestChangedDtsTime = latestChangedDtsTime || false;
|
|
126801
|
+
return latestChangedDtsTime;
|
|
126716
126802
|
}
|
|
126717
126803
|
function updateOutputTimestamps(state, proj, resolvedPath) {
|
|
126718
126804
|
if (state.options.dry) {
|
|
@@ -126721,7 +126807,6 @@ var ts;
|
|
|
126721
126807
|
updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
|
|
126722
126808
|
state.projectStatus.set(resolvedPath, {
|
|
126723
126809
|
type: ts.UpToDateStatusType.UpToDate,
|
|
126724
|
-
newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
|
|
126725
126810
|
oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
|
|
126726
126811
|
});
|
|
126727
126812
|
}
|
|
@@ -133966,37 +134051,36 @@ var ts;
|
|
|
133966
134051
|
}
|
|
133967
134052
|
}
|
|
133968
134053
|
var entries = ts.createSortedArray();
|
|
133969
|
-
|
|
133970
|
-
|
|
133971
|
-
|
|
133972
|
-
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries);
|
|
133973
|
-
}
|
|
133974
|
-
else {
|
|
133975
|
-
if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
|
|
133976
|
-
return undefined;
|
|
133977
|
-
}
|
|
133978
|
-
getCompletionEntriesFromSymbols(symbols, entries,
|
|
133979
|
-
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag);
|
|
134054
|
+
var isChecked = isCheckedFile(sourceFile, compilerOptions);
|
|
134055
|
+
if (isChecked && !isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
|
|
134056
|
+
return undefined;
|
|
133980
134057
|
}
|
|
134058
|
+
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
|
|
134059
|
+
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag);
|
|
133981
134060
|
if (keywordFilters !== 0 /* None */) {
|
|
133982
|
-
var entryNames_1 = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
133983
134061
|
for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
|
|
133984
134062
|
var keywordEntry = _a[_i];
|
|
133985
|
-
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !
|
|
134063
|
+
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !uniqueNames.has(keywordEntry.name)) {
|
|
134064
|
+
uniqueNames.add(keywordEntry.name);
|
|
133986
134065
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
133987
134066
|
}
|
|
133988
134067
|
}
|
|
133989
134068
|
}
|
|
133990
|
-
var entryNames = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
133991
134069
|
for (var _b = 0, _c = getContextualKeywords(contextToken, position); _b < _c.length; _b++) {
|
|
133992
134070
|
var keywordEntry = _c[_b];
|
|
133993
|
-
if (!
|
|
134071
|
+
if (!uniqueNames.has(keywordEntry.name)) {
|
|
134072
|
+
uniqueNames.add(keywordEntry.name);
|
|
133994
134073
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
133995
134074
|
}
|
|
133996
134075
|
}
|
|
133997
134076
|
for (var _d = 0, literals_1 = literals; _d < literals_1.length; _d++) {
|
|
133998
134077
|
var literal = literals_1[_d];
|
|
133999
|
-
|
|
134078
|
+
var literalEntry = createCompletionEntryForLiteral(sourceFile, preferences, literal);
|
|
134079
|
+
uniqueNames.add(literalEntry.name);
|
|
134080
|
+
ts.insertSorted(entries, literalEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
134081
|
+
}
|
|
134082
|
+
if (!isChecked) {
|
|
134083
|
+
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries);
|
|
134000
134084
|
}
|
|
134001
134085
|
return {
|
|
134002
134086
|
flags: completionData.flags,
|
|
@@ -134008,8 +134092,8 @@ var ts;
|
|
|
134008
134092
|
entries: entries,
|
|
134009
134093
|
};
|
|
134010
134094
|
}
|
|
134011
|
-
function
|
|
134012
|
-
return ts.isSourceFileJS(sourceFile)
|
|
134095
|
+
function isCheckedFile(sourceFile, compilerOptions) {
|
|
134096
|
+
return !ts.isSourceFileJS(sourceFile) || !!ts.isCheckJsEnabledForFile(sourceFile, compilerOptions);
|
|
134013
134097
|
}
|
|
134014
134098
|
function isMemberCompletionKind(kind) {
|
|
134015
134099
|
switch (kind) {
|
|
@@ -134967,7 +135051,7 @@ var ts;
|
|
|
134967
135051
|
}
|
|
134968
135052
|
function getCompletionData(program, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) {
|
|
134969
135053
|
var typeChecker = program.getTypeChecker();
|
|
134970
|
-
var
|
|
135054
|
+
var inCheckedFile = isCheckedFile(sourceFile, compilerOptions);
|
|
134971
135055
|
var start = ts.timestamp();
|
|
134972
135056
|
var currentToken = ts.getTokenAtPosition(sourceFile, position); // TODO: GH#15853
|
|
134973
135057
|
// We will check for jsdoc comments with insideComment and getJsDocTagAtPosition. (TODO: that seems rather inefficient to check the same thing so many times.)
|
|
@@ -135383,15 +135467,7 @@ var ts;
|
|
|
135383
135467
|
isNewIdentifierLocation = true;
|
|
135384
135468
|
}
|
|
135385
135469
|
var propertyAccess = node.kind === 200 /* ImportType */ ? node : node.parent;
|
|
135386
|
-
if (
|
|
135387
|
-
// In javascript files, for union types, we don't just get the members that
|
|
135388
|
-
// the individual types have in common, we also include all the members that
|
|
135389
|
-
// each individual type has. This is because we're going to add all identifiers
|
|
135390
|
-
// anyways. So we might as well elevate the members that were at least part
|
|
135391
|
-
// of the individual types to a higher status since we know what they are.
|
|
135392
|
-
symbols.push.apply(symbols, ts.filter(getPropertiesForCompletion(type, typeChecker), function (s) { return typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, s); }));
|
|
135393
|
-
}
|
|
135394
|
-
else {
|
|
135470
|
+
if (inCheckedFile) {
|
|
135395
135471
|
for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) {
|
|
135396
135472
|
var symbol = _a[_i];
|
|
135397
135473
|
if (typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, symbol)) {
|
|
@@ -135399,6 +135475,14 @@ var ts;
|
|
|
135399
135475
|
}
|
|
135400
135476
|
}
|
|
135401
135477
|
}
|
|
135478
|
+
else {
|
|
135479
|
+
// In javascript files, for union types, we don't just get the members that
|
|
135480
|
+
// the individual types have in common, we also include all the members that
|
|
135481
|
+
// each individual type has. This is because we're going to add all identifiers
|
|
135482
|
+
// anyways. So we might as well elevate the members that were at least part
|
|
135483
|
+
// of the individual types to a higher status since we know what they are.
|
|
135484
|
+
symbols.push.apply(symbols, ts.filter(getPropertiesForCompletion(type, typeChecker), function (s) { return typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, s); }));
|
|
135485
|
+
}
|
|
135402
135486
|
if (insertAwait && preferences.includeCompletionsWithInsertText) {
|
|
135403
135487
|
var promiseType = typeChecker.getPromisedTypeOfPromise(type);
|
|
135404
135488
|
if (promiseType) {
|
|
@@ -155761,7 +155845,7 @@ var ts;
|
|
|
155761
155845
|
if (!newConstraint)
|
|
155762
155846
|
return;
|
|
155763
155847
|
var newConstraintText = newConstraint[1];
|
|
155764
|
-
changes.insertText(related.file,
|
|
155848
|
+
changes.insertText(related.file, decl.name.end, " extends " + newConstraintText);
|
|
155765
155849
|
}
|
|
155766
155850
|
function findAncestorMatchingSpan(sourceFile, span) {
|
|
155767
155851
|
var token = ts.getTokenAtPosition(sourceFile, span.start);
|