@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/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220427";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -14702,7 +14702,7 @@ var ts;
|
|
|
14702
14702
|
var _a;
|
|
14703
14703
|
// If we don't need to downlevel and we can reach the original source text using
|
|
14704
14704
|
// the node's parent reference, then simply get the text as it was originally written.
|
|
14705
|
-
if (canUseOriginalText(node, flags)) {
|
|
14705
|
+
if (sourceFile && canUseOriginalText(node, flags)) {
|
|
14706
14706
|
return getSourceTextOfNodeFromSourceFile(sourceFile, node);
|
|
14707
14707
|
}
|
|
14708
14708
|
// If we can't reach the original source text, use the canonical form if it's a number,
|
|
@@ -18293,10 +18293,10 @@ var ts;
|
|
|
18293
18293
|
return ts.combinePaths(newDirPath, sourceFilePath);
|
|
18294
18294
|
}
|
|
18295
18295
|
ts.getSourceFilePathInNewDirWorker = getSourceFilePathInNewDirWorker;
|
|
18296
|
-
function writeFile(host, diagnostics, fileName,
|
|
18297
|
-
host.writeFile(fileName,
|
|
18296
|
+
function writeFile(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) {
|
|
18297
|
+
host.writeFile(fileName, text, writeByteOrderMark, function (hostErrorMessage) {
|
|
18298
18298
|
diagnostics.add(createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage));
|
|
18299
|
-
}, sourceFiles);
|
|
18299
|
+
}, sourceFiles, data);
|
|
18300
18300
|
}
|
|
18301
18301
|
ts.writeFile = writeFile;
|
|
18302
18302
|
function ensureDirectoriesExist(directoryPath, createDirectory, directoryExists) {
|
|
@@ -34223,7 +34223,7 @@ var ts;
|
|
|
34223
34223
|
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction), pos);
|
|
34224
34224
|
}
|
|
34225
34225
|
// It wasn't an assignment or a lambda. This is a conditional expression:
|
|
34226
|
-
return parseConditionalExpressionRest(expr, pos
|
|
34226
|
+
return parseConditionalExpressionRest(expr, pos);
|
|
34227
34227
|
}
|
|
34228
34228
|
function isYieldExpression() {
|
|
34229
34229
|
if (token() === 125 /* YieldKeyword */) {
|
|
@@ -34298,7 +34298,7 @@ var ts;
|
|
|
34298
34298
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
34299
34299
|
// expression instead.
|
|
34300
34300
|
return triState === 1 /* True */ ?
|
|
34301
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, disallowReturnTypeInArrowFunction) :
|
|
34301
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, /*disallowReturnTypeInArrowFunction*/ false) :
|
|
34302
34302
|
tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction); });
|
|
34303
34303
|
}
|
|
34304
34304
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
@@ -34513,8 +34513,13 @@ var ts;
|
|
|
34513
34513
|
// This is a valid arrow function with "z" as the return type.
|
|
34514
34514
|
//
|
|
34515
34515
|
// But, if we're in the true side of a conditional expression, this colon
|
|
34516
|
-
// terminates the expression, so we cannot allow a return type
|
|
34516
|
+
// terminates the expression, so we cannot allow a return type if we aren't
|
|
34517
34517
|
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34518
|
+
//
|
|
34519
|
+
// For example,
|
|
34520
|
+
// a() ? (b: number, c?: string): void => d() : e
|
|
34521
|
+
// is determined by isParenthesizedArrowFunctionExpression to unambiguously
|
|
34522
|
+
// be an arrow expression, so we allow a return type.
|
|
34518
34523
|
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34519
34524
|
return undefined;
|
|
34520
34525
|
}
|
|
@@ -34584,7 +34589,7 @@ var ts;
|
|
|
34584
34589
|
topLevel = savedTopLevel;
|
|
34585
34590
|
return node;
|
|
34586
34591
|
}
|
|
34587
|
-
function parseConditionalExpressionRest(leftOperand, pos
|
|
34592
|
+
function parseConditionalExpressionRest(leftOperand, pos) {
|
|
34588
34593
|
// Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher.
|
|
34589
34594
|
var questionToken = parseOptionalToken(57 /* QuestionToken */);
|
|
34590
34595
|
if (!questionToken) {
|
|
@@ -34594,7 +34599,7 @@ var ts;
|
|
|
34594
34599
|
// we do not that for the 'whenFalse' part.
|
|
34595
34600
|
var colonToken;
|
|
34596
34601
|
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
34597
|
-
? parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction)
|
|
34602
|
+
? parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ true)
|
|
34598
34603
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
34599
34604
|
}
|
|
34600
34605
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -48331,6 +48336,7 @@ var ts;
|
|
|
48331
48336
|
var keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType;
|
|
48332
48337
|
var numberOrBigIntType = getUnionType([numberType, bigintType]);
|
|
48333
48338
|
var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
|
|
48339
|
+
var numericStringType = getTemplateLiteralType(["", ""], [numberType]); // The `${number}` type
|
|
48334
48340
|
var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; });
|
|
48335
48341
|
var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? wildcardType : t; });
|
|
48336
48342
|
var uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never"); // `uniqueLiteralType` is a special `never` flagged by union reduction to behave as a literal
|
|
@@ -51312,7 +51318,7 @@ var ts;
|
|
|
51312
51318
|
}
|
|
51313
51319
|
}
|
|
51314
51320
|
function getExportSymbolOfValueSymbolIfExported(symbol) {
|
|
51315
|
-
return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0
|
|
51321
|
+
return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 && symbol.exportSymbol || symbol);
|
|
51316
51322
|
}
|
|
51317
51323
|
function symbolIsValue(symbol) {
|
|
51318
51324
|
return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 111551 /* Value */ && !getTypeOnlyAliasDeclaration(symbol));
|
|
@@ -58715,7 +58721,7 @@ var ts;
|
|
|
58715
58721
|
var typeVariable = getHomomorphicTypeVariable(type);
|
|
58716
58722
|
if (typeVariable && !type.declaration.nameType) {
|
|
58717
58723
|
var constraint = getConstraintOfTypeParameter(typeVariable);
|
|
58718
|
-
if (constraint && (
|
|
58724
|
+
if (constraint && isArrayOrTupleType(constraint)) {
|
|
58719
58725
|
return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
|
|
58720
58726
|
}
|
|
58721
58727
|
}
|
|
@@ -59077,10 +59083,10 @@ var ts;
|
|
|
59077
59083
|
}
|
|
59078
59084
|
function isApplicableIndexType(source, target) {
|
|
59079
59085
|
// A 'string' index signature applies to types assignable to 'string' or 'number', and a 'number' index
|
|
59080
|
-
// signature applies to types assignable to 'number' and numeric string literal types.
|
|
59086
|
+
// signature applies to types assignable to 'number', `${number}` and numeric string literal types.
|
|
59081
59087
|
return isTypeAssignableTo(source, target) ||
|
|
59082
59088
|
target === stringType && isTypeAssignableTo(source, numberType) ||
|
|
59083
|
-
target === numberType && !!(source.flags & 128 /* StringLiteral */) && ts.isNumericLiteralName(source.value);
|
|
59089
|
+
target === numberType && (source === numericStringType || !!(source.flags & 128 /* StringLiteral */) && ts.isNumericLiteralName(source.value));
|
|
59084
59090
|
}
|
|
59085
59091
|
function getIndexInfosOfStructuredType(type) {
|
|
59086
59092
|
if (type.flags & 3670016 /* StructuredType */) {
|
|
@@ -60096,6 +60102,20 @@ var ts;
|
|
|
60096
60102
|
constraints = ts.append(constraints, constraint);
|
|
60097
60103
|
}
|
|
60098
60104
|
}
|
|
60105
|
+
// Given a homomorphic mapped type { [K in keyof T]: XXX }, where T is constrained to an array or tuple type, in the
|
|
60106
|
+
// template type XXX, K has an added constraint of number | `${number}`.
|
|
60107
|
+
else if (type.flags & 262144 /* TypeParameter */ && parent.kind === 195 /* MappedType */ && node === parent.type) {
|
|
60108
|
+
var mappedType = getTypeFromTypeNode(parent);
|
|
60109
|
+
if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
|
|
60110
|
+
var typeParameter = getHomomorphicTypeVariable(mappedType);
|
|
60111
|
+
if (typeParameter) {
|
|
60112
|
+
var constraint = getConstraintOfTypeParameter(typeParameter);
|
|
60113
|
+
if (constraint && everyType(constraint, isArrayOrTupleType)) {
|
|
60114
|
+
constraints = ts.append(constraints, getUnionType([numberType, numericStringType]));
|
|
60115
|
+
}
|
|
60116
|
+
}
|
|
60117
|
+
}
|
|
60118
|
+
}
|
|
60099
60119
|
node = parent;
|
|
60100
60120
|
}
|
|
60101
60121
|
return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type;
|
|
@@ -61063,7 +61083,7 @@ var ts;
|
|
|
61063
61083
|
while (i > 0) {
|
|
61064
61084
|
i--;
|
|
61065
61085
|
var t = types[i];
|
|
61066
|
-
var remove = t.flags & 4 /* String */ && includes & 128 /* StringLiteral */ ||
|
|
61086
|
+
var remove = t.flags & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
|
|
61067
61087
|
t.flags & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
|
|
61068
61088
|
t.flags & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
|
|
61069
61089
|
t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */;
|
|
@@ -61222,7 +61242,7 @@ var ts;
|
|
|
61222
61242
|
if (!strictNullChecks && includes & 98304 /* Nullable */) {
|
|
61223
61243
|
return includes & 32768 /* Undefined */ ? undefinedType : nullType;
|
|
61224
61244
|
}
|
|
61225
|
-
if (includes & 4 /* String */ && includes & 128 /* StringLiteral */ ||
|
|
61245
|
+
if (includes & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
|
|
61226
61246
|
includes & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
|
|
61227
61247
|
includes & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
|
|
61228
61248
|
includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */) {
|
|
@@ -63106,7 +63126,7 @@ var ts;
|
|
|
63106
63126
|
if (!type.declaration.nameType) {
|
|
63107
63127
|
var constraint = void 0;
|
|
63108
63128
|
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 &&
|
|
63109
|
-
(constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint,
|
|
63129
|
+
(constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
63110
63130
|
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
63111
63131
|
}
|
|
63112
63132
|
if (isGenericTupleType(t)) {
|
|
@@ -64544,7 +64564,7 @@ var ts;
|
|
|
64544
64564
|
}
|
|
64545
64565
|
return false;
|
|
64546
64566
|
}
|
|
64547
|
-
return
|
|
64567
|
+
return isArrayOrTupleType(target);
|
|
64548
64568
|
}
|
|
64549
64569
|
if (isReadonlyArrayType(source) && isMutableArrayOrTuple(target)) {
|
|
64550
64570
|
if (reportErrors) {
|
|
@@ -64674,7 +64694,7 @@ var ts;
|
|
|
64674
64694
|
// We suppress recursive intersection property checks because they can generate lots of work when relating
|
|
64675
64695
|
// recursive intersections that are structurally similar but not exactly identical. See #37854.
|
|
64676
64696
|
if (result_7 && !inPropertyCheck && (target.flags & 2097152 /* Intersection */ && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
|
|
64677
|
-
isNonGenericObjectType(target) && !
|
|
64697
|
+
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 */); }))) {
|
|
64678
64698
|
inPropertyCheck = true;
|
|
64679
64699
|
result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4 /* PropertyCheck */, recursionFlags);
|
|
64680
64700
|
inPropertyCheck = false;
|
|
@@ -65301,6 +65321,20 @@ var ts;
|
|
|
65301
65321
|
}
|
|
65302
65322
|
}
|
|
65303
65323
|
}
|
|
65324
|
+
if (relation === comparableRelation && sourceFlags & 262144 /* TypeParameter */) {
|
|
65325
|
+
// This is a carve-out in comparability to essentially forbid comparing a type parameter
|
|
65326
|
+
// with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!)
|
|
65327
|
+
var constraint = getConstraintOfTypeParameter(source);
|
|
65328
|
+
if (constraint && hasNonCircularBaseConstraint(source)) {
|
|
65329
|
+
while (constraint && constraint.flags & 262144 /* TypeParameter */) {
|
|
65330
|
+
if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false)) {
|
|
65331
|
+
return result;
|
|
65332
|
+
}
|
|
65333
|
+
constraint = getConstraintOfTypeParameter(constraint);
|
|
65334
|
+
}
|
|
65335
|
+
}
|
|
65336
|
+
return 0 /* False */;
|
|
65337
|
+
}
|
|
65304
65338
|
}
|
|
65305
65339
|
else if (targetFlags & 4194304 /* Index */) {
|
|
65306
65340
|
var targetType_1 = target.type;
|
|
@@ -65504,7 +65538,7 @@ var ts;
|
|
|
65504
65538
|
if (sourceFlags & 8650752 /* TypeVariable */) {
|
|
65505
65539
|
// IndexedAccess comparisons are handled above in the `targetFlags & TypeFlage.IndexedAccess` branch
|
|
65506
65540
|
if (!(sourceFlags & 8388608 /* IndexedAccess */ && targetFlags & 8388608 /* IndexedAccess */)) {
|
|
65507
|
-
var constraint = getConstraintOfType(source);
|
|
65541
|
+
var constraint = getConstraintOfType(source) || unknownType;
|
|
65508
65542
|
if (!strictNullChecks && (!constraint || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */))) {
|
|
65509
65543
|
// A type variable with no constraint is not related to the non-primitive object type.
|
|
65510
65544
|
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */), 3 /* Both */)) {
|
|
@@ -65513,12 +65547,12 @@ var ts;
|
|
|
65513
65547
|
}
|
|
65514
65548
|
}
|
|
65515
65549
|
// 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
|
|
65516
|
-
else if (
|
|
65550
|
+
else if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
|
|
65517
65551
|
resetErrorInfo(saveErrorInfo);
|
|
65518
65552
|
return result;
|
|
65519
65553
|
}
|
|
65520
65554
|
// slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
|
|
65521
|
-
else if (
|
|
65555
|
+
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
|
|
65522
65556
|
resetErrorInfo(saveErrorInfo);
|
|
65523
65557
|
return result;
|
|
65524
65558
|
}
|
|
@@ -65662,7 +65696,7 @@ var ts;
|
|
|
65662
65696
|
return varianceResult;
|
|
65663
65697
|
}
|
|
65664
65698
|
}
|
|
65665
|
-
else if (isReadonlyArrayType(target) ?
|
|
65699
|
+
else if (isReadonlyArrayType(target) ? isArrayOrTupleType(source) : isArrayType(target) && isTupleType(source) && !source.target.readonly) {
|
|
65666
65700
|
if (relation !== identityRelation) {
|
|
65667
65701
|
return isRelatedTo(getIndexTypeOfType(source, numberType) || anyType, getIndexTypeOfType(target, numberType) || anyType, 3 /* Both */, reportErrors);
|
|
65668
65702
|
}
|
|
@@ -66038,7 +66072,7 @@ var ts;
|
|
|
66038
66072
|
}
|
|
66039
66073
|
var result = -1 /* True */;
|
|
66040
66074
|
if (isTupleType(target)) {
|
|
66041
|
-
if (
|
|
66075
|
+
if (isArrayOrTupleType(source)) {
|
|
66042
66076
|
if (!target.target.readonly && (isReadonlyArrayType(source) || isTupleType(source) && source.target.readonly)) {
|
|
66043
66077
|
return 0 /* False */;
|
|
66044
66078
|
}
|
|
@@ -66999,6 +67033,9 @@ var ts;
|
|
|
66999
67033
|
function isReadonlyArrayType(type) {
|
|
67000
67034
|
return !!(ts.getObjectFlags(type) & 4 /* Reference */) && type.target === globalReadonlyArrayType;
|
|
67001
67035
|
}
|
|
67036
|
+
function isArrayOrTupleType(type) {
|
|
67037
|
+
return isArrayType(type) || isTupleType(type);
|
|
67038
|
+
}
|
|
67002
67039
|
function isMutableArrayOrTuple(type) {
|
|
67003
67040
|
return isArrayType(type) && !isReadonlyArrayType(type) || isTupleType(type) && !type.target.readonly;
|
|
67004
67041
|
}
|
|
@@ -67450,7 +67487,7 @@ var ts;
|
|
|
67450
67487
|
else if (type.flags & 2097152 /* Intersection */) {
|
|
67451
67488
|
result = getIntersectionType(ts.sameMap(type.types, getWidenedType));
|
|
67452
67489
|
}
|
|
67453
|
-
else if (
|
|
67490
|
+
else if (isArrayOrTupleType(type)) {
|
|
67454
67491
|
result = createTypeReference(type.target, ts.sameMap(getTypeArguments(type), getWidenedType));
|
|
67455
67492
|
}
|
|
67456
67493
|
if (result && context === undefined) {
|
|
@@ -67487,7 +67524,7 @@ var ts;
|
|
|
67487
67524
|
}
|
|
67488
67525
|
}
|
|
67489
67526
|
}
|
|
67490
|
-
if (
|
|
67527
|
+
if (isArrayOrTupleType(type)) {
|
|
67491
67528
|
for (var _b = 0, _c = getTypeArguments(type); _b < _c.length; _b++) {
|
|
67492
67529
|
var t = _c[_b];
|
|
67493
67530
|
if (reportWideningErrorsInType(t)) {
|
|
@@ -68548,7 +68585,7 @@ var ts;
|
|
|
68548
68585
|
}
|
|
68549
68586
|
// Infer from the members of source and target only if the two types are possibly related
|
|
68550
68587
|
if (!typesDefinitelyUnrelated(source, target)) {
|
|
68551
|
-
if (
|
|
68588
|
+
if (isArrayOrTupleType(source)) {
|
|
68552
68589
|
if (isTupleType(target)) {
|
|
68553
68590
|
var sourceArity = getTypeReferenceArity(source);
|
|
68554
68591
|
var targetArity = getTypeReferenceArity(target);
|
|
@@ -73427,6 +73464,7 @@ var ts;
|
|
|
73427
73464
|
}
|
|
73428
73465
|
}
|
|
73429
73466
|
else {
|
|
73467
|
+
error(attributeDecl.expression, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types);
|
|
73430
73468
|
typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType;
|
|
73431
73469
|
}
|
|
73432
73470
|
}
|
|
@@ -75664,6 +75702,7 @@ var ts;
|
|
|
75664
75702
|
// decorators are applied to a declaration by the emitter, and not to an expression.
|
|
75665
75703
|
var isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
75666
75704
|
var argCheckMode = !isDecorator && !isSingleNonGenericCandidate && ts.some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
75705
|
+
argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
75667
75706
|
// The following variables are captured and modified by calls to chooseOverload.
|
|
75668
75707
|
// If overload resolution or type argument inference fails, we want to report the
|
|
75669
75708
|
// best error possible. The best error is one which says that an argument was not
|
|
@@ -75879,7 +75918,7 @@ var ts;
|
|
|
75879
75918
|
// If one or more context sensitive arguments were excluded, we start including
|
|
75880
75919
|
// them now (and keeping do so for any subsequent candidates) and perform a second
|
|
75881
75920
|
// round of type inference and applicability checking for this particular candidate.
|
|
75882
|
-
argCheckMode =
|
|
75921
|
+
argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
75883
75922
|
if (inferenceContext) {
|
|
75884
75923
|
var typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
75885
75924
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
|
|
@@ -109961,6 +110000,7 @@ var ts;
|
|
|
109961
110000
|
else {
|
|
109962
110001
|
printer.writeFile(sourceFile, writer, sourceMapGenerator);
|
|
109963
110002
|
}
|
|
110003
|
+
var sourceMapUrlPos;
|
|
109964
110004
|
if (sourceMapGenerator) {
|
|
109965
110005
|
if (sourceMapDataList) {
|
|
109966
110006
|
sourceMapDataList.push({
|
|
@@ -109972,6 +110012,7 @@ var ts;
|
|
|
109972
110012
|
if (sourceMappingURL) {
|
|
109973
110013
|
if (!writer.isAtStartOfLine())
|
|
109974
110014
|
writer.rawWrite(newLine);
|
|
110015
|
+
sourceMapUrlPos = writer.getTextPos();
|
|
109975
110016
|
writer.writeComment("//# " + "sourceMappingURL" + "=" + sourceMappingURL); // Tools can sometimes see this line as a source mapping url comment
|
|
109976
110017
|
}
|
|
109977
110018
|
// Write the source map
|
|
@@ -109984,7 +110025,7 @@ var ts;
|
|
|
109984
110025
|
writer.writeLine();
|
|
109985
110026
|
}
|
|
109986
110027
|
// Write the output file
|
|
109987
|
-
ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles);
|
|
110028
|
+
ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
|
|
109988
110029
|
// Reset state
|
|
109989
110030
|
writer.clear();
|
|
109990
110031
|
}
|
|
@@ -110506,7 +110547,7 @@ var ts;
|
|
|
110506
110547
|
setWriter(/*output*/ undefined, /*_sourceMapGenerator*/ undefined);
|
|
110507
110548
|
}
|
|
110508
110549
|
function getCurrentLineMap() {
|
|
110509
|
-
return currentLineMap || (currentLineMap = ts.getLineStarts(currentSourceFile));
|
|
110550
|
+
return currentLineMap || (currentLineMap = ts.getLineStarts(ts.Debug.checkDefined(currentSourceFile)));
|
|
110510
110551
|
}
|
|
110511
110552
|
function emit(node, parenthesizerRule) {
|
|
110512
110553
|
if (node === undefined)
|
|
@@ -111681,7 +111722,7 @@ var ts;
|
|
|
111681
111722
|
increaseIndent();
|
|
111682
111723
|
}
|
|
111683
111724
|
var preferNewLine = node.multiLine ? 65536 /* PreferNewLine */ : 0 /* None */;
|
|
111684
|
-
var allowTrailingComma = currentSourceFile.languageVersion >= 1 /* ES5 */ && !ts.isJsonSourceFile(currentSourceFile) ? 64 /* AllowTrailingComma */ : 0 /* None */;
|
|
111725
|
+
var allowTrailingComma = currentSourceFile && currentSourceFile.languageVersion >= 1 /* ES5 */ && !ts.isJsonSourceFile(currentSourceFile) ? 64 /* AllowTrailingComma */ : 0 /* None */;
|
|
111685
111726
|
emitList(node, node.properties, 526226 /* ObjectLiteralExpressionProperties */ | allowTrailingComma | preferNewLine);
|
|
111686
111727
|
if (indentedFlag) {
|
|
111687
111728
|
decreaseIndent();
|
|
@@ -112037,7 +112078,7 @@ var ts;
|
|
|
112037
112078
|
emitExpression(node.expression, parenthesizer.parenthesizeExpressionOfExpressionStatement);
|
|
112038
112079
|
// Emit semicolon in non json files
|
|
112039
112080
|
// or if json file that created synthesized expression(eg.define expression statement when --out and amd code generation)
|
|
112040
|
-
if (!ts.isJsonSourceFile(currentSourceFile) || ts.nodeIsSynthesized(node.expression)) {
|
|
112081
|
+
if (!currentSourceFile || !ts.isJsonSourceFile(currentSourceFile) || ts.nodeIsSynthesized(node.expression)) {
|
|
112041
112082
|
writeTrailingSemicolon();
|
|
112042
112083
|
}
|
|
112043
112084
|
}
|
|
@@ -112330,7 +112371,7 @@ var ts;
|
|
|
112330
112371
|
if (body.multiLine) {
|
|
112331
112372
|
return false;
|
|
112332
112373
|
}
|
|
112333
|
-
if (!ts.nodeIsSynthesized(body) && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {
|
|
112374
|
+
if (!ts.nodeIsSynthesized(body) && currentSourceFile && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {
|
|
112334
112375
|
return false;
|
|
112335
112376
|
}
|
|
112336
112377
|
if (getLeadingLineTerminatorCount(body, body.statements, 2 /* PreserveLines */)
|
|
@@ -112355,12 +112396,7 @@ var ts;
|
|
|
112355
112396
|
var emitBlockFunctionBody = shouldEmitBlockFunctionBodyOnSingleLine(body)
|
|
112356
112397
|
? emitBlockFunctionBodyOnSingleLine
|
|
112357
112398
|
: emitBlockFunctionBodyWorker;
|
|
112358
|
-
|
|
112359
|
-
emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody);
|
|
112360
|
-
}
|
|
112361
|
-
else {
|
|
112362
|
-
emitBlockFunctionBody(body);
|
|
112363
|
-
}
|
|
112399
|
+
emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody);
|
|
112364
112400
|
decreaseIndent();
|
|
112365
112401
|
writeToken(19 /* CloseBraceToken */, body.statements.end, writePunctuation, body);
|
|
112366
112402
|
onAfterEmitNode === null || onAfterEmitNode === void 0 ? void 0 : onAfterEmitNode(body);
|
|
@@ -112757,7 +112793,8 @@ var ts;
|
|
|
112757
112793
|
var emitAsSingleStatement = statements.length === 1 &&
|
|
112758
112794
|
(
|
|
112759
112795
|
// treat synthesized nodes as located on the same line for emit purposes
|
|
112760
|
-
|
|
112796
|
+
!currentSourceFile ||
|
|
112797
|
+
ts.nodeIsSynthesized(parentNode) ||
|
|
112761
112798
|
ts.nodeIsSynthesized(statements[0]) ||
|
|
112762
112799
|
ts.rangeStartPositionsAreOnSameLine(parentNode, statements[0], currentSourceFile));
|
|
112763
112800
|
var format = 163969 /* CaseOrDefaultClauseStatements */;
|
|
@@ -112988,16 +113025,14 @@ var ts;
|
|
|
112988
113025
|
function emitSourceFile(node) {
|
|
112989
113026
|
writeLine();
|
|
112990
113027
|
var statements = node.statements;
|
|
112991
|
-
if
|
|
112992
|
-
|
|
112993
|
-
|
|
112994
|
-
|
|
112995
|
-
|
|
112996
|
-
|
|
112997
|
-
|
|
112998
|
-
|
|
112999
|
-
return;
|
|
113000
|
-
}
|
|
113028
|
+
// Emit detached comment if there are no prologue directives or if the first node is synthesized.
|
|
113029
|
+
// The synthesized node will have no leading comment so some comments may be missed.
|
|
113030
|
+
var shouldEmitDetachedComment = statements.length === 0 ||
|
|
113031
|
+
!ts.isPrologueDirective(statements[0]) ||
|
|
113032
|
+
ts.nodeIsSynthesized(statements[0]);
|
|
113033
|
+
if (shouldEmitDetachedComment) {
|
|
113034
|
+
emitBodyWithDetachedComments(node, statements, emitSourceFileWorker);
|
|
113035
|
+
return;
|
|
113001
113036
|
}
|
|
113002
113037
|
emitSourceFileWorker(node);
|
|
113003
113038
|
}
|
|
@@ -113386,7 +113421,7 @@ var ts;
|
|
|
113386
113421
|
}
|
|
113387
113422
|
if (isEmpty) {
|
|
113388
113423
|
// Write a line terminator if the parent node was multi-line
|
|
113389
|
-
if (format & 1 /* MultiLine */ && !(preserveSourceNewlines && (!parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile)))) {
|
|
113424
|
+
if (format & 1 /* MultiLine */ && !(preserveSourceNewlines && (!parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile)))) {
|
|
113390
113425
|
writeLine();
|
|
113391
113426
|
}
|
|
113392
113427
|
else if (format & 256 /* SpaceBetweenBraces */ && !(format & 524288 /* NoSpaceIfEmpty */)) {
|
|
@@ -113647,7 +113682,7 @@ var ts;
|
|
|
113647
113682
|
}
|
|
113648
113683
|
var firstChild_1 = children[0];
|
|
113649
113684
|
if (firstChild_1 === undefined) {
|
|
113650
|
-
return !parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113685
|
+
return !parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113651
113686
|
}
|
|
113652
113687
|
if (firstChild_1.pos === nextListElementPos) {
|
|
113653
113688
|
// If this child starts at the beginning of a list item in a parent list, its leading
|
|
@@ -113671,7 +113706,7 @@ var ts;
|
|
|
113671
113706
|
// JsxText will be written with its leading whitespace, so don't add more manually.
|
|
113672
113707
|
return 0;
|
|
113673
113708
|
}
|
|
113674
|
-
if (parentNode &&
|
|
113709
|
+
if (currentSourceFile && parentNode &&
|
|
113675
113710
|
!ts.positionIsSynthesized(parentNode.pos) &&
|
|
113676
113711
|
!ts.nodeIsSynthesized(firstChild_1) &&
|
|
113677
113712
|
(!firstChild_1.parent || ts.getOriginalNode(firstChild_1.parent) === ts.getOriginalNode(parentNode))) {
|
|
@@ -113695,7 +113730,7 @@ var ts;
|
|
|
113695
113730
|
// JsxText will be written with its leading whitespace, so don't add more manually.
|
|
113696
113731
|
return 0;
|
|
113697
113732
|
}
|
|
113698
|
-
else if (!ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
|
|
113733
|
+
else if (currentSourceFile && !ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
|
|
113699
113734
|
if (preserveSourceNewlines && siblingNodePositionsAreComparable(previousNode, nextNode)) {
|
|
113700
113735
|
return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(previousNode, nextNode, currentSourceFile, includeComments); });
|
|
113701
113736
|
}
|
|
@@ -113727,9 +113762,9 @@ var ts;
|
|
|
113727
113762
|
}
|
|
113728
113763
|
var lastChild = ts.lastOrUndefined(children);
|
|
113729
113764
|
if (lastChild === undefined) {
|
|
113730
|
-
return !parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113765
|
+
return !parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113731
113766
|
}
|
|
113732
|
-
if (parentNode && !ts.positionIsSynthesized(parentNode.pos) && !ts.nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) {
|
|
113767
|
+
if (currentSourceFile && parentNode && !ts.positionIsSynthesized(parentNode.pos) && !ts.nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) {
|
|
113733
113768
|
if (preserveSourceNewlines) {
|
|
113734
113769
|
var end_1 = ts.isNodeArray(children) && !ts.positionIsSynthesized(children.end) ? children.end : lastChild.end;
|
|
113735
113770
|
return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenPositionAndNextNonWhitespaceCharacter(end_1, parentNode.end, currentSourceFile, includeComments); });
|
|
@@ -113802,7 +113837,7 @@ var ts;
|
|
|
113802
113837
|
if (ts.getStartsOnNewLine(node2)) {
|
|
113803
113838
|
return 1;
|
|
113804
113839
|
}
|
|
113805
|
-
if (!ts.nodeIsSynthesized(parent) && !ts.nodeIsSynthesized(node1) && !ts.nodeIsSynthesized(node2)) {
|
|
113840
|
+
if (currentSourceFile && !ts.nodeIsSynthesized(parent) && !ts.nodeIsSynthesized(node1) && !ts.nodeIsSynthesized(node2)) {
|
|
113806
113841
|
if (preserveSourceNewlines) {
|
|
113807
113842
|
return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(node1, node2, currentSourceFile, includeComments); });
|
|
113808
113843
|
}
|
|
@@ -113812,7 +113847,7 @@ var ts;
|
|
|
113812
113847
|
}
|
|
113813
113848
|
function isEmptyBlock(block) {
|
|
113814
113849
|
return block.statements.length === 0
|
|
113815
|
-
&& ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile);
|
|
113850
|
+
&& (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile));
|
|
113816
113851
|
}
|
|
113817
113852
|
function skipSynthesizedParentheses(node) {
|
|
113818
113853
|
while (node.kind === 212 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) {
|
|
@@ -113824,16 +113859,23 @@ var ts;
|
|
|
113824
113859
|
if (ts.isGeneratedIdentifier(node)) {
|
|
113825
113860
|
return generateName(node);
|
|
113826
113861
|
}
|
|
113827
|
-
|
|
113828
|
-
return ts.idText(node);
|
|
113829
|
-
}
|
|
113830
|
-
else if (node.kind === 10 /* StringLiteral */ && node.textSourceNode) {
|
|
113862
|
+
if (ts.isStringLiteral(node) && node.textSourceNode) {
|
|
113831
113863
|
return getTextOfNode(node.textSourceNode, includeTrivia);
|
|
113832
113864
|
}
|
|
113833
|
-
|
|
113834
|
-
|
|
113865
|
+
var sourceFile = currentSourceFile; // const needed for control flow
|
|
113866
|
+
var canUseSourceFile = !!sourceFile && !!node.parent && !ts.nodeIsSynthesized(node);
|
|
113867
|
+
if (ts.isMemberName(node)) {
|
|
113868
|
+
if (!canUseSourceFile || ts.getSourceFileOfNode(node) !== ts.getOriginalNode(sourceFile)) {
|
|
113869
|
+
return ts.idText(node);
|
|
113870
|
+
}
|
|
113871
|
+
}
|
|
113872
|
+
else {
|
|
113873
|
+
ts.Debug.assertNode(node, ts.isLiteralExpression); // not strictly necessary
|
|
113874
|
+
if (!canUseSourceFile) {
|
|
113875
|
+
return node.text;
|
|
113876
|
+
}
|
|
113835
113877
|
}
|
|
113836
|
-
return ts.getSourceTextOfNodeFromSourceFile(
|
|
113878
|
+
return ts.getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia);
|
|
113837
113879
|
}
|
|
113838
113880
|
function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) {
|
|
113839
113881
|
if (node.kind === 10 /* StringLiteral */ && node.textSourceNode) {
|
|
@@ -114412,7 +114454,7 @@ var ts;
|
|
|
114412
114454
|
return true;
|
|
114413
114455
|
}
|
|
114414
114456
|
function emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {
|
|
114415
|
-
if (!shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114457
|
+
if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114416
114458
|
return;
|
|
114417
114459
|
if (!hasWrittenComment) {
|
|
114418
114460
|
ts.emitNewLineBeforeLeadingCommentOfPosition(getCurrentLineMap(), writer, rangePos, commentPos);
|
|
@@ -114439,7 +114481,7 @@ var ts;
|
|
|
114439
114481
|
forEachTrailingCommentToEmit(pos, emitTrailingComment);
|
|
114440
114482
|
}
|
|
114441
114483
|
function emitTrailingComment(commentPos, commentEnd, _kind, hasTrailingNewLine) {
|
|
114442
|
-
if (!shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114484
|
+
if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114443
114485
|
return;
|
|
114444
114486
|
// trailing comments are emitted at space/*trailing comment1 */space/*trailing comment2*/
|
|
114445
114487
|
if (!writer.isAtStartOfLine()) {
|
|
@@ -114461,6 +114503,8 @@ var ts;
|
|
|
114461
114503
|
exitComment();
|
|
114462
114504
|
}
|
|
114463
114505
|
function emitTrailingCommentOfPositionNoNewline(commentPos, commentEnd, kind) {
|
|
114506
|
+
if (!currentSourceFile)
|
|
114507
|
+
return;
|
|
114464
114508
|
// trailing comments of a position are emitted at /*trailing comment1 */space/*trailing comment*/space
|
|
114465
114509
|
emitPos(commentPos);
|
|
114466
114510
|
ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
|
|
@@ -114470,6 +114514,8 @@ var ts;
|
|
|
114470
114514
|
}
|
|
114471
114515
|
}
|
|
114472
114516
|
function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) {
|
|
114517
|
+
if (!currentSourceFile)
|
|
114518
|
+
return;
|
|
114473
114519
|
// trailing comments of a position are emitted at /*trailing comment1 */space/*trailing comment*/space
|
|
114474
114520
|
emitPos(commentPos);
|
|
114475
114521
|
ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
|
|
@@ -114502,6 +114548,8 @@ var ts;
|
|
|
114502
114548
|
return detachedCommentsInfo !== undefined && ts.last(detachedCommentsInfo).nodePos === pos;
|
|
114503
114549
|
}
|
|
114504
114550
|
function forEachLeadingCommentWithoutDetachedComments(cb) {
|
|
114551
|
+
if (!currentSourceFile)
|
|
114552
|
+
return;
|
|
114505
114553
|
// get the leading comments from detachedPos
|
|
114506
114554
|
var pos = ts.last(detachedCommentsInfo).detachedCommentEndPos;
|
|
114507
114555
|
if (detachedCommentsInfo.length - 1) {
|
|
@@ -114513,7 +114561,7 @@ var ts;
|
|
|
114513
114561
|
ts.forEachLeadingCommentRange(currentSourceFile.text, pos, cb, /*state*/ pos);
|
|
114514
114562
|
}
|
|
114515
114563
|
function emitDetachedCommentsAndUpdateCommentsInfo(range) {
|
|
114516
|
-
var currentDetachedCommentInfo = ts.emitDetachedComments(currentSourceFile.text, getCurrentLineMap(), writer, emitComment, range, newLine, commentsDisabled);
|
|
114564
|
+
var currentDetachedCommentInfo = currentSourceFile && ts.emitDetachedComments(currentSourceFile.text, getCurrentLineMap(), writer, emitComment, range, newLine, commentsDisabled);
|
|
114517
114565
|
if (currentDetachedCommentInfo) {
|
|
114518
114566
|
if (detachedCommentsInfo) {
|
|
114519
114567
|
detachedCommentsInfo.push(currentDetachedCommentInfo);
|
|
@@ -114524,7 +114572,7 @@ var ts;
|
|
|
114524
114572
|
}
|
|
114525
114573
|
}
|
|
114526
114574
|
function emitComment(text, lineMap, writer, commentPos, commentEnd, newLine) {
|
|
114527
|
-
if (!shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114575
|
+
if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114528
114576
|
return;
|
|
114529
114577
|
emitPos(commentPos);
|
|
114530
114578
|
ts.writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine);
|
|
@@ -114536,7 +114584,7 @@ var ts;
|
|
|
114536
114584
|
* @return true if the comment is a triple-slash comment else false
|
|
114537
114585
|
*/
|
|
114538
114586
|
function isTripleSlashComment(commentPos, commentEnd) {
|
|
114539
|
-
return ts.isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd);
|
|
114587
|
+
return !!currentSourceFile && ts.isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd);
|
|
114540
114588
|
}
|
|
114541
114589
|
// Source Maps
|
|
114542
114590
|
function getParsedSourceMap(node) {
|
|
@@ -115451,7 +115499,11 @@ var ts;
|
|
|
115451
115499
|
return newValue;
|
|
115452
115500
|
};
|
|
115453
115501
|
if (originalWriteFile) {
|
|
115454
|
-
host.writeFile = function (fileName, data
|
|
115502
|
+
host.writeFile = function (fileName, data) {
|
|
115503
|
+
var rest = [];
|
|
115504
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
115505
|
+
rest[_i - 2] = arguments[_i];
|
|
115506
|
+
}
|
|
115455
115507
|
var key = toPath(fileName);
|
|
115456
115508
|
fileExistsCache.delete(key);
|
|
115457
115509
|
var value = readFileCache.get(key);
|
|
@@ -115465,7 +115517,7 @@ var ts;
|
|
|
115465
115517
|
sourceFileCache.delete(key);
|
|
115466
115518
|
}
|
|
115467
115519
|
}
|
|
115468
|
-
originalWriteFile.call(host, fileName, data,
|
|
115520
|
+
originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false));
|
|
115469
115521
|
};
|
|
115470
115522
|
}
|
|
115471
115523
|
// directoryExists
|
|
@@ -116398,6 +116450,7 @@ var ts;
|
|
|
116398
116450
|
useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
|
|
116399
116451
|
getFileIncludeReasons: function () { return fileReasons; },
|
|
116400
116452
|
structureIsReused: structureIsReused,
|
|
116453
|
+
writeFile: writeFile,
|
|
116401
116454
|
};
|
|
116402
116455
|
onProgramCreateComplete();
|
|
116403
116456
|
// Add file processingDiagnostics
|
|
@@ -116895,7 +116948,7 @@ var ts;
|
|
|
116895
116948
|
getProjectReferenceRedirect: getProjectReferenceRedirect,
|
|
116896
116949
|
isSourceOfProjectReferenceRedirect: isSourceOfProjectReferenceRedirect,
|
|
116897
116950
|
getSymlinkCache: getSymlinkCache,
|
|
116898
|
-
writeFile: writeFileCallback ||
|
|
116951
|
+
writeFile: writeFileCallback || writeFile,
|
|
116899
116952
|
isEmitBlocked: isEmitBlocked,
|
|
116900
116953
|
readFile: function (f) { return host.readFile(f); },
|
|
116901
116954
|
fileExists: function (f) {
|
|
@@ -116915,6 +116968,9 @@ var ts;
|
|
|
116915
116968
|
getFileIncludeReasons: program.getFileIncludeReasons,
|
|
116916
116969
|
};
|
|
116917
116970
|
}
|
|
116971
|
+
function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
|
|
116972
|
+
host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
116973
|
+
}
|
|
116918
116974
|
function emitBuildInfo(writeFileCallback) {
|
|
116919
116975
|
ts.Debug.assert(!ts.outFile(options));
|
|
116920
116976
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* Emit */, "emitBuildInfo", {}, /*separateBeginAndEnd*/ true);
|
|
@@ -119357,6 +119413,7 @@ var ts;
|
|
|
119357
119413
|
}
|
|
119358
119414
|
}
|
|
119359
119415
|
}
|
|
119416
|
+
BuilderState.updateExportedModules = updateExportedModules;
|
|
119360
119417
|
/**
|
|
119361
119418
|
* Updates the exported modules from cache into state's exported modules map
|
|
119362
119419
|
* This should be called whenever it is safe to commit the state of the builder
|
|
@@ -119780,6 +119837,18 @@ var ts;
|
|
|
119780
119837
|
}
|
|
119781
119838
|
return undefined;
|
|
119782
119839
|
}
|
|
119840
|
+
function removeDiagnosticsOfLibraryFiles(state) {
|
|
119841
|
+
if (!state.cleanedDiagnosticsOfLibFiles) {
|
|
119842
|
+
state.cleanedDiagnosticsOfLibFiles = true;
|
|
119843
|
+
var program_1 = ts.Debug.checkDefined(state.program);
|
|
119844
|
+
var options_2 = program_1.getCompilerOptions();
|
|
119845
|
+
ts.forEach(program_1.getSourceFiles(), function (f) {
|
|
119846
|
+
return program_1.isSourceFileDefaultLibrary(f) &&
|
|
119847
|
+
!ts.skipTypeChecking(f, options_2, program_1) &&
|
|
119848
|
+
removeSemanticDiagnosticsOf(state, f.resolvedPath);
|
|
119849
|
+
});
|
|
119850
|
+
}
|
|
119851
|
+
}
|
|
119783
119852
|
/**
|
|
119784
119853
|
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
|
|
119785
119854
|
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
|
|
@@ -119789,28 +119858,17 @@ var ts;
|
|
|
119789
119858
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
119790
119859
|
// If affected files is everything except default library, then nothing more to do
|
|
119791
119860
|
if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
|
|
119792
|
-
|
|
119793
|
-
state.cleanedDiagnosticsOfLibFiles = true;
|
|
119794
|
-
var program_1 = ts.Debug.checkDefined(state.program);
|
|
119795
|
-
var options_2 = program_1.getCompilerOptions();
|
|
119796
|
-
ts.forEach(program_1.getSourceFiles(), function (f) {
|
|
119797
|
-
return program_1.isSourceFileDefaultLibrary(f) &&
|
|
119798
|
-
!ts.skipTypeChecking(f, options_2, program_1) &&
|
|
119799
|
-
removeSemanticDiagnosticsOf(state, f.resolvedPath);
|
|
119800
|
-
});
|
|
119801
|
-
}
|
|
119861
|
+
removeDiagnosticsOfLibraryFiles(state);
|
|
119802
119862
|
// When a change affects the global scope, all files are considered to be affected without updating their signature
|
|
119803
119863
|
// That means when affected file is handled, its signature can be out of date
|
|
119804
119864
|
// To avoid this, ensure that we update the signature for any affected file in this scenario.
|
|
119805
119865
|
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
|
|
119806
119866
|
return;
|
|
119807
119867
|
}
|
|
119808
|
-
|
|
119809
|
-
|
|
119810
|
-
|
|
119811
|
-
|
|
119812
|
-
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host); });
|
|
119813
|
-
}
|
|
119868
|
+
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);
|
|
119869
|
+
if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
|
|
119870
|
+
return;
|
|
119871
|
+
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
|
|
119814
119872
|
}
|
|
119815
119873
|
/**
|
|
119816
119874
|
* Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
|
|
@@ -119852,16 +119910,41 @@ var ts;
|
|
|
119852
119910
|
var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
|
|
119853
119911
|
return newSignature !== oldSignature;
|
|
119854
119912
|
}
|
|
119913
|
+
function forEachKeyOfExportedModulesMap(state, filePath, fn) {
|
|
119914
|
+
// Go through exported modules from cache first
|
|
119915
|
+
var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
|
|
119916
|
+
var result = keys && ts.forEachKey(keys, fn);
|
|
119917
|
+
if (result)
|
|
119918
|
+
return result;
|
|
119919
|
+
// If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
|
|
119920
|
+
keys = state.exportedModulesMap.getKeys(filePath);
|
|
119921
|
+
return keys && ts.forEachKey(keys, function (exportedFromPath) {
|
|
119922
|
+
var _a;
|
|
119923
|
+
// If the cache had an updated value, skip
|
|
119924
|
+
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
119925
|
+
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
|
|
119926
|
+
fn(exportedFromPath) :
|
|
119927
|
+
undefined;
|
|
119928
|
+
});
|
|
119929
|
+
}
|
|
119930
|
+
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
|
|
119931
|
+
var _a;
|
|
119932
|
+
if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
|
|
119933
|
+
return false;
|
|
119934
|
+
// Every file needs to be handled
|
|
119935
|
+
ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, /*firstSourceFile*/ undefined)
|
|
119936
|
+
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, host); });
|
|
119937
|
+
removeDiagnosticsOfLibraryFiles(state);
|
|
119938
|
+
return true;
|
|
119939
|
+
}
|
|
119855
119940
|
/**
|
|
119856
|
-
* Iterate on referencing modules that export entities from affected file
|
|
119941
|
+
* Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
|
|
119857
119942
|
*/
|
|
119858
|
-
function
|
|
119859
|
-
var _a, _b;
|
|
119943
|
+
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
|
|
119860
119944
|
// If there was change in signature (dts output) for the changed file,
|
|
119861
119945
|
// then only we need to handle pending file emit
|
|
119862
|
-
if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
|
|
119946
|
+
if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
|
|
119863
119947
|
return;
|
|
119864
|
-
}
|
|
119865
119948
|
if (!isChangedSignature(state, affectedFile.resolvedPath))
|
|
119866
119949
|
return;
|
|
119867
119950
|
// Since isolated modules dont change js files, files affected by change in signature is itself
|
|
@@ -119874,7 +119957,9 @@ var ts;
|
|
|
119874
119957
|
var currentPath = queue.pop();
|
|
119875
119958
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
119876
119959
|
seenFileNamesMap.set(currentPath, true);
|
|
119877
|
-
|
|
119960
|
+
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, host))
|
|
119961
|
+
return;
|
|
119962
|
+
handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, host);
|
|
119878
119963
|
if (isChangedSignature(state, currentPath)) {
|
|
119879
119964
|
var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
|
|
119880
119965
|
queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
@@ -119886,56 +119971,38 @@ var ts;
|
|
|
119886
119971
|
var seenFileAndExportsOfFile = new ts.Set();
|
|
119887
119972
|
// Go through exported modules from cache first
|
|
119888
119973
|
// If exported modules has path, all files referencing file exported from are affected
|
|
119889
|
-
(
|
|
119890
|
-
|
|
119891
|
-
|
|
119892
|
-
|
|
119893
|
-
|
|
119894
|
-
|
|
119895
|
-
|
|
119896
|
-
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
119897
|
-
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) &&
|
|
119898
|
-
forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
|
|
119974
|
+
forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
|
|
119975
|
+
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
|
|
119976
|
+
return true;
|
|
119977
|
+
var references = state.referencedMap.getKeys(exportedFromPath);
|
|
119978
|
+
return references && ts.forEachKey(references, function (filePath) {
|
|
119979
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
|
|
119980
|
+
});
|
|
119899
119981
|
});
|
|
119900
119982
|
}
|
|
119901
119983
|
/**
|
|
119902
|
-
*
|
|
119984
|
+
* handle dts and semantic diagnostics on file and iterate on anything that exports this file
|
|
119985
|
+
* return true when all work is done and we can exit handling dts emit and semantic diagnostics
|
|
119903
119986
|
*/
|
|
119904
|
-
function
|
|
119987
|
+
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
|
|
119905
119988
|
var _a;
|
|
119906
|
-
|
|
119907
|
-
return
|
|
119908
|
-
|
|
119909
|
-
|
|
119910
|
-
|
|
119911
|
-
* fn on file and iterate on anything that exports this file
|
|
119912
|
-
*/
|
|
119913
|
-
function forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn) {
|
|
119914
|
-
var _a, _b, _c;
|
|
119915
|
-
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath)) {
|
|
119916
|
-
return;
|
|
119917
|
-
}
|
|
119918
|
-
fn(state, filePath);
|
|
119989
|
+
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
|
|
119990
|
+
return undefined;
|
|
119991
|
+
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
|
|
119992
|
+
return true;
|
|
119993
|
+
handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
|
|
119919
119994
|
ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
|
|
119920
|
-
// Go through exported modules from cache first
|
|
119921
119995
|
// If exported modules has path, all files referencing file exported from are affected
|
|
119922
|
-
(
|
|
119923
|
-
return
|
|
119924
|
-
});
|
|
119925
|
-
// If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
|
|
119926
|
-
(_b = state.exportedModulesMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (exportedFromPath) {
|
|
119927
|
-
var _a;
|
|
119928
|
-
// If the cache had an updated value, skip
|
|
119929
|
-
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
119930
|
-
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) &&
|
|
119931
|
-
forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
|
|
119996
|
+
forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
|
|
119997
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
|
|
119932
119998
|
});
|
|
119933
119999
|
// Remove diagnostics of files that import this file (without going to exports of referencing files)
|
|
119934
|
-
(
|
|
120000
|
+
(_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
|
|
119935
120001
|
return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
|
|
119936
|
-
|
|
119937
|
-
|
|
119938
|
-
);
|
|
120002
|
+
handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
|
|
120003
|
+
state, referencingFilePath, cancellationToken, computeHash, host);
|
|
120004
|
+
});
|
|
120005
|
+
return undefined;
|
|
119939
120006
|
}
|
|
119940
120007
|
/**
|
|
119941
120008
|
* This is called after completing operation on the next affected file.
|
|
@@ -120311,7 +120378,43 @@ var ts;
|
|
|
120311
120378
|
return toAffectedFileEmitResult(state,
|
|
120312
120379
|
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
|
|
120313
120380
|
// Otherwise just affected file
|
|
120314
|
-
ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected,
|
|
120381
|
+
ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
|
|
120382
|
+
getWriteFileUpdatingSignatureCallback(writeFile) :
|
|
120383
|
+
writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
|
|
120384
|
+
}
|
|
120385
|
+
function getWriteFileUpdatingSignatureCallback(writeFile) {
|
|
120386
|
+
return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
|
|
120387
|
+
var _a;
|
|
120388
|
+
if (ts.isDeclarationFileName(fileName)) {
|
|
120389
|
+
ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
|
|
120390
|
+
var file = sourceFiles[0];
|
|
120391
|
+
var info = state.fileInfos.get(file.resolvedPath);
|
|
120392
|
+
var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
|
|
120393
|
+
if (signature === file.version) {
|
|
120394
|
+
var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
|
|
120395
|
+
if (newSignature !== file.version) { // Update it
|
|
120396
|
+
if (host.storeFilesChangingSignatureDuringEmit)
|
|
120397
|
+
(state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
|
|
120398
|
+
if (state.exportedModulesMap)
|
|
120399
|
+
ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
|
|
120400
|
+
if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
|
|
120401
|
+
state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
|
|
120402
|
+
}
|
|
120403
|
+
else {
|
|
120404
|
+
info.signature = newSignature;
|
|
120405
|
+
if (state.exportedModulesMap)
|
|
120406
|
+
ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
|
|
120407
|
+
}
|
|
120408
|
+
}
|
|
120409
|
+
}
|
|
120410
|
+
}
|
|
120411
|
+
if (writeFile)
|
|
120412
|
+
writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
120413
|
+
else if (host.writeFile)
|
|
120414
|
+
host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
120415
|
+
else
|
|
120416
|
+
state.program.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
120417
|
+
};
|
|
120315
120418
|
}
|
|
120316
120419
|
/**
|
|
120317
120420
|
* Emits the JavaScript and declaration files.
|
|
@@ -120368,7 +120471,9 @@ var ts;
|
|
|
120368
120471
|
}
|
|
120369
120472
|
}
|
|
120370
120473
|
}
|
|
120371
|
-
return ts.Debug.checkDefined(state.program).emit(targetSourceFile,
|
|
120474
|
+
return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
|
|
120475
|
+
getWriteFileUpdatingSignatureCallback(writeFile) :
|
|
120476
|
+
writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
|
|
120372
120477
|
}
|
|
120373
120478
|
/**
|
|
120374
120479
|
* Return the semantic diagnostics for the next affected file or undefined if iteration is complete
|
|
@@ -122560,6 +122665,7 @@ var ts;
|
|
|
122560
122665
|
createHash: ts.maybeBind(host, host.createHash),
|
|
122561
122666
|
readDirectory: ts.maybeBind(host, host.readDirectory),
|
|
122562
122667
|
disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
|
|
122668
|
+
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
|
|
122563
122669
|
};
|
|
122564
122670
|
function writeFile(fileName, text, writeByteOrderMark, onError) {
|
|
122565
122671
|
try {
|
|
@@ -122619,6 +122725,7 @@ var ts;
|
|
|
122619
122725
|
createHash: ts.maybeBind(system, system.createHash),
|
|
122620
122726
|
createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
|
|
122621
122727
|
disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
|
|
122728
|
+
storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
|
|
122622
122729
|
};
|
|
122623
122730
|
}
|
|
122624
122731
|
ts.createProgramHost = createProgramHost;
|
|
@@ -122707,6 +122814,7 @@ var ts;
|
|
|
122707
122814
|
var host = ts.createCompilerHostWorker(options, /*setParentNodes*/ undefined, system);
|
|
122708
122815
|
host.createHash = ts.maybeBind(system, system.createHash);
|
|
122709
122816
|
host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
|
|
122817
|
+
host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
|
|
122710
122818
|
ts.setGetSourceFileAsHashVersioned(host, system);
|
|
122711
122819
|
ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
|
|
122712
122820
|
return host;
|
|
@@ -131039,7 +131147,7 @@ var ts;
|
|
|
131039
131147
|
GlobalsSearch[GlobalsSearch["Success"] = 1] = "Success";
|
|
131040
131148
|
GlobalsSearch[GlobalsSearch["Fail"] = 2] = "Fail";
|
|
131041
131149
|
})(GlobalsSearch || (GlobalsSearch = {}));
|
|
131042
|
-
function resolvingModuleSpecifiers(logPrefix, host, program, sourceFile, preferences, isForImportStatementCompletion, cb) {
|
|
131150
|
+
function resolvingModuleSpecifiers(logPrefix, host, program, sourceFile, position, preferences, isForImportStatementCompletion, isValidTypeOnlyUseSite, cb) {
|
|
131043
131151
|
var _a, _b, _c;
|
|
131044
131152
|
var start = ts.timestamp();
|
|
131045
131153
|
var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
@@ -131054,9 +131162,9 @@ var ts;
|
|
|
131054
131162
|
(_b = host.log) === null || _b === void 0 ? void 0 : _b.call(host, logPrefix + ": response is " + (resolutionLimitExceeded ? "incomplete" : "complete"));
|
|
131055
131163
|
(_c = host.log) === null || _c === void 0 ? void 0 : _c.call(host, logPrefix + ": " + (ts.timestamp() - start));
|
|
131056
131164
|
return result;
|
|
131057
|
-
function tryResolve(exportInfo, isFromAmbientModule) {
|
|
131165
|
+
function tryResolve(exportInfo, symbolName, isFromAmbientModule) {
|
|
131058
131166
|
if (isFromAmbientModule) {
|
|
131059
|
-
var result_1 = ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, sourceFile, program, host, preferences);
|
|
131167
|
+
var result_1 = ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, symbolName, position, isValidTypeOnlyUseSite, sourceFile, program, host, preferences);
|
|
131060
131168
|
if (result_1) {
|
|
131061
131169
|
ambientCount++;
|
|
131062
131170
|
}
|
|
@@ -131065,7 +131173,7 @@ var ts;
|
|
|
131065
131173
|
var shouldResolveModuleSpecifier = isForImportStatementCompletion || preferences.allowIncompleteCompletions && resolvedCount < Completions.moduleSpecifierResolutionLimit;
|
|
131066
131174
|
var shouldGetModuleSpecifierFromCache = !shouldResolveModuleSpecifier && preferences.allowIncompleteCompletions && cacheAttemptCount < Completions.moduleSpecifierResolutionCacheAttemptLimit;
|
|
131067
131175
|
var result = (shouldResolveModuleSpecifier || shouldGetModuleSpecifierFromCache)
|
|
131068
|
-
? ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, sourceFile, program, host, preferences, packageJsonImportFilter, shouldGetModuleSpecifierFromCache)
|
|
131176
|
+
? ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, symbolName, position, isValidTypeOnlyUseSite, sourceFile, program, host, preferences, packageJsonImportFilter, shouldGetModuleSpecifierFromCache)
|
|
131069
131177
|
: undefined;
|
|
131070
131178
|
if (!shouldResolveModuleSpecifier && !shouldGetModuleSpecifierFromCache || shouldGetModuleSpecifierFromCache && !result) {
|
|
131071
131179
|
resolutionLimitExceeded = true;
|
|
@@ -131170,8 +131278,8 @@ var ts;
|
|
|
131170
131278
|
return undefined;
|
|
131171
131279
|
var lowerCaseTokenText = location.text.toLowerCase();
|
|
131172
131280
|
var exportMap = ts.getExportInfoMap(file, host, program, cancellationToken);
|
|
131173
|
-
var newEntries = resolvingModuleSpecifiers("continuePreviousIncompleteResponse", host, program, file, preferences,
|
|
131174
|
-
/*isForImportStatementCompletion*/ false, function (context) {
|
|
131281
|
+
var newEntries = resolvingModuleSpecifiers("continuePreviousIncompleteResponse", host, program, file, location.getStart(), preferences,
|
|
131282
|
+
/*isForImportStatementCompletion*/ false, ts.isValidTypeOnlyAliasUseSite(location), function (context) {
|
|
131175
131283
|
var entries = ts.mapDefined(previousResponse.entries, function (entry) {
|
|
131176
131284
|
if (!entry.hasAction || !entry.source || !entry.data || completionEntryDataIsResolved(entry.data)) {
|
|
131177
131285
|
// Not an auto import or already resolved; keep as is
|
|
@@ -131183,7 +131291,7 @@ var ts;
|
|
|
131183
131291
|
}
|
|
131184
131292
|
var origin = ts.Debug.checkDefined(getAutoImportSymbolFromCompletionEntryData(entry.name, entry.data, program, host)).origin;
|
|
131185
131293
|
var info = exportMap.get(file.path, entry.data.exportMapKey);
|
|
131186
|
-
var result = info && context.tryResolve(info, !ts.isExternalModuleNameRelative(ts.stripQuotes(origin.moduleSymbol.name)));
|
|
131294
|
+
var result = info && context.tryResolve(info, entry.name, !ts.isExternalModuleNameRelative(ts.stripQuotes(origin.moduleSymbol.name)));
|
|
131187
131295
|
if (!result)
|
|
131188
131296
|
return entry;
|
|
131189
131297
|
var newOrigin = __assign(__assign({}, origin), { kind: 32 /* ResolvedExport */, moduleSpecifier: result.moduleSpecifier });
|
|
@@ -131775,22 +131883,44 @@ var ts;
|
|
|
131775
131883
|
}
|
|
131776
131884
|
}
|
|
131777
131885
|
function createSnippetPrinter(printerOptions) {
|
|
131886
|
+
var escapes;
|
|
131778
131887
|
var baseWriter = ts.textChanges.createWriter(ts.getNewLineCharacter(printerOptions));
|
|
131779
131888
|
var printer = ts.createPrinter(printerOptions, baseWriter);
|
|
131780
|
-
var writer = __assign(__assign({}, baseWriter), { write: function (s) { return baseWriter.write(
|
|
131889
|
+
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); }); } });
|
|
131781
131890
|
return {
|
|
131782
131891
|
printSnippetList: printSnippetList,
|
|
131783
131892
|
printAndFormatSnippetList: printAndFormatSnippetList,
|
|
131784
131893
|
};
|
|
131894
|
+
// The formatter/scanner will have issues with snippet-escaped text,
|
|
131895
|
+
// so instead of writing the escaped text directly to the writer,
|
|
131896
|
+
// generate a set of changes that can be applied to the unescaped text
|
|
131897
|
+
// to escape it post-formatting.
|
|
131898
|
+
function escapingWrite(s, write) {
|
|
131899
|
+
var escaped = ts.escapeSnippetText(s);
|
|
131900
|
+
if (escaped !== s) {
|
|
131901
|
+
var start = baseWriter.getTextPos();
|
|
131902
|
+
write();
|
|
131903
|
+
var end = baseWriter.getTextPos();
|
|
131904
|
+
escapes = ts.append(escapes || (escapes = []), { newText: escaped, span: { start: start, length: end - start } });
|
|
131905
|
+
}
|
|
131906
|
+
else {
|
|
131907
|
+
write();
|
|
131908
|
+
}
|
|
131909
|
+
}
|
|
131785
131910
|
/* Snippet-escaping version of `printer.printList`. */
|
|
131786
131911
|
function printSnippetList(format, list, sourceFile) {
|
|
131912
|
+
var unescaped = printUnescapedSnippetList(format, list, sourceFile);
|
|
131913
|
+
return escapes ? ts.textChanges.applyChanges(unescaped, escapes) : unescaped;
|
|
131914
|
+
}
|
|
131915
|
+
function printUnescapedSnippetList(format, list, sourceFile) {
|
|
131916
|
+
escapes = undefined;
|
|
131787
131917
|
writer.clear();
|
|
131788
131918
|
printer.writeList(format, list, sourceFile, writer);
|
|
131789
131919
|
return writer.getText();
|
|
131790
131920
|
}
|
|
131791
131921
|
function printAndFormatSnippetList(format, list, sourceFile, formatContext) {
|
|
131792
131922
|
var syntheticFile = {
|
|
131793
|
-
text:
|
|
131923
|
+
text: printUnescapedSnippetList(format, list, sourceFile),
|
|
131794
131924
|
getLineAndCharacterOfPosition: function (pos) {
|
|
131795
131925
|
return ts.getLineAndCharacterOfPosition(this, pos);
|
|
131796
131926
|
},
|
|
@@ -131802,7 +131932,10 @@ var ts;
|
|
|
131802
131932
|
/* indentation */ 0,
|
|
131803
131933
|
/* delta */ 0, __assign(__assign({}, formatContext), { options: formatOptions }));
|
|
131804
131934
|
});
|
|
131805
|
-
|
|
131935
|
+
var allChanges = escapes
|
|
131936
|
+
? ts.stableSort(ts.concatenate(changes, escapes), function (a, b) { return ts.compareTextSpans(a.span, b.span); })
|
|
131937
|
+
: changes;
|
|
131938
|
+
return ts.textChanges.applyChanges(syntheticFile.text, allChanges);
|
|
131806
131939
|
}
|
|
131807
131940
|
}
|
|
131808
131941
|
function originToCompletionEntryData(origin) {
|
|
@@ -132694,7 +132827,7 @@ var ts;
|
|
|
132694
132827
|
moduleSymbol: moduleSymbol,
|
|
132695
132828
|
symbol: firstAccessibleSymbol,
|
|
132696
132829
|
targetFlags: ts.skipAlias(firstAccessibleSymbol, typeChecker).flags,
|
|
132697
|
-
}], sourceFile, program, host, preferences) || {}).moduleSpecifier;
|
|
132830
|
+
}], firstAccessibleSymbol.name, position, ts.isValidTypeOnlyAliasUseSite(location), sourceFile, program, host, preferences) || {}).moduleSpecifier;
|
|
132698
132831
|
if (moduleSpecifier) {
|
|
132699
132832
|
var origin = {
|
|
132700
132833
|
kind: getNullableSymbolOriginInfoKind(6 /* SymbolMemberExport */),
|
|
@@ -132949,7 +133082,7 @@ var ts;
|
|
|
132949
133082
|
var exportInfo = ts.getExportInfoMap(sourceFile, host, program, cancellationToken);
|
|
132950
133083
|
var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host);
|
|
132951
133084
|
var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
132952
|
-
resolvingModuleSpecifiers("collectAutoImports", host, program, sourceFile, preferences, !!importCompletionNode, function (context) {
|
|
133085
|
+
resolvingModuleSpecifiers("collectAutoImports", host, program, sourceFile, position, preferences, !!importCompletionNode, ts.isValidTypeOnlyAliasUseSite(location), function (context) {
|
|
132953
133086
|
exportInfo.search(sourceFile.path,
|
|
132954
133087
|
/*preferCapitalized*/ isRightOfOpenTag, function (symbolName, targetFlags) {
|
|
132955
133088
|
if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings())))
|
|
@@ -132977,7 +133110,7 @@ var ts;
|
|
|
132977
133110
|
}
|
|
132978
133111
|
// If we don't need to resolve module specifiers, we can use any re-export that is importable at all
|
|
132979
133112
|
// (We need to ensure that at least one is importable to show a completion.)
|
|
132980
|
-
var _a = context.tryResolve(info, isFromAmbientModule) || {}, _b = _a.exportInfo, exportInfo = _b === void 0 ? defaultExportInfo : _b, moduleSpecifier = _a.moduleSpecifier;
|
|
133113
|
+
var _a = context.tryResolve(info, symbolName, isFromAmbientModule) || {}, _b = _a.exportInfo, exportInfo = _b === void 0 ? defaultExportInfo : _b, moduleSpecifier = _a.moduleSpecifier;
|
|
132981
133114
|
var isDefaultExport = exportInfo.exportKind === 1 /* Default */;
|
|
132982
133115
|
var symbol = isDefaultExport && ts.getLocalSymbolForExportDefault(exportInfo.symbol) || exportInfo.symbol;
|
|
132983
133116
|
pushAutoImportSymbol(symbol, {
|
|
@@ -151801,7 +151934,7 @@ var ts;
|
|
|
151801
151934
|
var symbol = checker.getMergedSymbol(ts.skipAlias(exportedSymbol, checker));
|
|
151802
151935
|
var exportInfo = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, /*isJsxTagName*/ false, host, program, preferences, useAutoImportProvider);
|
|
151803
151936
|
var useRequire = shouldUseRequire(sourceFile, program);
|
|
151804
|
-
var fix = getImportFixForSymbol(sourceFile, exportInfo, moduleSymbol,
|
|
151937
|
+
var fix = getImportFixForSymbol(sourceFile, exportInfo, moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences);
|
|
151805
151938
|
if (fix) {
|
|
151806
151939
|
addImport({ fixes: [fix], symbolName: symbolName, errorIdentifierText: undefined });
|
|
151807
151940
|
}
|
|
@@ -151971,7 +152104,7 @@ var ts;
|
|
|
151971
152104
|
: getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, isJsxTagName, host, program, preferences, /*useAutoImportProvider*/ true);
|
|
151972
152105
|
var useRequire = shouldUseRequire(sourceFile, program);
|
|
151973
152106
|
var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position));
|
|
151974
|
-
var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol,
|
|
152107
|
+
var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, { symbolName: symbolName, position: position }, isValidTypeOnlyUseSite, useRequire, host, preferences));
|
|
151975
152108
|
return {
|
|
151976
152109
|
moduleSpecifier: fix.moduleSpecifier,
|
|
151977
152110
|
codeAction: codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix,
|
|
@@ -151987,10 +152120,10 @@ var ts;
|
|
|
151987
152120
|
return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, includeSymbolNameInDescription, 1 /* Double */, compilerOptions));
|
|
151988
152121
|
}
|
|
151989
152122
|
codefix.getPromoteTypeOnlyCompletionAction = getPromoteTypeOnlyCompletionAction;
|
|
151990
|
-
function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol,
|
|
152123
|
+
function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, useNamespaceInfo, isValidTypeOnlyUseSite, useRequire, host, preferences) {
|
|
151991
152124
|
ts.Debug.assert(exportInfos.some(function (info) { return info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol; }), "Some exportInfo should match the specified moduleSymbol");
|
|
151992
152125
|
var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
151993
|
-
return getBestFix(getImportFixes(exportInfos,
|
|
152126
|
+
return getBestFix(getImportFixes(exportInfos, useNamespaceInfo, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes, sourceFile, program, packageJsonImportFilter, host);
|
|
151994
152127
|
}
|
|
151995
152128
|
function codeFixActionToCodeAction(_a) {
|
|
151996
152129
|
var description = _a.description, changes = _a.changes, commands = _a.commands;
|
|
@@ -152045,25 +152178,32 @@ var ts;
|
|
|
152045
152178
|
return !moduleFile || ts.isImportableFile(program, importingFile, moduleFile, preferences, /*packageJsonFilter*/ undefined, getModuleSpecifierResolutionHost(isFromPackageJson), (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host));
|
|
152046
152179
|
}
|
|
152047
152180
|
}
|
|
152048
|
-
function getModuleSpecifierForBestExportInfo(exportInfo, importingFile, program, host, preferences, packageJsonImportFilter, fromCacheOnly) {
|
|
152049
|
-
var _a =
|
|
152050
|
-
/*
|
|
152051
|
-
/*isValidTypeOnlyUseSite*/ false,
|
|
152052
|
-
/*useRequire*/ false, exportInfo, host, preferences, fromCacheOnly), fixes = _a.fixes, computedWithoutCacheCount = _a.computedWithoutCacheCount;
|
|
152181
|
+
function getModuleSpecifierForBestExportInfo(exportInfo, symbolName, position, isValidTypeOnlyUseSite, importingFile, program, host, preferences, packageJsonImportFilter, fromCacheOnly) {
|
|
152182
|
+
var _a = getImportFixes(exportInfo, { symbolName: symbolName, position: position }, isValidTypeOnlyUseSite,
|
|
152183
|
+
/*useRequire*/ false, program, importingFile, host, preferences, fromCacheOnly), fixes = _a.fixes, computedWithoutCacheCount = _a.computedWithoutCacheCount;
|
|
152053
152184
|
var result = getBestFix(fixes, importingFile, program, packageJsonImportFilter || ts.createPackageJsonImportFilter(importingFile, preferences, host), host);
|
|
152054
152185
|
return result && __assign(__assign({}, result), { computedWithoutCacheCount: computedWithoutCacheCount });
|
|
152055
152186
|
}
|
|
152056
152187
|
codefix.getModuleSpecifierForBestExportInfo = getModuleSpecifierForBestExportInfo;
|
|
152057
|
-
function getImportFixes(exportInfos,
|
|
152188
|
+
function getImportFixes(exportInfos, useNamespaceInfo,
|
|
152058
152189
|
/** undefined only for missing JSX namespace */
|
|
152059
|
-
|
|
152190
|
+
isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, fromCacheOnly) {
|
|
152060
152191
|
var checker = program.getTypeChecker();
|
|
152061
152192
|
var existingImports = ts.flatMap(exportInfos, function (info) { return getExistingImportDeclarations(info, checker, sourceFile, program.getCompilerOptions()); });
|
|
152062
|
-
var useNamespace =
|
|
152193
|
+
var useNamespace = useNamespaceInfo && tryUseExistingNamespaceImport(existingImports, useNamespaceInfo.symbolName, useNamespaceInfo.position, checker);
|
|
152063
152194
|
var addToExisting = tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, program.getCompilerOptions());
|
|
152064
|
-
|
|
152065
|
-
|
|
152066
|
-
|
|
152195
|
+
if (addToExisting) {
|
|
152196
|
+
// Don't bother providing an action to add a new import if we can add to an existing one.
|
|
152197
|
+
return {
|
|
152198
|
+
computedWithoutCacheCount: 0,
|
|
152199
|
+
fixes: __spreadArray(__spreadArray([], (useNamespace ? [useNamespace] : ts.emptyArray), true), [addToExisting], false),
|
|
152200
|
+
};
|
|
152201
|
+
}
|
|
152202
|
+
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;
|
|
152203
|
+
return {
|
|
152204
|
+
computedWithoutCacheCount: computedWithoutCacheCount,
|
|
152205
|
+
fixes: __spreadArray(__spreadArray([], (useNamespace ? [useNamespace] : ts.emptyArray), true), fixes, true),
|
|
152206
|
+
};
|
|
152067
152207
|
}
|
|
152068
152208
|
function tryUseExistingNamespaceImport(existingImports, symbolName, position, checker) {
|
|
152069
152209
|
// It is possible that multiple import statements with the same specifier exist in the file.
|
|
@@ -152253,9 +152393,9 @@ var ts;
|
|
|
152253
152393
|
});
|
|
152254
152394
|
return { computedWithoutCacheCount: computedWithoutCacheCount, fixes: fixes };
|
|
152255
152395
|
}
|
|
152256
|
-
function getFixesForAddImport(exportInfos, existingImports, program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
|
|
152396
|
+
function getFixesForAddImport(exportInfos, existingImports, program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, host, preferences, fromCacheOnly) {
|
|
152257
152397
|
var existingDeclaration = ts.firstDefined(existingImports, function (info) { return newImportInfoFromExistingSpecifier(info, isValidTypeOnlyUseSite, useRequire, program.getTypeChecker(), program.getCompilerOptions()); });
|
|
152258
|
-
return existingDeclaration ? [existingDeclaration] : getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfos, host, preferences)
|
|
152398
|
+
return existingDeclaration ? { fixes: [existingDeclaration] } : getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfos, host, preferences, fromCacheOnly);
|
|
152259
152399
|
}
|
|
152260
152400
|
function newImportInfoFromExistingSpecifier(_a, isValidTypeOnlyUseSite, useRequire, checker, compilerOptions) {
|
|
152261
152401
|
var _b;
|
|
@@ -152351,7 +152491,8 @@ var ts;
|
|
|
152351
152491
|
var symbolName = umdSymbol.name;
|
|
152352
152492
|
var exportInfo = [{ symbol: umdSymbol, moduleSymbol: symbol, moduleFileName: undefined, exportKind: 3 /* UMD */, targetFlags: symbol.flags, isFromPackageJson: false }];
|
|
152353
152493
|
var useRequire = shouldUseRequire(sourceFile, program);
|
|
152354
|
-
var
|
|
152494
|
+
var position = ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined;
|
|
152495
|
+
var fixes = getImportFixes(exportInfo, position ? { position: position, symbolName: symbolName } : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences).fixes;
|
|
152355
152496
|
return { fixes: fixes, symbolName: symbolName, errorIdentifierText: (_b = ts.tryCast(token, ts.isIdentifier)) === null || _b === void 0 ? void 0 : _b.text };
|
|
152356
152497
|
}
|
|
152357
152498
|
function getUmdSymbol(token, checker) {
|
|
@@ -152423,7 +152564,7 @@ var ts;
|
|
|
152423
152564
|
var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences);
|
|
152424
152565
|
var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) {
|
|
152425
152566
|
var _ = _a[0], exportInfos = _a[1];
|
|
152426
|
-
return getImportFixes(exportInfos, symbolName, symbolToken.getStart(sourceFile), isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences);
|
|
152567
|
+
return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes;
|
|
152427
152568
|
}));
|
|
152428
152569
|
return { fixes: fixes, symbolName: symbolName, errorIdentifierText: symbolToken.text };
|
|
152429
152570
|
}
|