@typescript-deploys/pr-build 4.7.0-pr-48792-5 → 4.7.0-pr-48861-7
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 +223 -121
- package/lib/tsserver.js +310 -169
- package/lib/tsserverlibrary.d.ts +3 -1
- package/lib/tsserverlibrary.js +310 -169
- package/lib/typescript.d.ts +3 -1
- package/lib/typescript.js +310 -169
- package/lib/typescriptServices.d.ts +3 -1
- package/lib/typescriptServices.js +310 -169
- package/lib/typingsInstaller.js +245 -137
- package/package.json +1 -1
package/lib/typescript.js
CHANGED
|
@@ -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-insiders.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220427";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -14896,7 +14896,7 @@ var ts;
|
|
|
14896
14896
|
var _a;
|
|
14897
14897
|
// If we don't need to downlevel and we can reach the original source text using
|
|
14898
14898
|
// the node's parent reference, then simply get the text as it was originally written.
|
|
14899
|
-
if (canUseOriginalText(node, flags)) {
|
|
14899
|
+
if (sourceFile && canUseOriginalText(node, flags)) {
|
|
14900
14900
|
return getSourceTextOfNodeFromSourceFile(sourceFile, node);
|
|
14901
14901
|
}
|
|
14902
14902
|
// If we can't reach the original source text, use the canonical form if it's a number,
|
|
@@ -18487,10 +18487,10 @@ var ts;
|
|
|
18487
18487
|
return ts.combinePaths(newDirPath, sourceFilePath);
|
|
18488
18488
|
}
|
|
18489
18489
|
ts.getSourceFilePathInNewDirWorker = getSourceFilePathInNewDirWorker;
|
|
18490
|
-
function writeFile(host, diagnostics, fileName,
|
|
18491
|
-
host.writeFile(fileName,
|
|
18490
|
+
function writeFile(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) {
|
|
18491
|
+
host.writeFile(fileName, text, writeByteOrderMark, function (hostErrorMessage) {
|
|
18492
18492
|
diagnostics.add(createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage));
|
|
18493
|
-
}, sourceFiles);
|
|
18493
|
+
}, sourceFiles, data);
|
|
18494
18494
|
}
|
|
18495
18495
|
ts.writeFile = writeFile;
|
|
18496
18496
|
function ensureDirectoriesExist(directoryPath, createDirectory, directoryExists) {
|
|
@@ -34417,7 +34417,7 @@ var ts;
|
|
|
34417
34417
|
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction), pos);
|
|
34418
34418
|
}
|
|
34419
34419
|
// It wasn't an assignment or a lambda. This is a conditional expression:
|
|
34420
|
-
return parseConditionalExpressionRest(expr, pos
|
|
34420
|
+
return parseConditionalExpressionRest(expr, pos);
|
|
34421
34421
|
}
|
|
34422
34422
|
function isYieldExpression() {
|
|
34423
34423
|
if (token() === 125 /* YieldKeyword */) {
|
|
@@ -34492,7 +34492,7 @@ var ts;
|
|
|
34492
34492
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
34493
34493
|
// expression instead.
|
|
34494
34494
|
return triState === 1 /* True */ ?
|
|
34495
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, disallowReturnTypeInArrowFunction) :
|
|
34495
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, /*disallowReturnTypeInArrowFunction*/ false) :
|
|
34496
34496
|
tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction); });
|
|
34497
34497
|
}
|
|
34498
34498
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
@@ -34707,8 +34707,13 @@ var ts;
|
|
|
34707
34707
|
// This is a valid arrow function with "z" as the return type.
|
|
34708
34708
|
//
|
|
34709
34709
|
// But, if we're in the true side of a conditional expression, this colon
|
|
34710
|
-
// terminates the expression, so we cannot allow a return type
|
|
34710
|
+
// terminates the expression, so we cannot allow a return type if we aren't
|
|
34711
34711
|
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34712
|
+
//
|
|
34713
|
+
// For example,
|
|
34714
|
+
// a() ? (b: number, c?: string): void => d() : e
|
|
34715
|
+
// is determined by isParenthesizedArrowFunctionExpression to unambiguously
|
|
34716
|
+
// be an arrow expression, so we allow a return type.
|
|
34712
34717
|
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34713
34718
|
return undefined;
|
|
34714
34719
|
}
|
|
@@ -34778,7 +34783,7 @@ var ts;
|
|
|
34778
34783
|
topLevel = savedTopLevel;
|
|
34779
34784
|
return node;
|
|
34780
34785
|
}
|
|
34781
|
-
function parseConditionalExpressionRest(leftOperand, pos
|
|
34786
|
+
function parseConditionalExpressionRest(leftOperand, pos) {
|
|
34782
34787
|
// Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher.
|
|
34783
34788
|
var questionToken = parseOptionalToken(57 /* QuestionToken */);
|
|
34784
34789
|
if (!questionToken) {
|
|
@@ -34788,7 +34793,7 @@ var ts;
|
|
|
34788
34793
|
// we do not that for the 'whenFalse' part.
|
|
34789
34794
|
var colonToken;
|
|
34790
34795
|
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
34791
|
-
? parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction)
|
|
34796
|
+
? parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ true)
|
|
34792
34797
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
34793
34798
|
}
|
|
34794
34799
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -48525,6 +48530,7 @@ var ts;
|
|
|
48525
48530
|
var keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType;
|
|
48526
48531
|
var numberOrBigIntType = getUnionType([numberType, bigintType]);
|
|
48527
48532
|
var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
|
|
48533
|
+
var numericStringType = getTemplateLiteralType(["", ""], [numberType]); // The `${number}` type
|
|
48528
48534
|
var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; });
|
|
48529
48535
|
var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? wildcardType : t; });
|
|
48530
48536
|
var uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never"); // `uniqueLiteralType` is a special `never` flagged by union reduction to behave as a literal
|
|
@@ -51506,7 +51512,7 @@ var ts;
|
|
|
51506
51512
|
}
|
|
51507
51513
|
}
|
|
51508
51514
|
function getExportSymbolOfValueSymbolIfExported(symbol) {
|
|
51509
|
-
return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0
|
|
51515
|
+
return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 && symbol.exportSymbol || symbol);
|
|
51510
51516
|
}
|
|
51511
51517
|
function symbolIsValue(symbol) {
|
|
51512
51518
|
return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 111551 /* Value */ && !getTypeOnlyAliasDeclaration(symbol));
|
|
@@ -58909,7 +58915,7 @@ var ts;
|
|
|
58909
58915
|
var typeVariable = getHomomorphicTypeVariable(type);
|
|
58910
58916
|
if (typeVariable && !type.declaration.nameType) {
|
|
58911
58917
|
var constraint = getConstraintOfTypeParameter(typeVariable);
|
|
58912
|
-
if (constraint && (
|
|
58918
|
+
if (constraint && isArrayOrTupleType(constraint)) {
|
|
58913
58919
|
return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
|
|
58914
58920
|
}
|
|
58915
58921
|
}
|
|
@@ -59271,10 +59277,10 @@ var ts;
|
|
|
59271
59277
|
}
|
|
59272
59278
|
function isApplicableIndexType(source, target) {
|
|
59273
59279
|
// A 'string' index signature applies to types assignable to 'string' or 'number', and a 'number' index
|
|
59274
|
-
// signature applies to types assignable to 'number' and numeric string literal types.
|
|
59280
|
+
// signature applies to types assignable to 'number', `${number}` and numeric string literal types.
|
|
59275
59281
|
return isTypeAssignableTo(source, target) ||
|
|
59276
59282
|
target === stringType && isTypeAssignableTo(source, numberType) ||
|
|
59277
|
-
target === numberType && !!(source.flags & 128 /* StringLiteral */) && ts.isNumericLiteralName(source.value);
|
|
59283
|
+
target === numberType && (source === numericStringType || !!(source.flags & 128 /* StringLiteral */) && ts.isNumericLiteralName(source.value));
|
|
59278
59284
|
}
|
|
59279
59285
|
function getIndexInfosOfStructuredType(type) {
|
|
59280
59286
|
if (type.flags & 3670016 /* StructuredType */) {
|
|
@@ -60290,6 +60296,20 @@ var ts;
|
|
|
60290
60296
|
constraints = ts.append(constraints, constraint);
|
|
60291
60297
|
}
|
|
60292
60298
|
}
|
|
60299
|
+
// Given a homomorphic mapped type { [K in keyof T]: XXX }, where T is constrained to an array or tuple type, in the
|
|
60300
|
+
// template type XXX, K has an added constraint of number | `${number}`.
|
|
60301
|
+
else if (type.flags & 262144 /* TypeParameter */ && parent.kind === 195 /* MappedType */ && node === parent.type) {
|
|
60302
|
+
var mappedType = getTypeFromTypeNode(parent);
|
|
60303
|
+
if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
|
|
60304
|
+
var typeParameter = getHomomorphicTypeVariable(mappedType);
|
|
60305
|
+
if (typeParameter) {
|
|
60306
|
+
var constraint = getConstraintOfTypeParameter(typeParameter);
|
|
60307
|
+
if (constraint && everyType(constraint, isArrayOrTupleType)) {
|
|
60308
|
+
constraints = ts.append(constraints, getUnionType([numberType, numericStringType]));
|
|
60309
|
+
}
|
|
60310
|
+
}
|
|
60311
|
+
}
|
|
60312
|
+
}
|
|
60293
60313
|
node = parent;
|
|
60294
60314
|
}
|
|
60295
60315
|
return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type;
|
|
@@ -61257,7 +61277,7 @@ var ts;
|
|
|
61257
61277
|
while (i > 0) {
|
|
61258
61278
|
i--;
|
|
61259
61279
|
var t = types[i];
|
|
61260
|
-
var remove = t.flags & 4 /* String */ && includes & 128 /* StringLiteral */ ||
|
|
61280
|
+
var remove = t.flags & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
|
|
61261
61281
|
t.flags & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
|
|
61262
61282
|
t.flags & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
|
|
61263
61283
|
t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */;
|
|
@@ -61416,7 +61436,7 @@ var ts;
|
|
|
61416
61436
|
if (!strictNullChecks && includes & 98304 /* Nullable */) {
|
|
61417
61437
|
return includes & 32768 /* Undefined */ ? undefinedType : nullType;
|
|
61418
61438
|
}
|
|
61419
|
-
if (includes & 4 /* String */ && includes & 128 /* StringLiteral */ ||
|
|
61439
|
+
if (includes & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
|
|
61420
61440
|
includes & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
|
|
61421
61441
|
includes & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
|
|
61422
61442
|
includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */) {
|
|
@@ -63300,7 +63320,7 @@ var ts;
|
|
|
63300
63320
|
if (!type.declaration.nameType) {
|
|
63301
63321
|
var constraint = void 0;
|
|
63302
63322
|
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 &&
|
|
63303
|
-
(constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint,
|
|
63323
|
+
(constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
63304
63324
|
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
63305
63325
|
}
|
|
63306
63326
|
if (isGenericTupleType(t)) {
|
|
@@ -64738,7 +64758,7 @@ var ts;
|
|
|
64738
64758
|
}
|
|
64739
64759
|
return false;
|
|
64740
64760
|
}
|
|
64741
|
-
return
|
|
64761
|
+
return isArrayOrTupleType(target);
|
|
64742
64762
|
}
|
|
64743
64763
|
if (isReadonlyArrayType(source) && isMutableArrayOrTuple(target)) {
|
|
64744
64764
|
if (reportErrors) {
|
|
@@ -64868,7 +64888,7 @@ var ts;
|
|
|
64868
64888
|
// We suppress recursive intersection property checks because they can generate lots of work when relating
|
|
64869
64889
|
// recursive intersections that are structurally similar but not exactly identical. See #37854.
|
|
64870
64890
|
if (result_7 && !inPropertyCheck && (target.flags & 2097152 /* Intersection */ && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
|
|
64871
|
-
isNonGenericObjectType(target) && !
|
|
64891
|
+
isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* Intersection */ && getApparentType(source).flags & 3670016 /* StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* NonInferrableType */); }))) {
|
|
64872
64892
|
inPropertyCheck = true;
|
|
64873
64893
|
result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4 /* PropertyCheck */, recursionFlags);
|
|
64874
64894
|
inPropertyCheck = false;
|
|
@@ -65495,6 +65515,20 @@ var ts;
|
|
|
65495
65515
|
}
|
|
65496
65516
|
}
|
|
65497
65517
|
}
|
|
65518
|
+
if (relation === comparableRelation && sourceFlags & 262144 /* TypeParameter */) {
|
|
65519
|
+
// This is a carve-out in comparability to essentially forbid comparing a type parameter
|
|
65520
|
+
// with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!)
|
|
65521
|
+
var constraint = getConstraintOfTypeParameter(source);
|
|
65522
|
+
if (constraint && hasNonCircularBaseConstraint(source)) {
|
|
65523
|
+
while (constraint && constraint.flags & 262144 /* TypeParameter */) {
|
|
65524
|
+
if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false)) {
|
|
65525
|
+
return result;
|
|
65526
|
+
}
|
|
65527
|
+
constraint = getConstraintOfTypeParameter(constraint);
|
|
65528
|
+
}
|
|
65529
|
+
}
|
|
65530
|
+
return 0 /* False */;
|
|
65531
|
+
}
|
|
65498
65532
|
}
|
|
65499
65533
|
else if (targetFlags & 4194304 /* Index */) {
|
|
65500
65534
|
var targetType_1 = target.type;
|
|
@@ -65698,7 +65732,7 @@ var ts;
|
|
|
65698
65732
|
if (sourceFlags & 8650752 /* TypeVariable */) {
|
|
65699
65733
|
// IndexedAccess comparisons are handled above in the `targetFlags & TypeFlage.IndexedAccess` branch
|
|
65700
65734
|
if (!(sourceFlags & 8388608 /* IndexedAccess */ && targetFlags & 8388608 /* IndexedAccess */)) {
|
|
65701
|
-
var constraint = getConstraintOfType(source);
|
|
65735
|
+
var constraint = getConstraintOfType(source) || unknownType;
|
|
65702
65736
|
if (!strictNullChecks && (!constraint || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */))) {
|
|
65703
65737
|
// A type variable with no constraint is not related to the non-primitive object type.
|
|
65704
65738
|
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */), 3 /* Both */)) {
|
|
@@ -65707,12 +65741,12 @@ var ts;
|
|
|
65707
65741
|
}
|
|
65708
65742
|
}
|
|
65709
65743
|
// hi-speed no-this-instantiation check (less accurate, but avoids costly `this`-instantiation when the constraint will suffice), see #28231 for report on why this is needed
|
|
65710
|
-
else if (
|
|
65744
|
+
else if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
|
|
65711
65745
|
resetErrorInfo(saveErrorInfo);
|
|
65712
65746
|
return result;
|
|
65713
65747
|
}
|
|
65714
65748
|
// slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
|
|
65715
|
-
else if (
|
|
65749
|
+
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
|
|
65716
65750
|
resetErrorInfo(saveErrorInfo);
|
|
65717
65751
|
return result;
|
|
65718
65752
|
}
|
|
@@ -65856,7 +65890,7 @@ var ts;
|
|
|
65856
65890
|
return varianceResult;
|
|
65857
65891
|
}
|
|
65858
65892
|
}
|
|
65859
|
-
else if (isReadonlyArrayType(target) ?
|
|
65893
|
+
else if (isReadonlyArrayType(target) ? isArrayOrTupleType(source) : isArrayType(target) && isTupleType(source) && !source.target.readonly) {
|
|
65860
65894
|
if (relation !== identityRelation) {
|
|
65861
65895
|
return isRelatedTo(getIndexTypeOfType(source, numberType) || anyType, getIndexTypeOfType(target, numberType) || anyType, 3 /* Both */, reportErrors);
|
|
65862
65896
|
}
|
|
@@ -66232,7 +66266,7 @@ var ts;
|
|
|
66232
66266
|
}
|
|
66233
66267
|
var result = -1 /* True */;
|
|
66234
66268
|
if (isTupleType(target)) {
|
|
66235
|
-
if (
|
|
66269
|
+
if (isArrayOrTupleType(source)) {
|
|
66236
66270
|
if (!target.target.readonly && (isReadonlyArrayType(source) || isTupleType(source) && source.target.readonly)) {
|
|
66237
66271
|
return 0 /* False */;
|
|
66238
66272
|
}
|
|
@@ -67193,6 +67227,9 @@ var ts;
|
|
|
67193
67227
|
function isReadonlyArrayType(type) {
|
|
67194
67228
|
return !!(ts.getObjectFlags(type) & 4 /* Reference */) && type.target === globalReadonlyArrayType;
|
|
67195
67229
|
}
|
|
67230
|
+
function isArrayOrTupleType(type) {
|
|
67231
|
+
return isArrayType(type) || isTupleType(type);
|
|
67232
|
+
}
|
|
67196
67233
|
function isMutableArrayOrTuple(type) {
|
|
67197
67234
|
return isArrayType(type) && !isReadonlyArrayType(type) || isTupleType(type) && !type.target.readonly;
|
|
67198
67235
|
}
|
|
@@ -67644,7 +67681,7 @@ var ts;
|
|
|
67644
67681
|
else if (type.flags & 2097152 /* Intersection */) {
|
|
67645
67682
|
result = getIntersectionType(ts.sameMap(type.types, getWidenedType));
|
|
67646
67683
|
}
|
|
67647
|
-
else if (
|
|
67684
|
+
else if (isArrayOrTupleType(type)) {
|
|
67648
67685
|
result = createTypeReference(type.target, ts.sameMap(getTypeArguments(type), getWidenedType));
|
|
67649
67686
|
}
|
|
67650
67687
|
if (result && context === undefined) {
|
|
@@ -67681,7 +67718,7 @@ var ts;
|
|
|
67681
67718
|
}
|
|
67682
67719
|
}
|
|
67683
67720
|
}
|
|
67684
|
-
if (
|
|
67721
|
+
if (isArrayOrTupleType(type)) {
|
|
67685
67722
|
for (var _b = 0, _c = getTypeArguments(type); _b < _c.length; _b++) {
|
|
67686
67723
|
var t = _c[_b];
|
|
67687
67724
|
if (reportWideningErrorsInType(t)) {
|
|
@@ -68742,7 +68779,7 @@ var ts;
|
|
|
68742
68779
|
}
|
|
68743
68780
|
// Infer from the members of source and target only if the two types are possibly related
|
|
68744
68781
|
if (!typesDefinitelyUnrelated(source, target)) {
|
|
68745
|
-
if (
|
|
68782
|
+
if (isArrayOrTupleType(source)) {
|
|
68746
68783
|
if (isTupleType(target)) {
|
|
68747
68784
|
var sourceArity = getTypeReferenceArity(source);
|
|
68748
68785
|
var targetArity = getTypeReferenceArity(target);
|
|
@@ -73621,6 +73658,7 @@ var ts;
|
|
|
73621
73658
|
}
|
|
73622
73659
|
}
|
|
73623
73660
|
else {
|
|
73661
|
+
error(attributeDecl.expression, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types);
|
|
73624
73662
|
typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType;
|
|
73625
73663
|
}
|
|
73626
73664
|
}
|
|
@@ -75858,6 +75896,7 @@ var ts;
|
|
|
75858
75896
|
// decorators are applied to a declaration by the emitter, and not to an expression.
|
|
75859
75897
|
var isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
75860
75898
|
var argCheckMode = !isDecorator && !isSingleNonGenericCandidate && ts.some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
75899
|
+
argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
75861
75900
|
// The following variables are captured and modified by calls to chooseOverload.
|
|
75862
75901
|
// If overload resolution or type argument inference fails, we want to report the
|
|
75863
75902
|
// best error possible. The best error is one which says that an argument was not
|
|
@@ -76073,7 +76112,7 @@ var ts;
|
|
|
76073
76112
|
// If one or more context sensitive arguments were excluded, we start including
|
|
76074
76113
|
// them now (and keeping do so for any subsequent candidates) and perform a second
|
|
76075
76114
|
// round of type inference and applicability checking for this particular candidate.
|
|
76076
|
-
argCheckMode =
|
|
76115
|
+
argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
76077
76116
|
if (inferenceContext) {
|
|
76078
76117
|
var typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
76079
76118
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
|
|
@@ -110155,6 +110194,7 @@ var ts;
|
|
|
110155
110194
|
else {
|
|
110156
110195
|
printer.writeFile(sourceFile, writer, sourceMapGenerator);
|
|
110157
110196
|
}
|
|
110197
|
+
var sourceMapUrlPos;
|
|
110158
110198
|
if (sourceMapGenerator) {
|
|
110159
110199
|
if (sourceMapDataList) {
|
|
110160
110200
|
sourceMapDataList.push({
|
|
@@ -110166,6 +110206,7 @@ var ts;
|
|
|
110166
110206
|
if (sourceMappingURL) {
|
|
110167
110207
|
if (!writer.isAtStartOfLine())
|
|
110168
110208
|
writer.rawWrite(newLine);
|
|
110209
|
+
sourceMapUrlPos = writer.getTextPos();
|
|
110169
110210
|
writer.writeComment("//# " + "sourceMappingURL" + "=" + sourceMappingURL); // Tools can sometimes see this line as a source mapping url comment
|
|
110170
110211
|
}
|
|
110171
110212
|
// Write the source map
|
|
@@ -110178,7 +110219,7 @@ var ts;
|
|
|
110178
110219
|
writer.writeLine();
|
|
110179
110220
|
}
|
|
110180
110221
|
// Write the output file
|
|
110181
|
-
ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles);
|
|
110222
|
+
ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
|
|
110182
110223
|
// Reset state
|
|
110183
110224
|
writer.clear();
|
|
110184
110225
|
}
|
|
@@ -110700,7 +110741,7 @@ var ts;
|
|
|
110700
110741
|
setWriter(/*output*/ undefined, /*_sourceMapGenerator*/ undefined);
|
|
110701
110742
|
}
|
|
110702
110743
|
function getCurrentLineMap() {
|
|
110703
|
-
return currentLineMap || (currentLineMap = ts.getLineStarts(currentSourceFile));
|
|
110744
|
+
return currentLineMap || (currentLineMap = ts.getLineStarts(ts.Debug.checkDefined(currentSourceFile)));
|
|
110704
110745
|
}
|
|
110705
110746
|
function emit(node, parenthesizerRule) {
|
|
110706
110747
|
if (node === undefined)
|
|
@@ -111875,7 +111916,7 @@ var ts;
|
|
|
111875
111916
|
increaseIndent();
|
|
111876
111917
|
}
|
|
111877
111918
|
var preferNewLine = node.multiLine ? 65536 /* PreferNewLine */ : 0 /* None */;
|
|
111878
|
-
var allowTrailingComma = currentSourceFile.languageVersion >= 1 /* ES5 */ && !ts.isJsonSourceFile(currentSourceFile) ? 64 /* AllowTrailingComma */ : 0 /* None */;
|
|
111919
|
+
var allowTrailingComma = currentSourceFile && currentSourceFile.languageVersion >= 1 /* ES5 */ && !ts.isJsonSourceFile(currentSourceFile) ? 64 /* AllowTrailingComma */ : 0 /* None */;
|
|
111879
111920
|
emitList(node, node.properties, 526226 /* ObjectLiteralExpressionProperties */ | allowTrailingComma | preferNewLine);
|
|
111880
111921
|
if (indentedFlag) {
|
|
111881
111922
|
decreaseIndent();
|
|
@@ -112231,7 +112272,7 @@ var ts;
|
|
|
112231
112272
|
emitExpression(node.expression, parenthesizer.parenthesizeExpressionOfExpressionStatement);
|
|
112232
112273
|
// Emit semicolon in non json files
|
|
112233
112274
|
// or if json file that created synthesized expression(eg.define expression statement when --out and amd code generation)
|
|
112234
|
-
if (!ts.isJsonSourceFile(currentSourceFile) || ts.nodeIsSynthesized(node.expression)) {
|
|
112275
|
+
if (!currentSourceFile || !ts.isJsonSourceFile(currentSourceFile) || ts.nodeIsSynthesized(node.expression)) {
|
|
112235
112276
|
writeTrailingSemicolon();
|
|
112236
112277
|
}
|
|
112237
112278
|
}
|
|
@@ -112524,7 +112565,7 @@ var ts;
|
|
|
112524
112565
|
if (body.multiLine) {
|
|
112525
112566
|
return false;
|
|
112526
112567
|
}
|
|
112527
|
-
if (!ts.nodeIsSynthesized(body) && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {
|
|
112568
|
+
if (!ts.nodeIsSynthesized(body) && currentSourceFile && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {
|
|
112528
112569
|
return false;
|
|
112529
112570
|
}
|
|
112530
112571
|
if (getLeadingLineTerminatorCount(body, body.statements, 2 /* PreserveLines */)
|
|
@@ -112549,12 +112590,7 @@ var ts;
|
|
|
112549
112590
|
var emitBlockFunctionBody = shouldEmitBlockFunctionBodyOnSingleLine(body)
|
|
112550
112591
|
? emitBlockFunctionBodyOnSingleLine
|
|
112551
112592
|
: emitBlockFunctionBodyWorker;
|
|
112552
|
-
|
|
112553
|
-
emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody);
|
|
112554
|
-
}
|
|
112555
|
-
else {
|
|
112556
|
-
emitBlockFunctionBody(body);
|
|
112557
|
-
}
|
|
112593
|
+
emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody);
|
|
112558
112594
|
decreaseIndent();
|
|
112559
112595
|
writeToken(19 /* CloseBraceToken */, body.statements.end, writePunctuation, body);
|
|
112560
112596
|
onAfterEmitNode === null || onAfterEmitNode === void 0 ? void 0 : onAfterEmitNode(body);
|
|
@@ -112951,7 +112987,8 @@ var ts;
|
|
|
112951
112987
|
var emitAsSingleStatement = statements.length === 1 &&
|
|
112952
112988
|
(
|
|
112953
112989
|
// treat synthesized nodes as located on the same line for emit purposes
|
|
112954
|
-
|
|
112990
|
+
!currentSourceFile ||
|
|
112991
|
+
ts.nodeIsSynthesized(parentNode) ||
|
|
112955
112992
|
ts.nodeIsSynthesized(statements[0]) ||
|
|
112956
112993
|
ts.rangeStartPositionsAreOnSameLine(parentNode, statements[0], currentSourceFile));
|
|
112957
112994
|
var format = 163969 /* CaseOrDefaultClauseStatements */;
|
|
@@ -113182,16 +113219,14 @@ var ts;
|
|
|
113182
113219
|
function emitSourceFile(node) {
|
|
113183
113220
|
writeLine();
|
|
113184
113221
|
var statements = node.statements;
|
|
113185
|
-
if
|
|
113186
|
-
|
|
113187
|
-
|
|
113188
|
-
|
|
113189
|
-
|
|
113190
|
-
|
|
113191
|
-
|
|
113192
|
-
|
|
113193
|
-
return;
|
|
113194
|
-
}
|
|
113222
|
+
// Emit detached comment if there are no prologue directives or if the first node is synthesized.
|
|
113223
|
+
// The synthesized node will have no leading comment so some comments may be missed.
|
|
113224
|
+
var shouldEmitDetachedComment = statements.length === 0 ||
|
|
113225
|
+
!ts.isPrologueDirective(statements[0]) ||
|
|
113226
|
+
ts.nodeIsSynthesized(statements[0]);
|
|
113227
|
+
if (shouldEmitDetachedComment) {
|
|
113228
|
+
emitBodyWithDetachedComments(node, statements, emitSourceFileWorker);
|
|
113229
|
+
return;
|
|
113195
113230
|
}
|
|
113196
113231
|
emitSourceFileWorker(node);
|
|
113197
113232
|
}
|
|
@@ -113580,7 +113615,7 @@ var ts;
|
|
|
113580
113615
|
}
|
|
113581
113616
|
if (isEmpty) {
|
|
113582
113617
|
// Write a line terminator if the parent node was multi-line
|
|
113583
|
-
if (format & 1 /* MultiLine */ && !(preserveSourceNewlines && (!parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile)))) {
|
|
113618
|
+
if (format & 1 /* MultiLine */ && !(preserveSourceNewlines && (!parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile)))) {
|
|
113584
113619
|
writeLine();
|
|
113585
113620
|
}
|
|
113586
113621
|
else if (format & 256 /* SpaceBetweenBraces */ && !(format & 524288 /* NoSpaceIfEmpty */)) {
|
|
@@ -113841,7 +113876,7 @@ var ts;
|
|
|
113841
113876
|
}
|
|
113842
113877
|
var firstChild_1 = children[0];
|
|
113843
113878
|
if (firstChild_1 === undefined) {
|
|
113844
|
-
return !parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113879
|
+
return !parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113845
113880
|
}
|
|
113846
113881
|
if (firstChild_1.pos === nextListElementPos) {
|
|
113847
113882
|
// If this child starts at the beginning of a list item in a parent list, its leading
|
|
@@ -113865,7 +113900,7 @@ var ts;
|
|
|
113865
113900
|
// JsxText will be written with its leading whitespace, so don't add more manually.
|
|
113866
113901
|
return 0;
|
|
113867
113902
|
}
|
|
113868
|
-
if (parentNode &&
|
|
113903
|
+
if (currentSourceFile && parentNode &&
|
|
113869
113904
|
!ts.positionIsSynthesized(parentNode.pos) &&
|
|
113870
113905
|
!ts.nodeIsSynthesized(firstChild_1) &&
|
|
113871
113906
|
(!firstChild_1.parent || ts.getOriginalNode(firstChild_1.parent) === ts.getOriginalNode(parentNode))) {
|
|
@@ -113889,7 +113924,7 @@ var ts;
|
|
|
113889
113924
|
// JsxText will be written with its leading whitespace, so don't add more manually.
|
|
113890
113925
|
return 0;
|
|
113891
113926
|
}
|
|
113892
|
-
else if (!ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
|
|
113927
|
+
else if (currentSourceFile && !ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
|
|
113893
113928
|
if (preserveSourceNewlines && siblingNodePositionsAreComparable(previousNode, nextNode)) {
|
|
113894
113929
|
return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(previousNode, nextNode, currentSourceFile, includeComments); });
|
|
113895
113930
|
}
|
|
@@ -113921,9 +113956,9 @@ var ts;
|
|
|
113921
113956
|
}
|
|
113922
113957
|
var lastChild = ts.lastOrUndefined(children);
|
|
113923
113958
|
if (lastChild === undefined) {
|
|
113924
|
-
return !parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113959
|
+
return !parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113925
113960
|
}
|
|
113926
|
-
if (parentNode && !ts.positionIsSynthesized(parentNode.pos) && !ts.nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) {
|
|
113961
|
+
if (currentSourceFile && parentNode && !ts.positionIsSynthesized(parentNode.pos) && !ts.nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) {
|
|
113927
113962
|
if (preserveSourceNewlines) {
|
|
113928
113963
|
var end_1 = ts.isNodeArray(children) && !ts.positionIsSynthesized(children.end) ? children.end : lastChild.end;
|
|
113929
113964
|
return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenPositionAndNextNonWhitespaceCharacter(end_1, parentNode.end, currentSourceFile, includeComments); });
|
|
@@ -113996,7 +114031,7 @@ var ts;
|
|
|
113996
114031
|
if (ts.getStartsOnNewLine(node2)) {
|
|
113997
114032
|
return 1;
|
|
113998
114033
|
}
|
|
113999
|
-
if (!ts.nodeIsSynthesized(parent) && !ts.nodeIsSynthesized(node1) && !ts.nodeIsSynthesized(node2)) {
|
|
114034
|
+
if (currentSourceFile && !ts.nodeIsSynthesized(parent) && !ts.nodeIsSynthesized(node1) && !ts.nodeIsSynthesized(node2)) {
|
|
114000
114035
|
if (preserveSourceNewlines) {
|
|
114001
114036
|
return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(node1, node2, currentSourceFile, includeComments); });
|
|
114002
114037
|
}
|
|
@@ -114006,7 +114041,7 @@ var ts;
|
|
|
114006
114041
|
}
|
|
114007
114042
|
function isEmptyBlock(block) {
|
|
114008
114043
|
return block.statements.length === 0
|
|
114009
|
-
&& ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile);
|
|
114044
|
+
&& (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile));
|
|
114010
114045
|
}
|
|
114011
114046
|
function skipSynthesizedParentheses(node) {
|
|
114012
114047
|
while (node.kind === 212 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) {
|
|
@@ -114018,16 +114053,23 @@ var ts;
|
|
|
114018
114053
|
if (ts.isGeneratedIdentifier(node)) {
|
|
114019
114054
|
return generateName(node);
|
|
114020
114055
|
}
|
|
114021
|
-
|
|
114022
|
-
return ts.idText(node);
|
|
114023
|
-
}
|
|
114024
|
-
else if (node.kind === 10 /* StringLiteral */ && node.textSourceNode) {
|
|
114056
|
+
if (ts.isStringLiteral(node) && node.textSourceNode) {
|
|
114025
114057
|
return getTextOfNode(node.textSourceNode, includeTrivia);
|
|
114026
114058
|
}
|
|
114027
|
-
|
|
114028
|
-
|
|
114059
|
+
var sourceFile = currentSourceFile; // const needed for control flow
|
|
114060
|
+
var canUseSourceFile = !!sourceFile && !!node.parent && !ts.nodeIsSynthesized(node);
|
|
114061
|
+
if (ts.isMemberName(node)) {
|
|
114062
|
+
if (!canUseSourceFile || ts.getSourceFileOfNode(node) !== ts.getOriginalNode(sourceFile)) {
|
|
114063
|
+
return ts.idText(node);
|
|
114064
|
+
}
|
|
114065
|
+
}
|
|
114066
|
+
else {
|
|
114067
|
+
ts.Debug.assertNode(node, ts.isLiteralExpression); // not strictly necessary
|
|
114068
|
+
if (!canUseSourceFile) {
|
|
114069
|
+
return node.text;
|
|
114070
|
+
}
|
|
114029
114071
|
}
|
|
114030
|
-
return ts.getSourceTextOfNodeFromSourceFile(
|
|
114072
|
+
return ts.getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia);
|
|
114031
114073
|
}
|
|
114032
114074
|
function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) {
|
|
114033
114075
|
if (node.kind === 10 /* StringLiteral */ && node.textSourceNode) {
|
|
@@ -114606,7 +114648,7 @@ var ts;
|
|
|
114606
114648
|
return true;
|
|
114607
114649
|
}
|
|
114608
114650
|
function emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {
|
|
114609
|
-
if (!shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114651
|
+
if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114610
114652
|
return;
|
|
114611
114653
|
if (!hasWrittenComment) {
|
|
114612
114654
|
ts.emitNewLineBeforeLeadingCommentOfPosition(getCurrentLineMap(), writer, rangePos, commentPos);
|
|
@@ -114633,7 +114675,7 @@ var ts;
|
|
|
114633
114675
|
forEachTrailingCommentToEmit(pos, emitTrailingComment);
|
|
114634
114676
|
}
|
|
114635
114677
|
function emitTrailingComment(commentPos, commentEnd, _kind, hasTrailingNewLine) {
|
|
114636
|
-
if (!shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114678
|
+
if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114637
114679
|
return;
|
|
114638
114680
|
// trailing comments are emitted at space/*trailing comment1 */space/*trailing comment2*/
|
|
114639
114681
|
if (!writer.isAtStartOfLine()) {
|
|
@@ -114655,6 +114697,8 @@ var ts;
|
|
|
114655
114697
|
exitComment();
|
|
114656
114698
|
}
|
|
114657
114699
|
function emitTrailingCommentOfPositionNoNewline(commentPos, commentEnd, kind) {
|
|
114700
|
+
if (!currentSourceFile)
|
|
114701
|
+
return;
|
|
114658
114702
|
// trailing comments of a position are emitted at /*trailing comment1 */space/*trailing comment*/space
|
|
114659
114703
|
emitPos(commentPos);
|
|
114660
114704
|
ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
|
|
@@ -114664,6 +114708,8 @@ var ts;
|
|
|
114664
114708
|
}
|
|
114665
114709
|
}
|
|
114666
114710
|
function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) {
|
|
114711
|
+
if (!currentSourceFile)
|
|
114712
|
+
return;
|
|
114667
114713
|
// trailing comments of a position are emitted at /*trailing comment1 */space/*trailing comment*/space
|
|
114668
114714
|
emitPos(commentPos);
|
|
114669
114715
|
ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
|
|
@@ -114696,6 +114742,8 @@ var ts;
|
|
|
114696
114742
|
return detachedCommentsInfo !== undefined && ts.last(detachedCommentsInfo).nodePos === pos;
|
|
114697
114743
|
}
|
|
114698
114744
|
function forEachLeadingCommentWithoutDetachedComments(cb) {
|
|
114745
|
+
if (!currentSourceFile)
|
|
114746
|
+
return;
|
|
114699
114747
|
// get the leading comments from detachedPos
|
|
114700
114748
|
var pos = ts.last(detachedCommentsInfo).detachedCommentEndPos;
|
|
114701
114749
|
if (detachedCommentsInfo.length - 1) {
|
|
@@ -114707,7 +114755,7 @@ var ts;
|
|
|
114707
114755
|
ts.forEachLeadingCommentRange(currentSourceFile.text, pos, cb, /*state*/ pos);
|
|
114708
114756
|
}
|
|
114709
114757
|
function emitDetachedCommentsAndUpdateCommentsInfo(range) {
|
|
114710
|
-
var currentDetachedCommentInfo = ts.emitDetachedComments(currentSourceFile.text, getCurrentLineMap(), writer, emitComment, range, newLine, commentsDisabled);
|
|
114758
|
+
var currentDetachedCommentInfo = currentSourceFile && ts.emitDetachedComments(currentSourceFile.text, getCurrentLineMap(), writer, emitComment, range, newLine, commentsDisabled);
|
|
114711
114759
|
if (currentDetachedCommentInfo) {
|
|
114712
114760
|
if (detachedCommentsInfo) {
|
|
114713
114761
|
detachedCommentsInfo.push(currentDetachedCommentInfo);
|
|
@@ -114718,7 +114766,7 @@ var ts;
|
|
|
114718
114766
|
}
|
|
114719
114767
|
}
|
|
114720
114768
|
function emitComment(text, lineMap, writer, commentPos, commentEnd, newLine) {
|
|
114721
|
-
if (!shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114769
|
+
if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114722
114770
|
return;
|
|
114723
114771
|
emitPos(commentPos);
|
|
114724
114772
|
ts.writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine);
|
|
@@ -114730,7 +114778,7 @@ var ts;
|
|
|
114730
114778
|
* @return true if the comment is a triple-slash comment else false
|
|
114731
114779
|
*/
|
|
114732
114780
|
function isTripleSlashComment(commentPos, commentEnd) {
|
|
114733
|
-
return ts.isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd);
|
|
114781
|
+
return !!currentSourceFile && ts.isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd);
|
|
114734
114782
|
}
|
|
114735
114783
|
// Source Maps
|
|
114736
114784
|
function getParsedSourceMap(node) {
|
|
@@ -115645,7 +115693,11 @@ var ts;
|
|
|
115645
115693
|
return newValue;
|
|
115646
115694
|
};
|
|
115647
115695
|
if (originalWriteFile) {
|
|
115648
|
-
host.writeFile = function (fileName, data
|
|
115696
|
+
host.writeFile = function (fileName, data) {
|
|
115697
|
+
var rest = [];
|
|
115698
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
115699
|
+
rest[_i - 2] = arguments[_i];
|
|
115700
|
+
}
|
|
115649
115701
|
var key = toPath(fileName);
|
|
115650
115702
|
fileExistsCache.delete(key);
|
|
115651
115703
|
var value = readFileCache.get(key);
|
|
@@ -115659,7 +115711,7 @@ var ts;
|
|
|
115659
115711
|
sourceFileCache.delete(key);
|
|
115660
115712
|
}
|
|
115661
115713
|
}
|
|
115662
|
-
originalWriteFile.call(host, fileName, data,
|
|
115714
|
+
originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false));
|
|
115663
115715
|
};
|
|
115664
115716
|
}
|
|
115665
115717
|
// directoryExists
|
|
@@ -116592,6 +116644,7 @@ var ts;
|
|
|
116592
116644
|
useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
|
|
116593
116645
|
getFileIncludeReasons: function () { return fileReasons; },
|
|
116594
116646
|
structureIsReused: structureIsReused,
|
|
116647
|
+
writeFile: writeFile,
|
|
116595
116648
|
};
|
|
116596
116649
|
onProgramCreateComplete();
|
|
116597
116650
|
// Add file processingDiagnostics
|
|
@@ -117089,7 +117142,7 @@ var ts;
|
|
|
117089
117142
|
getProjectReferenceRedirect: getProjectReferenceRedirect,
|
|
117090
117143
|
isSourceOfProjectReferenceRedirect: isSourceOfProjectReferenceRedirect,
|
|
117091
117144
|
getSymlinkCache: getSymlinkCache,
|
|
117092
|
-
writeFile: writeFileCallback ||
|
|
117145
|
+
writeFile: writeFileCallback || writeFile,
|
|
117093
117146
|
isEmitBlocked: isEmitBlocked,
|
|
117094
117147
|
readFile: function (f) { return host.readFile(f); },
|
|
117095
117148
|
fileExists: function (f) {
|
|
@@ -117109,6 +117162,9 @@ var ts;
|
|
|
117109
117162
|
getFileIncludeReasons: program.getFileIncludeReasons,
|
|
117110
117163
|
};
|
|
117111
117164
|
}
|
|
117165
|
+
function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
|
|
117166
|
+
host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
117167
|
+
}
|
|
117112
117168
|
function emitBuildInfo(writeFileCallback) {
|
|
117113
117169
|
ts.Debug.assert(!ts.outFile(options));
|
|
117114
117170
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* Emit */, "emitBuildInfo", {}, /*separateBeginAndEnd*/ true);
|
|
@@ -119551,6 +119607,7 @@ var ts;
|
|
|
119551
119607
|
}
|
|
119552
119608
|
}
|
|
119553
119609
|
}
|
|
119610
|
+
BuilderState.updateExportedModules = updateExportedModules;
|
|
119554
119611
|
/**
|
|
119555
119612
|
* Updates the exported modules from cache into state's exported modules map
|
|
119556
119613
|
* This should be called whenever it is safe to commit the state of the builder
|
|
@@ -119974,6 +120031,18 @@ var ts;
|
|
|
119974
120031
|
}
|
|
119975
120032
|
return undefined;
|
|
119976
120033
|
}
|
|
120034
|
+
function removeDiagnosticsOfLibraryFiles(state) {
|
|
120035
|
+
if (!state.cleanedDiagnosticsOfLibFiles) {
|
|
120036
|
+
state.cleanedDiagnosticsOfLibFiles = true;
|
|
120037
|
+
var program_1 = ts.Debug.checkDefined(state.program);
|
|
120038
|
+
var options_2 = program_1.getCompilerOptions();
|
|
120039
|
+
ts.forEach(program_1.getSourceFiles(), function (f) {
|
|
120040
|
+
return program_1.isSourceFileDefaultLibrary(f) &&
|
|
120041
|
+
!ts.skipTypeChecking(f, options_2, program_1) &&
|
|
120042
|
+
removeSemanticDiagnosticsOf(state, f.resolvedPath);
|
|
120043
|
+
});
|
|
120044
|
+
}
|
|
120045
|
+
}
|
|
119977
120046
|
/**
|
|
119978
120047
|
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
|
|
119979
120048
|
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
|
|
@@ -119983,28 +120052,17 @@ var ts;
|
|
|
119983
120052
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
119984
120053
|
// If affected files is everything except default library, then nothing more to do
|
|
119985
120054
|
if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
|
|
119986
|
-
|
|
119987
|
-
state.cleanedDiagnosticsOfLibFiles = true;
|
|
119988
|
-
var program_1 = ts.Debug.checkDefined(state.program);
|
|
119989
|
-
var options_2 = program_1.getCompilerOptions();
|
|
119990
|
-
ts.forEach(program_1.getSourceFiles(), function (f) {
|
|
119991
|
-
return program_1.isSourceFileDefaultLibrary(f) &&
|
|
119992
|
-
!ts.skipTypeChecking(f, options_2, program_1) &&
|
|
119993
|
-
removeSemanticDiagnosticsOf(state, f.resolvedPath);
|
|
119994
|
-
});
|
|
119995
|
-
}
|
|
120055
|
+
removeDiagnosticsOfLibraryFiles(state);
|
|
119996
120056
|
// When a change affects the global scope, all files are considered to be affected without updating their signature
|
|
119997
120057
|
// That means when affected file is handled, its signature can be out of date
|
|
119998
120058
|
// To avoid this, ensure that we update the signature for any affected file in this scenario.
|
|
119999
120059
|
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
|
|
120000
120060
|
return;
|
|
120001
120061
|
}
|
|
120002
|
-
|
|
120003
|
-
|
|
120004
|
-
|
|
120005
|
-
|
|
120006
|
-
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host); });
|
|
120007
|
-
}
|
|
120062
|
+
ts.Debug.assert(state.hasCalledUpdateShapeSignature.has(affectedFile.resolvedPath) || ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.has(affectedFile.resolvedPath)), "Signature not updated for affected file: " + affectedFile.fileName);
|
|
120063
|
+
if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
|
|
120064
|
+
return;
|
|
120065
|
+
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
|
|
120008
120066
|
}
|
|
120009
120067
|
/**
|
|
120010
120068
|
* Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
|
|
@@ -120046,16 +120104,41 @@ var ts;
|
|
|
120046
120104
|
var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
|
|
120047
120105
|
return newSignature !== oldSignature;
|
|
120048
120106
|
}
|
|
120107
|
+
function forEachKeyOfExportedModulesMap(state, filePath, fn) {
|
|
120108
|
+
// Go through exported modules from cache first
|
|
120109
|
+
var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
|
|
120110
|
+
var result = keys && ts.forEachKey(keys, fn);
|
|
120111
|
+
if (result)
|
|
120112
|
+
return result;
|
|
120113
|
+
// If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
|
|
120114
|
+
keys = state.exportedModulesMap.getKeys(filePath);
|
|
120115
|
+
return keys && ts.forEachKey(keys, function (exportedFromPath) {
|
|
120116
|
+
var _a;
|
|
120117
|
+
// If the cache had an updated value, skip
|
|
120118
|
+
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
120119
|
+
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
|
|
120120
|
+
fn(exportedFromPath) :
|
|
120121
|
+
undefined;
|
|
120122
|
+
});
|
|
120123
|
+
}
|
|
120124
|
+
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
|
|
120125
|
+
var _a;
|
|
120126
|
+
if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
|
|
120127
|
+
return false;
|
|
120128
|
+
// Every file needs to be handled
|
|
120129
|
+
ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, /*firstSourceFile*/ undefined)
|
|
120130
|
+
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, host); });
|
|
120131
|
+
removeDiagnosticsOfLibraryFiles(state);
|
|
120132
|
+
return true;
|
|
120133
|
+
}
|
|
120049
120134
|
/**
|
|
120050
|
-
* Iterate on referencing modules that export entities from affected file
|
|
120135
|
+
* Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
|
|
120051
120136
|
*/
|
|
120052
|
-
function
|
|
120053
|
-
var _a, _b;
|
|
120137
|
+
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
|
|
120054
120138
|
// If there was change in signature (dts output) for the changed file,
|
|
120055
120139
|
// then only we need to handle pending file emit
|
|
120056
|
-
if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
|
|
120140
|
+
if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
|
|
120057
120141
|
return;
|
|
120058
|
-
}
|
|
120059
120142
|
if (!isChangedSignature(state, affectedFile.resolvedPath))
|
|
120060
120143
|
return;
|
|
120061
120144
|
// Since isolated modules dont change js files, files affected by change in signature is itself
|
|
@@ -120068,7 +120151,9 @@ var ts;
|
|
|
120068
120151
|
var currentPath = queue.pop();
|
|
120069
120152
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
120070
120153
|
seenFileNamesMap.set(currentPath, true);
|
|
120071
|
-
|
|
120154
|
+
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, host))
|
|
120155
|
+
return;
|
|
120156
|
+
handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, host);
|
|
120072
120157
|
if (isChangedSignature(state, currentPath)) {
|
|
120073
120158
|
var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
|
|
120074
120159
|
queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
@@ -120080,56 +120165,38 @@ var ts;
|
|
|
120080
120165
|
var seenFileAndExportsOfFile = new ts.Set();
|
|
120081
120166
|
// Go through exported modules from cache first
|
|
120082
120167
|
// If exported modules has path, all files referencing file exported from are affected
|
|
120083
|
-
(
|
|
120084
|
-
|
|
120085
|
-
|
|
120086
|
-
|
|
120087
|
-
|
|
120088
|
-
|
|
120089
|
-
|
|
120090
|
-
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
120091
|
-
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) &&
|
|
120092
|
-
forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
|
|
120168
|
+
forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
|
|
120169
|
+
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
|
|
120170
|
+
return true;
|
|
120171
|
+
var references = state.referencedMap.getKeys(exportedFromPath);
|
|
120172
|
+
return references && ts.forEachKey(references, function (filePath) {
|
|
120173
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
|
|
120174
|
+
});
|
|
120093
120175
|
});
|
|
120094
120176
|
}
|
|
120095
120177
|
/**
|
|
120096
|
-
*
|
|
120178
|
+
* handle dts and semantic diagnostics on file and iterate on anything that exports this file
|
|
120179
|
+
* return true when all work is done and we can exit handling dts emit and semantic diagnostics
|
|
120097
120180
|
*/
|
|
120098
|
-
function
|
|
120181
|
+
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
|
|
120099
120182
|
var _a;
|
|
120100
|
-
|
|
120101
|
-
return
|
|
120102
|
-
|
|
120103
|
-
|
|
120104
|
-
|
|
120105
|
-
* fn on file and iterate on anything that exports this file
|
|
120106
|
-
*/
|
|
120107
|
-
function forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn) {
|
|
120108
|
-
var _a, _b, _c;
|
|
120109
|
-
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath)) {
|
|
120110
|
-
return;
|
|
120111
|
-
}
|
|
120112
|
-
fn(state, filePath);
|
|
120183
|
+
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
|
|
120184
|
+
return undefined;
|
|
120185
|
+
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
|
|
120186
|
+
return true;
|
|
120187
|
+
handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
|
|
120113
120188
|
ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
|
|
120114
|
-
// Go through exported modules from cache first
|
|
120115
120189
|
// If exported modules has path, all files referencing file exported from are affected
|
|
120116
|
-
(
|
|
120117
|
-
return
|
|
120118
|
-
});
|
|
120119
|
-
// If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
|
|
120120
|
-
(_b = state.exportedModulesMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (exportedFromPath) {
|
|
120121
|
-
var _a;
|
|
120122
|
-
// If the cache had an updated value, skip
|
|
120123
|
-
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
120124
|
-
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) &&
|
|
120125
|
-
forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
|
|
120190
|
+
forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
|
|
120191
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
|
|
120126
120192
|
});
|
|
120127
120193
|
// Remove diagnostics of files that import this file (without going to exports of referencing files)
|
|
120128
|
-
(
|
|
120194
|
+
(_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
|
|
120129
120195
|
return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
|
|
120130
|
-
|
|
120131
|
-
|
|
120132
|
-
);
|
|
120196
|
+
handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
|
|
120197
|
+
state, referencingFilePath, cancellationToken, computeHash, host);
|
|
120198
|
+
});
|
|
120199
|
+
return undefined;
|
|
120133
120200
|
}
|
|
120134
120201
|
/**
|
|
120135
120202
|
* This is called after completing operation on the next affected file.
|
|
@@ -120505,7 +120572,43 @@ var ts;
|
|
|
120505
120572
|
return toAffectedFileEmitResult(state,
|
|
120506
120573
|
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
|
|
120507
120574
|
// Otherwise just affected file
|
|
120508
|
-
ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected,
|
|
120575
|
+
ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
|
|
120576
|
+
getWriteFileUpdatingSignatureCallback(writeFile) :
|
|
120577
|
+
writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
|
|
120578
|
+
}
|
|
120579
|
+
function getWriteFileUpdatingSignatureCallback(writeFile) {
|
|
120580
|
+
return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
|
|
120581
|
+
var _a;
|
|
120582
|
+
if (ts.isDeclarationFileName(fileName)) {
|
|
120583
|
+
ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
|
|
120584
|
+
var file = sourceFiles[0];
|
|
120585
|
+
var info = state.fileInfos.get(file.resolvedPath);
|
|
120586
|
+
var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
|
|
120587
|
+
if (signature === file.version) {
|
|
120588
|
+
var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
|
|
120589
|
+
if (newSignature !== file.version) { // Update it
|
|
120590
|
+
if (host.storeFilesChangingSignatureDuringEmit)
|
|
120591
|
+
(state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
|
|
120592
|
+
if (state.exportedModulesMap)
|
|
120593
|
+
ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
|
|
120594
|
+
if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
|
|
120595
|
+
state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
|
|
120596
|
+
}
|
|
120597
|
+
else {
|
|
120598
|
+
info.signature = newSignature;
|
|
120599
|
+
if (state.exportedModulesMap)
|
|
120600
|
+
ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
|
|
120601
|
+
}
|
|
120602
|
+
}
|
|
120603
|
+
}
|
|
120604
|
+
}
|
|
120605
|
+
if (writeFile)
|
|
120606
|
+
writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
120607
|
+
else if (host.writeFile)
|
|
120608
|
+
host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
120609
|
+
else
|
|
120610
|
+
state.program.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
120611
|
+
};
|
|
120509
120612
|
}
|
|
120510
120613
|
/**
|
|
120511
120614
|
* Emits the JavaScript and declaration files.
|
|
@@ -120562,7 +120665,9 @@ var ts;
|
|
|
120562
120665
|
}
|
|
120563
120666
|
}
|
|
120564
120667
|
}
|
|
120565
|
-
return ts.Debug.checkDefined(state.program).emit(targetSourceFile,
|
|
120668
|
+
return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
|
|
120669
|
+
getWriteFileUpdatingSignatureCallback(writeFile) :
|
|
120670
|
+
writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
|
|
120566
120671
|
}
|
|
120567
120672
|
/**
|
|
120568
120673
|
* Return the semantic diagnostics for the next affected file or undefined if iteration is complete
|
|
@@ -122754,6 +122859,7 @@ var ts;
|
|
|
122754
122859
|
createHash: ts.maybeBind(host, host.createHash),
|
|
122755
122860
|
readDirectory: ts.maybeBind(host, host.readDirectory),
|
|
122756
122861
|
disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
|
|
122862
|
+
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
|
|
122757
122863
|
};
|
|
122758
122864
|
function writeFile(fileName, text, writeByteOrderMark, onError) {
|
|
122759
122865
|
try {
|
|
@@ -122813,6 +122919,7 @@ var ts;
|
|
|
122813
122919
|
createHash: ts.maybeBind(system, system.createHash),
|
|
122814
122920
|
createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
|
|
122815
122921
|
disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
|
|
122922
|
+
storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
|
|
122816
122923
|
};
|
|
122817
122924
|
}
|
|
122818
122925
|
ts.createProgramHost = createProgramHost;
|
|
@@ -122901,6 +123008,7 @@ var ts;
|
|
|
122901
123008
|
var host = ts.createCompilerHostWorker(options, /*setParentNodes*/ undefined, system);
|
|
122902
123009
|
host.createHash = ts.maybeBind(system, system.createHash);
|
|
122903
123010
|
host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
|
|
123011
|
+
host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
|
|
122904
123012
|
ts.setGetSourceFileAsHashVersioned(host, system);
|
|
122905
123013
|
ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
|
|
122906
123014
|
return host;
|
|
@@ -131650,7 +131758,7 @@ var ts;
|
|
|
131650
131758
|
GlobalsSearch[GlobalsSearch["Success"] = 1] = "Success";
|
|
131651
131759
|
GlobalsSearch[GlobalsSearch["Fail"] = 2] = "Fail";
|
|
131652
131760
|
})(GlobalsSearch || (GlobalsSearch = {}));
|
|
131653
|
-
function resolvingModuleSpecifiers(logPrefix, host, program, sourceFile, preferences, isForImportStatementCompletion, cb) {
|
|
131761
|
+
function resolvingModuleSpecifiers(logPrefix, host, program, sourceFile, position, preferences, isForImportStatementCompletion, isValidTypeOnlyUseSite, cb) {
|
|
131654
131762
|
var _a, _b, _c;
|
|
131655
131763
|
var start = ts.timestamp();
|
|
131656
131764
|
var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
@@ -131665,9 +131773,9 @@ var ts;
|
|
|
131665
131773
|
(_b = host.log) === null || _b === void 0 ? void 0 : _b.call(host, logPrefix + ": response is " + (resolutionLimitExceeded ? "incomplete" : "complete"));
|
|
131666
131774
|
(_c = host.log) === null || _c === void 0 ? void 0 : _c.call(host, logPrefix + ": " + (ts.timestamp() - start));
|
|
131667
131775
|
return result;
|
|
131668
|
-
function tryResolve(exportInfo, isFromAmbientModule) {
|
|
131776
|
+
function tryResolve(exportInfo, symbolName, isFromAmbientModule) {
|
|
131669
131777
|
if (isFromAmbientModule) {
|
|
131670
|
-
var result_1 = ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, sourceFile, program, host, preferences);
|
|
131778
|
+
var result_1 = ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, symbolName, position, isValidTypeOnlyUseSite, sourceFile, program, host, preferences);
|
|
131671
131779
|
if (result_1) {
|
|
131672
131780
|
ambientCount++;
|
|
131673
131781
|
}
|
|
@@ -131676,7 +131784,7 @@ var ts;
|
|
|
131676
131784
|
var shouldResolveModuleSpecifier = isForImportStatementCompletion || preferences.allowIncompleteCompletions && resolvedCount < Completions.moduleSpecifierResolutionLimit;
|
|
131677
131785
|
var shouldGetModuleSpecifierFromCache = !shouldResolveModuleSpecifier && preferences.allowIncompleteCompletions && cacheAttemptCount < Completions.moduleSpecifierResolutionCacheAttemptLimit;
|
|
131678
131786
|
var result = (shouldResolveModuleSpecifier || shouldGetModuleSpecifierFromCache)
|
|
131679
|
-
? ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, sourceFile, program, host, preferences, packageJsonImportFilter, shouldGetModuleSpecifierFromCache)
|
|
131787
|
+
? ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, symbolName, position, isValidTypeOnlyUseSite, sourceFile, program, host, preferences, packageJsonImportFilter, shouldGetModuleSpecifierFromCache)
|
|
131680
131788
|
: undefined;
|
|
131681
131789
|
if (!shouldResolveModuleSpecifier && !shouldGetModuleSpecifierFromCache || shouldGetModuleSpecifierFromCache && !result) {
|
|
131682
131790
|
resolutionLimitExceeded = true;
|
|
@@ -131781,8 +131889,8 @@ var ts;
|
|
|
131781
131889
|
return undefined;
|
|
131782
131890
|
var lowerCaseTokenText = location.text.toLowerCase();
|
|
131783
131891
|
var exportMap = ts.getExportInfoMap(file, host, program, cancellationToken);
|
|
131784
|
-
var newEntries = resolvingModuleSpecifiers("continuePreviousIncompleteResponse", host, program, file, preferences,
|
|
131785
|
-
/*isForImportStatementCompletion*/ false, function (context) {
|
|
131892
|
+
var newEntries = resolvingModuleSpecifiers("continuePreviousIncompleteResponse", host, program, file, location.getStart(), preferences,
|
|
131893
|
+
/*isForImportStatementCompletion*/ false, ts.isValidTypeOnlyAliasUseSite(location), function (context) {
|
|
131786
131894
|
var entries = ts.mapDefined(previousResponse.entries, function (entry) {
|
|
131787
131895
|
if (!entry.hasAction || !entry.source || !entry.data || completionEntryDataIsResolved(entry.data)) {
|
|
131788
131896
|
// Not an auto import or already resolved; keep as is
|
|
@@ -131794,7 +131902,7 @@ var ts;
|
|
|
131794
131902
|
}
|
|
131795
131903
|
var origin = ts.Debug.checkDefined(getAutoImportSymbolFromCompletionEntryData(entry.name, entry.data, program, host)).origin;
|
|
131796
131904
|
var info = exportMap.get(file.path, entry.data.exportMapKey);
|
|
131797
|
-
var result = info && context.tryResolve(info, !ts.isExternalModuleNameRelative(ts.stripQuotes(origin.moduleSymbol.name)));
|
|
131905
|
+
var result = info && context.tryResolve(info, entry.name, !ts.isExternalModuleNameRelative(ts.stripQuotes(origin.moduleSymbol.name)));
|
|
131798
131906
|
if (!result)
|
|
131799
131907
|
return entry;
|
|
131800
131908
|
var newOrigin = __assign(__assign({}, origin), { kind: 32 /* ResolvedExport */, moduleSpecifier: result.moduleSpecifier });
|
|
@@ -132386,22 +132494,44 @@ var ts;
|
|
|
132386
132494
|
}
|
|
132387
132495
|
}
|
|
132388
132496
|
function createSnippetPrinter(printerOptions) {
|
|
132497
|
+
var escapes;
|
|
132389
132498
|
var baseWriter = ts.textChanges.createWriter(ts.getNewLineCharacter(printerOptions));
|
|
132390
132499
|
var printer = ts.createPrinter(printerOptions, baseWriter);
|
|
132391
|
-
var writer = __assign(__assign({}, baseWriter), { write: function (s) { return baseWriter.write(
|
|
132500
|
+
var writer = __assign(__assign({}, baseWriter), { write: function (s) { return escapingWrite(s, function () { return baseWriter.write(s); }); }, nonEscapingWrite: baseWriter.write, writeLiteral: function (s) { return escapingWrite(s, function () { return baseWriter.writeLiteral(s); }); }, writeStringLiteral: function (s) { return escapingWrite(s, function () { return baseWriter.writeStringLiteral(s); }); }, writeSymbol: function (s, symbol) { return escapingWrite(s, function () { return baseWriter.writeSymbol(s, symbol); }); }, writeParameter: function (s) { return escapingWrite(s, function () { return baseWriter.writeParameter(s); }); }, writeComment: function (s) { return escapingWrite(s, function () { return baseWriter.writeComment(s); }); }, writeProperty: function (s) { return escapingWrite(s, function () { return baseWriter.writeProperty(s); }); } });
|
|
132392
132501
|
return {
|
|
132393
132502
|
printSnippetList: printSnippetList,
|
|
132394
132503
|
printAndFormatSnippetList: printAndFormatSnippetList,
|
|
132395
132504
|
};
|
|
132505
|
+
// The formatter/scanner will have issues with snippet-escaped text,
|
|
132506
|
+
// so instead of writing the escaped text directly to the writer,
|
|
132507
|
+
// generate a set of changes that can be applied to the unescaped text
|
|
132508
|
+
// to escape it post-formatting.
|
|
132509
|
+
function escapingWrite(s, write) {
|
|
132510
|
+
var escaped = ts.escapeSnippetText(s);
|
|
132511
|
+
if (escaped !== s) {
|
|
132512
|
+
var start = baseWriter.getTextPos();
|
|
132513
|
+
write();
|
|
132514
|
+
var end = baseWriter.getTextPos();
|
|
132515
|
+
escapes = ts.append(escapes || (escapes = []), { newText: escaped, span: { start: start, length: end - start } });
|
|
132516
|
+
}
|
|
132517
|
+
else {
|
|
132518
|
+
write();
|
|
132519
|
+
}
|
|
132520
|
+
}
|
|
132396
132521
|
/* Snippet-escaping version of `printer.printList`. */
|
|
132397
132522
|
function printSnippetList(format, list, sourceFile) {
|
|
132523
|
+
var unescaped = printUnescapedSnippetList(format, list, sourceFile);
|
|
132524
|
+
return escapes ? ts.textChanges.applyChanges(unescaped, escapes) : unescaped;
|
|
132525
|
+
}
|
|
132526
|
+
function printUnescapedSnippetList(format, list, sourceFile) {
|
|
132527
|
+
escapes = undefined;
|
|
132398
132528
|
writer.clear();
|
|
132399
132529
|
printer.writeList(format, list, sourceFile, writer);
|
|
132400
132530
|
return writer.getText();
|
|
132401
132531
|
}
|
|
132402
132532
|
function printAndFormatSnippetList(format, list, sourceFile, formatContext) {
|
|
132403
132533
|
var syntheticFile = {
|
|
132404
|
-
text:
|
|
132534
|
+
text: printUnescapedSnippetList(format, list, sourceFile),
|
|
132405
132535
|
getLineAndCharacterOfPosition: function (pos) {
|
|
132406
132536
|
return ts.getLineAndCharacterOfPosition(this, pos);
|
|
132407
132537
|
},
|
|
@@ -132413,7 +132543,10 @@ var ts;
|
|
|
132413
132543
|
/* indentation */ 0,
|
|
132414
132544
|
/* delta */ 0, __assign(__assign({}, formatContext), { options: formatOptions }));
|
|
132415
132545
|
});
|
|
132416
|
-
|
|
132546
|
+
var allChanges = escapes
|
|
132547
|
+
? ts.stableSort(ts.concatenate(changes, escapes), function (a, b) { return ts.compareTextSpans(a.span, b.span); })
|
|
132548
|
+
: changes;
|
|
132549
|
+
return ts.textChanges.applyChanges(syntheticFile.text, allChanges);
|
|
132417
132550
|
}
|
|
132418
132551
|
}
|
|
132419
132552
|
function originToCompletionEntryData(origin) {
|
|
@@ -133305,7 +133438,7 @@ var ts;
|
|
|
133305
133438
|
moduleSymbol: moduleSymbol,
|
|
133306
133439
|
symbol: firstAccessibleSymbol,
|
|
133307
133440
|
targetFlags: ts.skipAlias(firstAccessibleSymbol, typeChecker).flags,
|
|
133308
|
-
}], sourceFile, program, host, preferences) || {}).moduleSpecifier;
|
|
133441
|
+
}], firstAccessibleSymbol.name, position, ts.isValidTypeOnlyAliasUseSite(location), sourceFile, program, host, preferences) || {}).moduleSpecifier;
|
|
133309
133442
|
if (moduleSpecifier) {
|
|
133310
133443
|
var origin = {
|
|
133311
133444
|
kind: getNullableSymbolOriginInfoKind(6 /* SymbolMemberExport */),
|
|
@@ -133560,7 +133693,7 @@ var ts;
|
|
|
133560
133693
|
var exportInfo = ts.getExportInfoMap(sourceFile, host, program, cancellationToken);
|
|
133561
133694
|
var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host);
|
|
133562
133695
|
var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
133563
|
-
resolvingModuleSpecifiers("collectAutoImports", host, program, sourceFile, preferences, !!importCompletionNode, function (context) {
|
|
133696
|
+
resolvingModuleSpecifiers("collectAutoImports", host, program, sourceFile, position, preferences, !!importCompletionNode, ts.isValidTypeOnlyAliasUseSite(location), function (context) {
|
|
133564
133697
|
exportInfo.search(sourceFile.path,
|
|
133565
133698
|
/*preferCapitalized*/ isRightOfOpenTag, function (symbolName, targetFlags) {
|
|
133566
133699
|
if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings())))
|
|
@@ -133588,7 +133721,7 @@ var ts;
|
|
|
133588
133721
|
}
|
|
133589
133722
|
// If we don't need to resolve module specifiers, we can use any re-export that is importable at all
|
|
133590
133723
|
// (We need to ensure that at least one is importable to show a completion.)
|
|
133591
|
-
var _a = context.tryResolve(info, isFromAmbientModule) || {}, _b = _a.exportInfo, exportInfo = _b === void 0 ? defaultExportInfo : _b, moduleSpecifier = _a.moduleSpecifier;
|
|
133724
|
+
var _a = context.tryResolve(info, symbolName, isFromAmbientModule) || {}, _b = _a.exportInfo, exportInfo = _b === void 0 ? defaultExportInfo : _b, moduleSpecifier = _a.moduleSpecifier;
|
|
133592
133725
|
var isDefaultExport = exportInfo.exportKind === 1 /* Default */;
|
|
133593
133726
|
var symbol = isDefaultExport && ts.getLocalSymbolForExportDefault(exportInfo.symbol) || exportInfo.symbol;
|
|
133594
133727
|
pushAutoImportSymbol(symbol, {
|
|
@@ -152412,7 +152545,7 @@ var ts;
|
|
|
152412
152545
|
var symbol = checker.getMergedSymbol(ts.skipAlias(exportedSymbol, checker));
|
|
152413
152546
|
var exportInfo = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, /*isJsxTagName*/ false, host, program, preferences, useAutoImportProvider);
|
|
152414
152547
|
var useRequire = shouldUseRequire(sourceFile, program);
|
|
152415
|
-
var fix = getImportFixForSymbol(sourceFile, exportInfo, moduleSymbol,
|
|
152548
|
+
var fix = getImportFixForSymbol(sourceFile, exportInfo, moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences);
|
|
152416
152549
|
if (fix) {
|
|
152417
152550
|
addImport({ fixes: [fix], symbolName: symbolName, errorIdentifierText: undefined });
|
|
152418
152551
|
}
|
|
@@ -152582,7 +152715,7 @@ var ts;
|
|
|
152582
152715
|
: getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, isJsxTagName, host, program, preferences, /*useAutoImportProvider*/ true);
|
|
152583
152716
|
var useRequire = shouldUseRequire(sourceFile, program);
|
|
152584
152717
|
var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position));
|
|
152585
|
-
var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol,
|
|
152718
|
+
var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, { symbolName: symbolName, position: position }, isValidTypeOnlyUseSite, useRequire, host, preferences));
|
|
152586
152719
|
return {
|
|
152587
152720
|
moduleSpecifier: fix.moduleSpecifier,
|
|
152588
152721
|
codeAction: codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix,
|
|
@@ -152598,10 +152731,10 @@ var ts;
|
|
|
152598
152731
|
return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, includeSymbolNameInDescription, 1 /* Double */, compilerOptions));
|
|
152599
152732
|
}
|
|
152600
152733
|
codefix.getPromoteTypeOnlyCompletionAction = getPromoteTypeOnlyCompletionAction;
|
|
152601
|
-
function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol,
|
|
152734
|
+
function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, useNamespaceInfo, isValidTypeOnlyUseSite, useRequire, host, preferences) {
|
|
152602
152735
|
ts.Debug.assert(exportInfos.some(function (info) { return info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol; }), "Some exportInfo should match the specified moduleSymbol");
|
|
152603
152736
|
var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
152604
|
-
return getBestFix(getImportFixes(exportInfos,
|
|
152737
|
+
return getBestFix(getImportFixes(exportInfos, useNamespaceInfo, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes, sourceFile, program, packageJsonImportFilter, host);
|
|
152605
152738
|
}
|
|
152606
152739
|
function codeFixActionToCodeAction(_a) {
|
|
152607
152740
|
var description = _a.description, changes = _a.changes, commands = _a.commands;
|
|
@@ -152656,25 +152789,32 @@ var ts;
|
|
|
152656
152789
|
return !moduleFile || ts.isImportableFile(program, importingFile, moduleFile, preferences, /*packageJsonFilter*/ undefined, getModuleSpecifierResolutionHost(isFromPackageJson), (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host));
|
|
152657
152790
|
}
|
|
152658
152791
|
}
|
|
152659
|
-
function getModuleSpecifierForBestExportInfo(exportInfo, importingFile, program, host, preferences, packageJsonImportFilter, fromCacheOnly) {
|
|
152660
|
-
var _a =
|
|
152661
|
-
/*
|
|
152662
|
-
/*isValidTypeOnlyUseSite*/ false,
|
|
152663
|
-
/*useRequire*/ false, exportInfo, host, preferences, fromCacheOnly), fixes = _a.fixes, computedWithoutCacheCount = _a.computedWithoutCacheCount;
|
|
152792
|
+
function getModuleSpecifierForBestExportInfo(exportInfo, symbolName, position, isValidTypeOnlyUseSite, importingFile, program, host, preferences, packageJsonImportFilter, fromCacheOnly) {
|
|
152793
|
+
var _a = getImportFixes(exportInfo, { symbolName: symbolName, position: position }, isValidTypeOnlyUseSite,
|
|
152794
|
+
/*useRequire*/ false, program, importingFile, host, preferences, fromCacheOnly), fixes = _a.fixes, computedWithoutCacheCount = _a.computedWithoutCacheCount;
|
|
152664
152795
|
var result = getBestFix(fixes, importingFile, program, packageJsonImportFilter || ts.createPackageJsonImportFilter(importingFile, preferences, host), host);
|
|
152665
152796
|
return result && __assign(__assign({}, result), { computedWithoutCacheCount: computedWithoutCacheCount });
|
|
152666
152797
|
}
|
|
152667
152798
|
codefix.getModuleSpecifierForBestExportInfo = getModuleSpecifierForBestExportInfo;
|
|
152668
|
-
function getImportFixes(exportInfos,
|
|
152799
|
+
function getImportFixes(exportInfos, useNamespaceInfo,
|
|
152669
152800
|
/** undefined only for missing JSX namespace */
|
|
152670
|
-
|
|
152801
|
+
isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, fromCacheOnly) {
|
|
152671
152802
|
var checker = program.getTypeChecker();
|
|
152672
152803
|
var existingImports = ts.flatMap(exportInfos, function (info) { return getExistingImportDeclarations(info, checker, sourceFile, program.getCompilerOptions()); });
|
|
152673
|
-
var useNamespace =
|
|
152804
|
+
var useNamespace = useNamespaceInfo && tryUseExistingNamespaceImport(existingImports, useNamespaceInfo.symbolName, useNamespaceInfo.position, checker);
|
|
152674
152805
|
var addToExisting = tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, program.getCompilerOptions());
|
|
152675
|
-
|
|
152676
|
-
|
|
152677
|
-
|
|
152806
|
+
if (addToExisting) {
|
|
152807
|
+
// Don't bother providing an action to add a new import if we can add to an existing one.
|
|
152808
|
+
return {
|
|
152809
|
+
computedWithoutCacheCount: 0,
|
|
152810
|
+
fixes: __spreadArray(__spreadArray([], (useNamespace ? [useNamespace] : ts.emptyArray), true), [addToExisting], false),
|
|
152811
|
+
};
|
|
152812
|
+
}
|
|
152813
|
+
var _a = getFixesForAddImport(exportInfos, existingImports, program, sourceFile, useNamespaceInfo === null || useNamespaceInfo === void 0 ? void 0 : useNamespaceInfo.position, isValidTypeOnlyUseSite, useRequire, host, preferences, fromCacheOnly), fixes = _a.fixes, _b = _a.computedWithoutCacheCount, computedWithoutCacheCount = _b === void 0 ? 0 : _b;
|
|
152814
|
+
return {
|
|
152815
|
+
computedWithoutCacheCount: computedWithoutCacheCount,
|
|
152816
|
+
fixes: __spreadArray(__spreadArray([], (useNamespace ? [useNamespace] : ts.emptyArray), true), fixes, true),
|
|
152817
|
+
};
|
|
152678
152818
|
}
|
|
152679
152819
|
function tryUseExistingNamespaceImport(existingImports, symbolName, position, checker) {
|
|
152680
152820
|
// It is possible that multiple import statements with the same specifier exist in the file.
|
|
@@ -152864,9 +153004,9 @@ var ts;
|
|
|
152864
153004
|
});
|
|
152865
153005
|
return { computedWithoutCacheCount: computedWithoutCacheCount, fixes: fixes };
|
|
152866
153006
|
}
|
|
152867
|
-
function getFixesForAddImport(exportInfos, existingImports, program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
|
|
153007
|
+
function getFixesForAddImport(exportInfos, existingImports, program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, host, preferences, fromCacheOnly) {
|
|
152868
153008
|
var existingDeclaration = ts.firstDefined(existingImports, function (info) { return newImportInfoFromExistingSpecifier(info, isValidTypeOnlyUseSite, useRequire, program.getTypeChecker(), program.getCompilerOptions()); });
|
|
152869
|
-
return existingDeclaration ? [existingDeclaration] : getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfos, host, preferences)
|
|
153009
|
+
return existingDeclaration ? { fixes: [existingDeclaration] } : getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfos, host, preferences, fromCacheOnly);
|
|
152870
153010
|
}
|
|
152871
153011
|
function newImportInfoFromExistingSpecifier(_a, isValidTypeOnlyUseSite, useRequire, checker, compilerOptions) {
|
|
152872
153012
|
var _b;
|
|
@@ -152962,7 +153102,8 @@ var ts;
|
|
|
152962
153102
|
var symbolName = umdSymbol.name;
|
|
152963
153103
|
var exportInfo = [{ symbol: umdSymbol, moduleSymbol: symbol, moduleFileName: undefined, exportKind: 3 /* UMD */, targetFlags: symbol.flags, isFromPackageJson: false }];
|
|
152964
153104
|
var useRequire = shouldUseRequire(sourceFile, program);
|
|
152965
|
-
var
|
|
153105
|
+
var position = ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined;
|
|
153106
|
+
var fixes = getImportFixes(exportInfo, position ? { position: position, symbolName: symbolName } : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences).fixes;
|
|
152966
153107
|
return { fixes: fixes, symbolName: symbolName, errorIdentifierText: (_b = ts.tryCast(token, ts.isIdentifier)) === null || _b === void 0 ? void 0 : _b.text };
|
|
152967
153108
|
}
|
|
152968
153109
|
function getUmdSymbol(token, checker) {
|
|
@@ -153034,7 +153175,7 @@ var ts;
|
|
|
153034
153175
|
var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences);
|
|
153035
153176
|
var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) {
|
|
153036
153177
|
var _ = _a[0], exportInfos = _a[1];
|
|
153037
|
-
return getImportFixes(exportInfos, symbolName, symbolToken.getStart(sourceFile), isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences);
|
|
153178
|
+
return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes;
|
|
153038
153179
|
}));
|
|
153039
153180
|
return { fixes: fixes, symbolName: symbolName, errorIdentifierText: symbolToken.text };
|
|
153040
153181
|
}
|