typescript 4.7.0-dev.20220420 → 4.7.0-dev.20220423

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/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-dev.20220420";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220423";
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, data, writeByteOrderMark, sourceFiles) {
18491
- host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) {
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) {
@@ -73626,6 +73626,7 @@ var ts;
73626
73626
  }
73627
73627
  }
73628
73628
  else {
73629
+ error(attributeDecl.expression, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types);
73629
73630
  typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType;
73630
73631
  }
73631
73632
  }
@@ -75863,6 +75864,7 @@ var ts;
75863
75864
  // decorators are applied to a declaration by the emitter, and not to an expression.
75864
75865
  var isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
75865
75866
  var argCheckMode = !isDecorator && !isSingleNonGenericCandidate && ts.some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
75867
+ argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
75866
75868
  // The following variables are captured and modified by calls to chooseOverload.
75867
75869
  // If overload resolution or type argument inference fails, we want to report the
75868
75870
  // best error possible. The best error is one which says that an argument was not
@@ -76078,7 +76080,7 @@ var ts;
76078
76080
  // If one or more context sensitive arguments were excluded, we start including
76079
76081
  // them now (and keeping do so for any subsequent candidates) and perform a second
76080
76082
  // round of type inference and applicability checking for this particular candidate.
76081
- argCheckMode = 0 /* Normal */;
76083
+ argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
76082
76084
  if (inferenceContext) {
76083
76085
  var typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
76084
76086
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
@@ -94890,7 +94892,7 @@ var ts;
94890
94892
  }
94891
94893
  resumeLexicalEnvironment();
94892
94894
  var needsSyntheticConstructor = !constructor && isDerivedClass;
94893
- var indexOfFirstStatementAfterSuper = 0;
94895
+ var indexOfFirstStatementAfterSuperAndPrologue = 0;
94894
94896
  var prologueStatementCount = 0;
94895
94897
  var superStatementIndex = -1;
94896
94898
  var statements = [];
@@ -94899,8 +94901,11 @@ var ts;
94899
94901
  superStatementIndex = ts.findSuperStatementIndex(constructor.body.statements, prologueStatementCount);
94900
94902
  // If there was a super call, visit existing statements up to and including it
94901
94903
  if (superStatementIndex >= 0) {
94902
- indexOfFirstStatementAfterSuper = superStatementIndex + 1;
94903
- statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, prologueStatementCount, indexOfFirstStatementAfterSuper - prologueStatementCount), true), statements.slice(prologueStatementCount), true);
94904
+ indexOfFirstStatementAfterSuperAndPrologue = superStatementIndex + 1;
94905
+ statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, prologueStatementCount, indexOfFirstStatementAfterSuperAndPrologue - prologueStatementCount), true), statements.slice(prologueStatementCount), true);
94906
+ }
94907
+ else if (prologueStatementCount >= 0) {
94908
+ indexOfFirstStatementAfterSuperAndPrologue = prologueStatementCount;
94904
94909
  }
94905
94910
  }
94906
94911
  if (needsSyntheticConstructor) {
@@ -94936,22 +94941,20 @@ var ts;
94936
94941
  }
94937
94942
  }
94938
94943
  if (parameterPropertyDeclarationCount > 0) {
94939
- var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatementAfterSuper, parameterPropertyDeclarationCount);
94944
+ var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue, parameterPropertyDeclarationCount);
94940
94945
  // If there was a super() call found, add parameter properties immediately after it
94941
94946
  if (superStatementIndex >= 0) {
94942
94947
  ts.addRange(statements, parameterProperties);
94943
94948
  }
94944
- // If a synthetic super() call was added, add them just after it
94945
- else if (needsSyntheticConstructor) {
94946
- statements = __spreadArray(__spreadArray([
94947
- statements[0]
94948
- ], parameterProperties, true), statements.slice(1), true);
94949
- }
94950
- // Since there wasn't a super() call, add them to the top of the constructor
94951
94949
  else {
94952
- statements = __spreadArray(__spreadArray([], parameterProperties, true), statements, true);
94950
+ // Add add parameter properties to the top of the constructor after the prologue
94951
+ var superAndPrologueStatementCount = prologueStatementCount;
94952
+ // If a synthetic super() call was added, need to account for that
94953
+ if (needsSyntheticConstructor)
94954
+ superAndPrologueStatementCount++;
94955
+ statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, superAndPrologueStatementCount), true), parameterProperties, true), statements.slice(superAndPrologueStatementCount), true);
94953
94956
  }
94954
- indexOfFirstStatementAfterSuper += parameterPropertyDeclarationCount;
94957
+ indexOfFirstStatementAfterSuperAndPrologue += parameterPropertyDeclarationCount;
94955
94958
  }
94956
94959
  }
94957
94960
  }
@@ -94961,7 +94964,7 @@ var ts;
94961
94964
  addPropertyOrClassStaticBlockStatements(statements, properties, receiver);
94962
94965
  // Add existing statements after the initial prologues and super call
94963
94966
  if (constructor) {
94964
- ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuper + prologueStatementCount));
94967
+ ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue));
94965
94968
  }
94966
94969
  statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
94967
94970
  return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements),
@@ -110159,6 +110162,7 @@ var ts;
110159
110162
  else {
110160
110163
  printer.writeFile(sourceFile, writer, sourceMapGenerator);
110161
110164
  }
110165
+ var sourceMapUrlPos;
110162
110166
  if (sourceMapGenerator) {
110163
110167
  if (sourceMapDataList) {
110164
110168
  sourceMapDataList.push({
@@ -110170,6 +110174,7 @@ var ts;
110170
110174
  if (sourceMappingURL) {
110171
110175
  if (!writer.isAtStartOfLine())
110172
110176
  writer.rawWrite(newLine);
110177
+ sourceMapUrlPos = writer.getTextPos();
110173
110178
  writer.writeComment("//# " + "sourceMappingURL" + "=" + sourceMappingURL); // Tools can sometimes see this line as a source mapping url comment
110174
110179
  }
110175
110180
  // Write the source map
@@ -110182,7 +110187,7 @@ var ts;
110182
110187
  writer.writeLine();
110183
110188
  }
110184
110189
  // Write the output file
110185
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles);
110190
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110186
110191
  // Reset state
110187
110192
  writer.clear();
110188
110193
  }
@@ -110704,7 +110709,7 @@ var ts;
110704
110709
  setWriter(/*output*/ undefined, /*_sourceMapGenerator*/ undefined);
110705
110710
  }
110706
110711
  function getCurrentLineMap() {
110707
- return currentLineMap || (currentLineMap = ts.getLineStarts(currentSourceFile));
110712
+ return currentLineMap || (currentLineMap = ts.getLineStarts(ts.Debug.checkDefined(currentSourceFile)));
110708
110713
  }
110709
110714
  function emit(node, parenthesizerRule) {
110710
110715
  if (node === undefined)
@@ -111879,7 +111884,7 @@ var ts;
111879
111884
  increaseIndent();
111880
111885
  }
111881
111886
  var preferNewLine = node.multiLine ? 65536 /* PreferNewLine */ : 0 /* None */;
111882
- var allowTrailingComma = currentSourceFile.languageVersion >= 1 /* ES5 */ && !ts.isJsonSourceFile(currentSourceFile) ? 64 /* AllowTrailingComma */ : 0 /* None */;
111887
+ var allowTrailingComma = currentSourceFile && currentSourceFile.languageVersion >= 1 /* ES5 */ && !ts.isJsonSourceFile(currentSourceFile) ? 64 /* AllowTrailingComma */ : 0 /* None */;
111883
111888
  emitList(node, node.properties, 526226 /* ObjectLiteralExpressionProperties */ | allowTrailingComma | preferNewLine);
111884
111889
  if (indentedFlag) {
111885
111890
  decreaseIndent();
@@ -112235,7 +112240,7 @@ var ts;
112235
112240
  emitExpression(node.expression, parenthesizer.parenthesizeExpressionOfExpressionStatement);
112236
112241
  // Emit semicolon in non json files
112237
112242
  // or if json file that created synthesized expression(eg.define expression statement when --out and amd code generation)
112238
- if (!ts.isJsonSourceFile(currentSourceFile) || ts.nodeIsSynthesized(node.expression)) {
112243
+ if (!currentSourceFile || !ts.isJsonSourceFile(currentSourceFile) || ts.nodeIsSynthesized(node.expression)) {
112239
112244
  writeTrailingSemicolon();
112240
112245
  }
112241
112246
  }
@@ -112528,7 +112533,7 @@ var ts;
112528
112533
  if (body.multiLine) {
112529
112534
  return false;
112530
112535
  }
112531
- if (!ts.nodeIsSynthesized(body) && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {
112536
+ if (!ts.nodeIsSynthesized(body) && currentSourceFile && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {
112532
112537
  return false;
112533
112538
  }
112534
112539
  if (getLeadingLineTerminatorCount(body, body.statements, 2 /* PreserveLines */)
@@ -112553,12 +112558,7 @@ var ts;
112553
112558
  var emitBlockFunctionBody = shouldEmitBlockFunctionBodyOnSingleLine(body)
112554
112559
  ? emitBlockFunctionBodyOnSingleLine
112555
112560
  : emitBlockFunctionBodyWorker;
112556
- if (emitBodyWithDetachedComments) {
112557
- emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody);
112558
- }
112559
- else {
112560
- emitBlockFunctionBody(body);
112561
- }
112561
+ emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody);
112562
112562
  decreaseIndent();
112563
112563
  writeToken(19 /* CloseBraceToken */, body.statements.end, writePunctuation, body);
112564
112564
  onAfterEmitNode === null || onAfterEmitNode === void 0 ? void 0 : onAfterEmitNode(body);
@@ -112955,7 +112955,8 @@ var ts;
112955
112955
  var emitAsSingleStatement = statements.length === 1 &&
112956
112956
  (
112957
112957
  // treat synthesized nodes as located on the same line for emit purposes
112958
- ts.nodeIsSynthesized(parentNode) ||
112958
+ !currentSourceFile ||
112959
+ ts.nodeIsSynthesized(parentNode) ||
112959
112960
  ts.nodeIsSynthesized(statements[0]) ||
112960
112961
  ts.rangeStartPositionsAreOnSameLine(parentNode, statements[0], currentSourceFile));
112961
112962
  var format = 163969 /* CaseOrDefaultClauseStatements */;
@@ -113186,16 +113187,14 @@ var ts;
113186
113187
  function emitSourceFile(node) {
113187
113188
  writeLine();
113188
113189
  var statements = node.statements;
113189
- if (emitBodyWithDetachedComments) {
113190
- // Emit detached comment if there are no prologue directives or if the first node is synthesized.
113191
- // The synthesized node will have no leading comment so some comments may be missed.
113192
- var shouldEmitDetachedComment = statements.length === 0 ||
113193
- !ts.isPrologueDirective(statements[0]) ||
113194
- ts.nodeIsSynthesized(statements[0]);
113195
- if (shouldEmitDetachedComment) {
113196
- emitBodyWithDetachedComments(node, statements, emitSourceFileWorker);
113197
- return;
113198
- }
113190
+ // Emit detached comment if there are no prologue directives or if the first node is synthesized.
113191
+ // The synthesized node will have no leading comment so some comments may be missed.
113192
+ var shouldEmitDetachedComment = statements.length === 0 ||
113193
+ !ts.isPrologueDirective(statements[0]) ||
113194
+ ts.nodeIsSynthesized(statements[0]);
113195
+ if (shouldEmitDetachedComment) {
113196
+ emitBodyWithDetachedComments(node, statements, emitSourceFileWorker);
113197
+ return;
113199
113198
  }
113200
113199
  emitSourceFileWorker(node);
113201
113200
  }
@@ -113584,7 +113583,7 @@ var ts;
113584
113583
  }
113585
113584
  if (isEmpty) {
113586
113585
  // Write a line terminator if the parent node was multi-line
113587
- if (format & 1 /* MultiLine */ && !(preserveSourceNewlines && (!parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile)))) {
113586
+ if (format & 1 /* MultiLine */ && !(preserveSourceNewlines && (!parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile)))) {
113588
113587
  writeLine();
113589
113588
  }
113590
113589
  else if (format & 256 /* SpaceBetweenBraces */ && !(format & 524288 /* NoSpaceIfEmpty */)) {
@@ -113845,7 +113844,7 @@ var ts;
113845
113844
  }
113846
113845
  var firstChild_1 = children[0];
113847
113846
  if (firstChild_1 === undefined) {
113848
- return !parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
113847
+ return !parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
113849
113848
  }
113850
113849
  if (firstChild_1.pos === nextListElementPos) {
113851
113850
  // If this child starts at the beginning of a list item in a parent list, its leading
@@ -113869,7 +113868,7 @@ var ts;
113869
113868
  // JsxText will be written with its leading whitespace, so don't add more manually.
113870
113869
  return 0;
113871
113870
  }
113872
- if (parentNode &&
113871
+ if (currentSourceFile && parentNode &&
113873
113872
  !ts.positionIsSynthesized(parentNode.pos) &&
113874
113873
  !ts.nodeIsSynthesized(firstChild_1) &&
113875
113874
  (!firstChild_1.parent || ts.getOriginalNode(firstChild_1.parent) === ts.getOriginalNode(parentNode))) {
@@ -113893,7 +113892,7 @@ var ts;
113893
113892
  // JsxText will be written with its leading whitespace, so don't add more manually.
113894
113893
  return 0;
113895
113894
  }
113896
- else if (!ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
113895
+ else if (currentSourceFile && !ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
113897
113896
  if (preserveSourceNewlines && siblingNodePositionsAreComparable(previousNode, nextNode)) {
113898
113897
  return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(previousNode, nextNode, currentSourceFile, includeComments); });
113899
113898
  }
@@ -113925,9 +113924,9 @@ var ts;
113925
113924
  }
113926
113925
  var lastChild = ts.lastOrUndefined(children);
113927
113926
  if (lastChild === undefined) {
113928
- return !parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
113927
+ return !parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
113929
113928
  }
113930
- if (parentNode && !ts.positionIsSynthesized(parentNode.pos) && !ts.nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) {
113929
+ if (currentSourceFile && parentNode && !ts.positionIsSynthesized(parentNode.pos) && !ts.nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) {
113931
113930
  if (preserveSourceNewlines) {
113932
113931
  var end_1 = ts.isNodeArray(children) && !ts.positionIsSynthesized(children.end) ? children.end : lastChild.end;
113933
113932
  return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenPositionAndNextNonWhitespaceCharacter(end_1, parentNode.end, currentSourceFile, includeComments); });
@@ -114000,7 +113999,7 @@ var ts;
114000
113999
  if (ts.getStartsOnNewLine(node2)) {
114001
114000
  return 1;
114002
114001
  }
114003
- if (!ts.nodeIsSynthesized(parent) && !ts.nodeIsSynthesized(node1) && !ts.nodeIsSynthesized(node2)) {
114002
+ if (currentSourceFile && !ts.nodeIsSynthesized(parent) && !ts.nodeIsSynthesized(node1) && !ts.nodeIsSynthesized(node2)) {
114004
114003
  if (preserveSourceNewlines) {
114005
114004
  return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(node1, node2, currentSourceFile, includeComments); });
114006
114005
  }
@@ -114010,7 +114009,7 @@ var ts;
114010
114009
  }
114011
114010
  function isEmptyBlock(block) {
114012
114011
  return block.statements.length === 0
114013
- && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile);
114012
+ && (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile));
114014
114013
  }
114015
114014
  function skipSynthesizedParentheses(node) {
114016
114015
  while (node.kind === 212 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) {
@@ -114022,16 +114021,23 @@ var ts;
114022
114021
  if (ts.isGeneratedIdentifier(node)) {
114023
114022
  return generateName(node);
114024
114023
  }
114025
- else if ((ts.isIdentifier(node) || ts.isPrivateIdentifier(node)) && (ts.nodeIsSynthesized(node) || !node.parent || !currentSourceFile || (node.parent && currentSourceFile && ts.getSourceFileOfNode(node) !== ts.getOriginalNode(currentSourceFile)))) {
114026
- return ts.idText(node);
114027
- }
114028
- else if (node.kind === 10 /* StringLiteral */ && node.textSourceNode) {
114024
+ if (ts.isStringLiteral(node) && node.textSourceNode) {
114029
114025
  return getTextOfNode(node.textSourceNode, includeTrivia);
114030
114026
  }
114031
- else if (ts.isLiteralExpression(node) && (ts.nodeIsSynthesized(node) || !node.parent)) {
114032
- return node.text;
114027
+ var sourceFile = currentSourceFile; // const needed for control flow
114028
+ var canUseSourceFile = !!sourceFile && !!node.parent && !ts.nodeIsSynthesized(node);
114029
+ if (ts.isMemberName(node)) {
114030
+ if (!canUseSourceFile || ts.getSourceFileOfNode(node) !== ts.getOriginalNode(sourceFile)) {
114031
+ return ts.idText(node);
114032
+ }
114033
+ }
114034
+ else {
114035
+ ts.Debug.assertNode(node, ts.isLiteralExpression); // not strictly necessary
114036
+ if (!canUseSourceFile) {
114037
+ return node.text;
114038
+ }
114033
114039
  }
114034
- return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node, includeTrivia);
114040
+ return ts.getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia);
114035
114041
  }
114036
114042
  function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) {
114037
114043
  if (node.kind === 10 /* StringLiteral */ && node.textSourceNode) {
@@ -114610,7 +114616,7 @@ var ts;
114610
114616
  return true;
114611
114617
  }
114612
114618
  function emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {
114613
- if (!shouldWriteComment(currentSourceFile.text, commentPos))
114619
+ if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
114614
114620
  return;
114615
114621
  if (!hasWrittenComment) {
114616
114622
  ts.emitNewLineBeforeLeadingCommentOfPosition(getCurrentLineMap(), writer, rangePos, commentPos);
@@ -114637,7 +114643,7 @@ var ts;
114637
114643
  forEachTrailingCommentToEmit(pos, emitTrailingComment);
114638
114644
  }
114639
114645
  function emitTrailingComment(commentPos, commentEnd, _kind, hasTrailingNewLine) {
114640
- if (!shouldWriteComment(currentSourceFile.text, commentPos))
114646
+ if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
114641
114647
  return;
114642
114648
  // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment2*/
114643
114649
  if (!writer.isAtStartOfLine()) {
@@ -114659,6 +114665,8 @@ var ts;
114659
114665
  exitComment();
114660
114666
  }
114661
114667
  function emitTrailingCommentOfPositionNoNewline(commentPos, commentEnd, kind) {
114668
+ if (!currentSourceFile)
114669
+ return;
114662
114670
  // trailing comments of a position are emitted at /*trailing comment1 */space/*trailing comment*/space
114663
114671
  emitPos(commentPos);
114664
114672
  ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
@@ -114668,6 +114676,8 @@ var ts;
114668
114676
  }
114669
114677
  }
114670
114678
  function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) {
114679
+ if (!currentSourceFile)
114680
+ return;
114671
114681
  // trailing comments of a position are emitted at /*trailing comment1 */space/*trailing comment*/space
114672
114682
  emitPos(commentPos);
114673
114683
  ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
@@ -114700,6 +114710,8 @@ var ts;
114700
114710
  return detachedCommentsInfo !== undefined && ts.last(detachedCommentsInfo).nodePos === pos;
114701
114711
  }
114702
114712
  function forEachLeadingCommentWithoutDetachedComments(cb) {
114713
+ if (!currentSourceFile)
114714
+ return;
114703
114715
  // get the leading comments from detachedPos
114704
114716
  var pos = ts.last(detachedCommentsInfo).detachedCommentEndPos;
114705
114717
  if (detachedCommentsInfo.length - 1) {
@@ -114711,7 +114723,7 @@ var ts;
114711
114723
  ts.forEachLeadingCommentRange(currentSourceFile.text, pos, cb, /*state*/ pos);
114712
114724
  }
114713
114725
  function emitDetachedCommentsAndUpdateCommentsInfo(range) {
114714
- var currentDetachedCommentInfo = ts.emitDetachedComments(currentSourceFile.text, getCurrentLineMap(), writer, emitComment, range, newLine, commentsDisabled);
114726
+ var currentDetachedCommentInfo = currentSourceFile && ts.emitDetachedComments(currentSourceFile.text, getCurrentLineMap(), writer, emitComment, range, newLine, commentsDisabled);
114715
114727
  if (currentDetachedCommentInfo) {
114716
114728
  if (detachedCommentsInfo) {
114717
114729
  detachedCommentsInfo.push(currentDetachedCommentInfo);
@@ -114722,7 +114734,7 @@ var ts;
114722
114734
  }
114723
114735
  }
114724
114736
  function emitComment(text, lineMap, writer, commentPos, commentEnd, newLine) {
114725
- if (!shouldWriteComment(currentSourceFile.text, commentPos))
114737
+ if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
114726
114738
  return;
114727
114739
  emitPos(commentPos);
114728
114740
  ts.writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine);
@@ -114734,7 +114746,7 @@ var ts;
114734
114746
  * @return true if the comment is a triple-slash comment else false
114735
114747
  */
114736
114748
  function isTripleSlashComment(commentPos, commentEnd) {
114737
- return ts.isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd);
114749
+ return !!currentSourceFile && ts.isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd);
114738
114750
  }
114739
114751
  // Source Maps
114740
114752
  function getParsedSourceMap(node) {
@@ -115649,7 +115661,11 @@ var ts;
115649
115661
  return newValue;
115650
115662
  };
115651
115663
  if (originalWriteFile) {
115652
- host.writeFile = function (fileName, data, writeByteOrderMark, onError, sourceFiles) {
115664
+ host.writeFile = function (fileName, data) {
115665
+ var rest = [];
115666
+ for (var _i = 2; _i < arguments.length; _i++) {
115667
+ rest[_i - 2] = arguments[_i];
115668
+ }
115653
115669
  var key = toPath(fileName);
115654
115670
  fileExistsCache.delete(key);
115655
115671
  var value = readFileCache.get(key);
@@ -115663,7 +115679,7 @@ var ts;
115663
115679
  sourceFileCache.delete(key);
115664
115680
  }
115665
115681
  }
115666
- originalWriteFile.call(host, fileName, data, writeByteOrderMark, onError, sourceFiles);
115682
+ originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false));
115667
115683
  };
115668
115684
  }
115669
115685
  // directoryExists
@@ -116596,6 +116612,7 @@ var ts;
116596
116612
  useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
116597
116613
  getFileIncludeReasons: function () { return fileReasons; },
116598
116614
  structureIsReused: structureIsReused,
116615
+ writeFile: writeFile,
116599
116616
  };
116600
116617
  onProgramCreateComplete();
116601
116618
  // Add file processingDiagnostics
@@ -117093,7 +117110,7 @@ var ts;
117093
117110
  getProjectReferenceRedirect: getProjectReferenceRedirect,
117094
117111
  isSourceOfProjectReferenceRedirect: isSourceOfProjectReferenceRedirect,
117095
117112
  getSymlinkCache: getSymlinkCache,
117096
- writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }),
117113
+ writeFile: writeFileCallback || writeFile,
117097
117114
  isEmitBlocked: isEmitBlocked,
117098
117115
  readFile: function (f) { return host.readFile(f); },
117099
117116
  fileExists: function (f) {
@@ -117113,6 +117130,9 @@ var ts;
117113
117130
  getFileIncludeReasons: program.getFileIncludeReasons,
117114
117131
  };
117115
117132
  }
117133
+ function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
117134
+ host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
117135
+ }
117116
117136
  function emitBuildInfo(writeFileCallback) {
117117
117137
  ts.Debug.assert(!ts.outFile(options));
117118
117138
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* Emit */, "emitBuildInfo", {}, /*separateBeginAndEnd*/ true);
@@ -119555,6 +119575,7 @@ var ts;
119555
119575
  }
119556
119576
  }
119557
119577
  }
119578
+ BuilderState.updateExportedModules = updateExportedModules;
119558
119579
  /**
119559
119580
  * Updates the exported modules from cache into state's exported modules map
119560
119581
  * This should be called whenever it is safe to commit the state of the builder
@@ -119978,6 +119999,18 @@ var ts;
119978
119999
  }
119979
120000
  return undefined;
119980
120001
  }
120002
+ function removeDiagnosticsOfLibraryFiles(state) {
120003
+ if (!state.cleanedDiagnosticsOfLibFiles) {
120004
+ state.cleanedDiagnosticsOfLibFiles = true;
120005
+ var program_1 = ts.Debug.checkDefined(state.program);
120006
+ var options_2 = program_1.getCompilerOptions();
120007
+ ts.forEach(program_1.getSourceFiles(), function (f) {
120008
+ return program_1.isSourceFileDefaultLibrary(f) &&
120009
+ !ts.skipTypeChecking(f, options_2, program_1) &&
120010
+ removeSemanticDiagnosticsOf(state, f.resolvedPath);
120011
+ });
120012
+ }
120013
+ }
119981
120014
  /**
119982
120015
  * Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
119983
120016
  * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
@@ -119987,28 +120020,17 @@ var ts;
119987
120020
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
119988
120021
  // If affected files is everything except default library, then nothing more to do
119989
120022
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
119990
- if (!state.cleanedDiagnosticsOfLibFiles) {
119991
- state.cleanedDiagnosticsOfLibFiles = true;
119992
- var program_1 = ts.Debug.checkDefined(state.program);
119993
- var options_2 = program_1.getCompilerOptions();
119994
- ts.forEach(program_1.getSourceFiles(), function (f) {
119995
- return program_1.isSourceFileDefaultLibrary(f) &&
119996
- !ts.skipTypeChecking(f, options_2, program_1) &&
119997
- removeSemanticDiagnosticsOf(state, f.resolvedPath);
119998
- });
119999
- }
120023
+ removeDiagnosticsOfLibraryFiles(state);
120000
120024
  // When a change affects the global scope, all files are considered to be affected without updating their signature
120001
120025
  // That means when affected file is handled, its signature can be out of date
120002
120026
  // To avoid this, ensure that we update the signature for any affected file in this scenario.
120003
120027
  ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
120004
120028
  return;
120005
120029
  }
120006
- else {
120007
- 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);
120008
- }
120009
- if (!state.compilerOptions.assumeChangesOnlyAffectDirectDependencies) {
120010
- forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host); });
120011
- }
120030
+ 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);
120031
+ if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
120032
+ return;
120033
+ handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
120012
120034
  }
120013
120035
  /**
120014
120036
  * Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
@@ -120050,16 +120072,41 @@ var ts;
120050
120072
  var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120051
120073
  return newSignature !== oldSignature;
120052
120074
  }
120075
+ function forEachKeyOfExportedModulesMap(state, filePath, fn) {
120076
+ // Go through exported modules from cache first
120077
+ var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
120078
+ var result = keys && ts.forEachKey(keys, fn);
120079
+ if (result)
120080
+ return result;
120081
+ // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
120082
+ keys = state.exportedModulesMap.getKeys(filePath);
120083
+ return keys && ts.forEachKey(keys, function (exportedFromPath) {
120084
+ var _a;
120085
+ // If the cache had an updated value, skip
120086
+ return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
120087
+ !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
120088
+ fn(exportedFromPath) :
120089
+ undefined;
120090
+ });
120091
+ }
120092
+ function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
120093
+ var _a;
120094
+ if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
120095
+ return false;
120096
+ // Every file needs to be handled
120097
+ ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, /*firstSourceFile*/ undefined)
120098
+ .forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, host); });
120099
+ removeDiagnosticsOfLibraryFiles(state);
120100
+ return true;
120101
+ }
120053
120102
  /**
120054
- * Iterate on referencing modules that export entities from affected file
120103
+ * Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
120055
120104
  */
120056
- function forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, fn) {
120057
- var _a, _b;
120105
+ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120058
120106
  // If there was change in signature (dts output) for the changed file,
120059
120107
  // then only we need to handle pending file emit
120060
- if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath)) {
120108
+ if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
120061
120109
  return;
120062
- }
120063
120110
  if (!isChangedSignature(state, affectedFile.resolvedPath))
120064
120111
  return;
120065
120112
  // Since isolated modules dont change js files, files affected by change in signature is itself
@@ -120072,7 +120119,9 @@ var ts;
120072
120119
  var currentPath = queue.pop();
120073
120120
  if (!seenFileNamesMap.has(currentPath)) {
120074
120121
  seenFileNamesMap.set(currentPath, true);
120075
- fn(state, currentPath);
120122
+ if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, host))
120123
+ return;
120124
+ handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, host);
120076
120125
  if (isChangedSignature(state, currentPath)) {
120077
120126
  var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
120078
120127
  queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
@@ -120084,56 +120133,38 @@ var ts;
120084
120133
  var seenFileAndExportsOfFile = new ts.Set();
120085
120134
  // Go through exported modules from cache first
120086
120135
  // If exported modules has path, all files referencing file exported from are affected
120087
- (_a = state.currentAffectedFilesExportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120088
- return forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
120089
- });
120090
- // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
120091
- (_b = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.forEach(function (exportedFromPath) {
120092
- var _a;
120093
- // If the cache had an updated value, skip
120094
- return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
120095
- !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) &&
120096
- forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
120136
+ forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
120137
+ if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
120138
+ return true;
120139
+ var references = state.referencedMap.getKeys(exportedFromPath);
120140
+ return references && ts.forEachKey(references, function (filePath) {
120141
+ return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
120142
+ });
120097
120143
  });
120098
120144
  }
120099
120145
  /**
120100
- * Iterate on files referencing referencedPath
120146
+ * handle dts and semantic diagnostics on file and iterate on anything that exports this file
120147
+ * return true when all work is done and we can exit handling dts emit and semantic diagnostics
120101
120148
  */
120102
- function forEachFilesReferencingPath(state, referencedPath, seenFileAndExportsOfFile, fn) {
120149
+ function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
120103
120150
  var _a;
120104
- (_a = state.referencedMap.getKeys(referencedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (filePath) {
120105
- return forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn);
120106
- });
120107
- }
120108
- /**
120109
- * fn on file and iterate on anything that exports this file
120110
- */
120111
- function forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn) {
120112
- var _a, _b, _c;
120113
- if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath)) {
120114
- return;
120115
- }
120116
- fn(state, filePath);
120151
+ if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
120152
+ return undefined;
120153
+ if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
120154
+ return true;
120155
+ handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
120117
120156
  ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120118
- // Go through exported modules from cache first
120119
120157
  // If exported modules has path, all files referencing file exported from are affected
120120
- (_a = state.currentAffectedFilesExportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120121
- return forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
120122
- });
120123
- // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
120124
- (_b = state.exportedModulesMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (exportedFromPath) {
120125
- var _a;
120126
- // If the cache had an updated value, skip
120127
- return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
120128
- !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) &&
120129
- forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
120158
+ forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
120159
+ return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
120130
120160
  });
120131
120161
  // Remove diagnostics of files that import this file (without going to exports of referencing files)
120132
- (_c = state.referencedMap.getKeys(filePath)) === null || _c === void 0 ? void 0 : _c.forEach(function (referencingFilePath) {
120162
+ (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
120133
120163
  return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
120134
- fn(state, referencingFilePath);
120135
- } // Dont add to seen since this is not yet done with the export removal
120136
- );
120164
+ handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
120165
+ state, referencingFilePath, cancellationToken, computeHash, host);
120166
+ });
120167
+ return undefined;
120137
120168
  }
120138
120169
  /**
120139
120170
  * This is called after completing operation on the next affected file.
@@ -120509,7 +120540,43 @@ var ts;
120509
120540
  return toAffectedFileEmitResult(state,
120510
120541
  // When whole program is affected, do emit only once (eg when --out or --outFile is specified)
120511
120542
  // Otherwise just affected file
120512
- ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
120543
+ ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120544
+ getWriteFileUpdatingSignatureCallback(writeFile) :
120545
+ writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
120546
+ }
120547
+ function getWriteFileUpdatingSignatureCallback(writeFile) {
120548
+ return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
120549
+ var _a;
120550
+ if (ts.isDeclarationFileName(fileName)) {
120551
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120552
+ var file = sourceFiles[0];
120553
+ var info = state.fileInfos.get(file.resolvedPath);
120554
+ var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
120555
+ if (signature === file.version) {
120556
+ var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
120557
+ if (newSignature !== file.version) { // Update it
120558
+ if (host.storeFilesChangingSignatureDuringEmit)
120559
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120560
+ if (state.exportedModulesMap)
120561
+ ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
120562
+ if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
120563
+ state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
120564
+ }
120565
+ else {
120566
+ info.signature = newSignature;
120567
+ if (state.exportedModulesMap)
120568
+ ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
120569
+ }
120570
+ }
120571
+ }
120572
+ }
120573
+ if (writeFile)
120574
+ writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
120575
+ else if (host.writeFile)
120576
+ host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
120577
+ else
120578
+ state.program.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
120579
+ };
120513
120580
  }
120514
120581
  /**
120515
120582
  * Emits the JavaScript and declaration files.
@@ -120566,7 +120633,9 @@ var ts;
120566
120633
  }
120567
120634
  }
120568
120635
  }
120569
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
120636
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120637
+ getWriteFileUpdatingSignatureCallback(writeFile) :
120638
+ writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
120570
120639
  }
120571
120640
  /**
120572
120641
  * Return the semantic diagnostics for the next affected file or undefined if iteration is complete
@@ -122758,6 +122827,7 @@ var ts;
122758
122827
  createHash: ts.maybeBind(host, host.createHash),
122759
122828
  readDirectory: ts.maybeBind(host, host.readDirectory),
122760
122829
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
122830
+ storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
122761
122831
  };
122762
122832
  function writeFile(fileName, text, writeByteOrderMark, onError) {
122763
122833
  try {
@@ -122817,6 +122887,7 @@ var ts;
122817
122887
  createHash: ts.maybeBind(system, system.createHash),
122818
122888
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
122819
122889
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
122890
+ storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
122820
122891
  };
122821
122892
  }
122822
122893
  ts.createProgramHost = createProgramHost;
@@ -122905,6 +122976,7 @@ var ts;
122905
122976
  var host = ts.createCompilerHostWorker(options, /*setParentNodes*/ undefined, system);
122906
122977
  host.createHash = ts.maybeBind(system, system.createHash);
122907
122978
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
122979
+ host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
122908
122980
  ts.setGetSourceFileAsHashVersioned(host, system);
122909
122981
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
122910
122982
  return host;
@@ -131654,7 +131726,7 @@ var ts;
131654
131726
  GlobalsSearch[GlobalsSearch["Success"] = 1] = "Success";
131655
131727
  GlobalsSearch[GlobalsSearch["Fail"] = 2] = "Fail";
131656
131728
  })(GlobalsSearch || (GlobalsSearch = {}));
131657
- function resolvingModuleSpecifiers(logPrefix, host, program, sourceFile, preferences, isForImportStatementCompletion, cb) {
131729
+ function resolvingModuleSpecifiers(logPrefix, host, program, sourceFile, position, preferences, isForImportStatementCompletion, isValidTypeOnlyUseSite, cb) {
131658
131730
  var _a, _b, _c;
131659
131731
  var start = ts.timestamp();
131660
131732
  var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
@@ -131669,9 +131741,9 @@ var ts;
131669
131741
  (_b = host.log) === null || _b === void 0 ? void 0 : _b.call(host, logPrefix + ": response is " + (resolutionLimitExceeded ? "incomplete" : "complete"));
131670
131742
  (_c = host.log) === null || _c === void 0 ? void 0 : _c.call(host, logPrefix + ": " + (ts.timestamp() - start));
131671
131743
  return result;
131672
- function tryResolve(exportInfo, isFromAmbientModule) {
131744
+ function tryResolve(exportInfo, symbolName, isFromAmbientModule) {
131673
131745
  if (isFromAmbientModule) {
131674
- var result_1 = ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, sourceFile, program, host, preferences);
131746
+ var result_1 = ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, symbolName, position, isValidTypeOnlyUseSite, sourceFile, program, host, preferences);
131675
131747
  if (result_1) {
131676
131748
  ambientCount++;
131677
131749
  }
@@ -131680,7 +131752,7 @@ var ts;
131680
131752
  var shouldResolveModuleSpecifier = isForImportStatementCompletion || preferences.allowIncompleteCompletions && resolvedCount < Completions.moduleSpecifierResolutionLimit;
131681
131753
  var shouldGetModuleSpecifierFromCache = !shouldResolveModuleSpecifier && preferences.allowIncompleteCompletions && cacheAttemptCount < Completions.moduleSpecifierResolutionCacheAttemptLimit;
131682
131754
  var result = (shouldResolveModuleSpecifier || shouldGetModuleSpecifierFromCache)
131683
- ? ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, sourceFile, program, host, preferences, packageJsonImportFilter, shouldGetModuleSpecifierFromCache)
131755
+ ? ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, symbolName, position, isValidTypeOnlyUseSite, sourceFile, program, host, preferences, packageJsonImportFilter, shouldGetModuleSpecifierFromCache)
131684
131756
  : undefined;
131685
131757
  if (!shouldResolveModuleSpecifier && !shouldGetModuleSpecifierFromCache || shouldGetModuleSpecifierFromCache && !result) {
131686
131758
  resolutionLimitExceeded = true;
@@ -131785,8 +131857,8 @@ var ts;
131785
131857
  return undefined;
131786
131858
  var lowerCaseTokenText = location.text.toLowerCase();
131787
131859
  var exportMap = ts.getExportInfoMap(file, host, program, cancellationToken);
131788
- var newEntries = resolvingModuleSpecifiers("continuePreviousIncompleteResponse", host, program, file, preferences,
131789
- /*isForImportStatementCompletion*/ false, function (context) {
131860
+ var newEntries = resolvingModuleSpecifiers("continuePreviousIncompleteResponse", host, program, file, location.getStart(), preferences,
131861
+ /*isForImportStatementCompletion*/ false, ts.isValidTypeOnlyAliasUseSite(location), function (context) {
131790
131862
  var entries = ts.mapDefined(previousResponse.entries, function (entry) {
131791
131863
  if (!entry.hasAction || !entry.source || !entry.data || completionEntryDataIsResolved(entry.data)) {
131792
131864
  // Not an auto import or already resolved; keep as is
@@ -131798,7 +131870,7 @@ var ts;
131798
131870
  }
131799
131871
  var origin = ts.Debug.checkDefined(getAutoImportSymbolFromCompletionEntryData(entry.name, entry.data, program, host)).origin;
131800
131872
  var info = exportMap.get(file.path, entry.data.exportMapKey);
131801
- var result = info && context.tryResolve(info, !ts.isExternalModuleNameRelative(ts.stripQuotes(origin.moduleSymbol.name)));
131873
+ var result = info && context.tryResolve(info, entry.name, !ts.isExternalModuleNameRelative(ts.stripQuotes(origin.moduleSymbol.name)));
131802
131874
  if (!result)
131803
131875
  return entry;
131804
131876
  var newOrigin = __assign(__assign({}, origin), { kind: 32 /* ResolvedExport */, moduleSpecifier: result.moduleSpecifier });
@@ -132390,22 +132462,44 @@ var ts;
132390
132462
  }
132391
132463
  }
132392
132464
  function createSnippetPrinter(printerOptions) {
132465
+ var escapes;
132393
132466
  var baseWriter = ts.textChanges.createWriter(ts.getNewLineCharacter(printerOptions));
132394
132467
  var printer = ts.createPrinter(printerOptions, baseWriter);
132395
- var writer = __assign(__assign({}, baseWriter), { write: function (s) { return baseWriter.write(ts.escapeSnippetText(s)); }, nonEscapingWrite: baseWriter.write, writeLiteral: function (s) { return baseWriter.writeLiteral(ts.escapeSnippetText(s)); }, writeStringLiteral: function (s) { return baseWriter.writeStringLiteral(ts.escapeSnippetText(s)); }, writeSymbol: function (s, symbol) { return baseWriter.writeSymbol(ts.escapeSnippetText(s), symbol); }, writeParameter: function (s) { return baseWriter.writeParameter(ts.escapeSnippetText(s)); }, writeComment: function (s) { return baseWriter.writeComment(ts.escapeSnippetText(s)); }, writeProperty: function (s) { return baseWriter.writeProperty(ts.escapeSnippetText(s)); } });
132468
+ 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); }); } });
132396
132469
  return {
132397
132470
  printSnippetList: printSnippetList,
132398
132471
  printAndFormatSnippetList: printAndFormatSnippetList,
132399
132472
  };
132473
+ // The formatter/scanner will have issues with snippet-escaped text,
132474
+ // so instead of writing the escaped text directly to the writer,
132475
+ // generate a set of changes that can be applied to the unescaped text
132476
+ // to escape it post-formatting.
132477
+ function escapingWrite(s, write) {
132478
+ var escaped = ts.escapeSnippetText(s);
132479
+ if (escaped !== s) {
132480
+ var start = baseWriter.getTextPos();
132481
+ write();
132482
+ var end = baseWriter.getTextPos();
132483
+ escapes = ts.append(escapes || (escapes = []), { newText: escaped, span: { start: start, length: end - start } });
132484
+ }
132485
+ else {
132486
+ write();
132487
+ }
132488
+ }
132400
132489
  /* Snippet-escaping version of `printer.printList`. */
132401
132490
  function printSnippetList(format, list, sourceFile) {
132491
+ var unescaped = printUnescapedSnippetList(format, list, sourceFile);
132492
+ return escapes ? ts.textChanges.applyChanges(unescaped, escapes) : unescaped;
132493
+ }
132494
+ function printUnescapedSnippetList(format, list, sourceFile) {
132495
+ escapes = undefined;
132402
132496
  writer.clear();
132403
132497
  printer.writeList(format, list, sourceFile, writer);
132404
132498
  return writer.getText();
132405
132499
  }
132406
132500
  function printAndFormatSnippetList(format, list, sourceFile, formatContext) {
132407
132501
  var syntheticFile = {
132408
- text: printSnippetList(format, list, sourceFile),
132502
+ text: printUnescapedSnippetList(format, list, sourceFile),
132409
132503
  getLineAndCharacterOfPosition: function (pos) {
132410
132504
  return ts.getLineAndCharacterOfPosition(this, pos);
132411
132505
  },
@@ -132417,7 +132511,10 @@ var ts;
132417
132511
  /* indentation */ 0,
132418
132512
  /* delta */ 0, __assign(__assign({}, formatContext), { options: formatOptions }));
132419
132513
  });
132420
- return ts.textChanges.applyChanges(syntheticFile.text, changes);
132514
+ var allChanges = escapes
132515
+ ? ts.stableSort(ts.concatenate(changes, escapes), function (a, b) { return ts.compareTextSpans(a.span, b.span); })
132516
+ : changes;
132517
+ return ts.textChanges.applyChanges(syntheticFile.text, allChanges);
132421
132518
  }
132422
132519
  }
132423
132520
  function originToCompletionEntryData(origin) {
@@ -133309,7 +133406,7 @@ var ts;
133309
133406
  moduleSymbol: moduleSymbol,
133310
133407
  symbol: firstAccessibleSymbol,
133311
133408
  targetFlags: ts.skipAlias(firstAccessibleSymbol, typeChecker).flags,
133312
- }], sourceFile, program, host, preferences) || {}).moduleSpecifier;
133409
+ }], firstAccessibleSymbol.name, position, ts.isValidTypeOnlyAliasUseSite(location), sourceFile, program, host, preferences) || {}).moduleSpecifier;
133313
133410
  if (moduleSpecifier) {
133314
133411
  var origin = {
133315
133412
  kind: getNullableSymbolOriginInfoKind(6 /* SymbolMemberExport */),
@@ -133564,7 +133661,7 @@ var ts;
133564
133661
  var exportInfo = ts.getExportInfoMap(sourceFile, host, program, cancellationToken);
133565
133662
  var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host);
133566
133663
  var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host);
133567
- resolvingModuleSpecifiers("collectAutoImports", host, program, sourceFile, preferences, !!importCompletionNode, function (context) {
133664
+ resolvingModuleSpecifiers("collectAutoImports", host, program, sourceFile, position, preferences, !!importCompletionNode, ts.isValidTypeOnlyAliasUseSite(location), function (context) {
133568
133665
  exportInfo.search(sourceFile.path,
133569
133666
  /*preferCapitalized*/ isRightOfOpenTag, function (symbolName, targetFlags) {
133570
133667
  if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings())))
@@ -133592,7 +133689,7 @@ var ts;
133592
133689
  }
133593
133690
  // If we don't need to resolve module specifiers, we can use any re-export that is importable at all
133594
133691
  // (We need to ensure that at least one is importable to show a completion.)
133595
- var _a = context.tryResolve(info, isFromAmbientModule) || {}, _b = _a.exportInfo, exportInfo = _b === void 0 ? defaultExportInfo : _b, moduleSpecifier = _a.moduleSpecifier;
133692
+ var _a = context.tryResolve(info, symbolName, isFromAmbientModule) || {}, _b = _a.exportInfo, exportInfo = _b === void 0 ? defaultExportInfo : _b, moduleSpecifier = _a.moduleSpecifier;
133596
133693
  var isDefaultExport = exportInfo.exportKind === 1 /* Default */;
133597
133694
  var symbol = isDefaultExport && ts.getLocalSymbolForExportDefault(exportInfo.symbol) || exportInfo.symbol;
133598
133695
  pushAutoImportSymbol(symbol, {
@@ -152416,7 +152513,7 @@ var ts;
152416
152513
  var symbol = checker.getMergedSymbol(ts.skipAlias(exportedSymbol, checker));
152417
152514
  var exportInfo = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, /*isJsxTagName*/ false, host, program, preferences, useAutoImportProvider);
152418
152515
  var useRequire = shouldUseRequire(sourceFile, program);
152419
- var fix = getImportFixForSymbol(sourceFile, exportInfo, moduleSymbol, symbolName, program, /*position*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences);
152516
+ var fix = getImportFixForSymbol(sourceFile, exportInfo, moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences);
152420
152517
  if (fix) {
152421
152518
  addImport({ fixes: [fix], symbolName: symbolName, errorIdentifierText: undefined });
152422
152519
  }
@@ -152586,7 +152683,7 @@ var ts;
152586
152683
  : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, isJsxTagName, host, program, preferences, /*useAutoImportProvider*/ true);
152587
152684
  var useRequire = shouldUseRequire(sourceFile, program);
152588
152685
  var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position));
152589
- var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
152686
+ var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, { symbolName: symbolName, position: position }, isValidTypeOnlyUseSite, useRequire, host, preferences));
152590
152687
  return {
152591
152688
  moduleSpecifier: fix.moduleSpecifier,
152592
152689
  codeAction: codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix,
@@ -152602,10 +152699,10 @@ var ts;
152602
152699
  return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, includeSymbolNameInDescription, 1 /* Double */, compilerOptions));
152603
152700
  }
152604
152701
  codefix.getPromoteTypeOnlyCompletionAction = getPromoteTypeOnlyCompletionAction;
152605
- function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
152702
+ function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, useNamespaceInfo, isValidTypeOnlyUseSite, useRequire, host, preferences) {
152606
152703
  ts.Debug.assert(exportInfos.some(function (info) { return info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol; }), "Some exportInfo should match the specified moduleSymbol");
152607
152704
  var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
152608
- return getBestFix(getImportFixes(exportInfos, symbolName, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences), sourceFile, program, packageJsonImportFilter, host);
152705
+ return getBestFix(getImportFixes(exportInfos, useNamespaceInfo, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes, sourceFile, program, packageJsonImportFilter, host);
152609
152706
  }
152610
152707
  function codeFixActionToCodeAction(_a) {
152611
152708
  var description = _a.description, changes = _a.changes, commands = _a.commands;
@@ -152660,25 +152757,32 @@ var ts;
152660
152757
  return !moduleFile || ts.isImportableFile(program, importingFile, moduleFile, preferences, /*packageJsonFilter*/ undefined, getModuleSpecifierResolutionHost(isFromPackageJson), (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host));
152661
152758
  }
152662
152759
  }
152663
- function getModuleSpecifierForBestExportInfo(exportInfo, importingFile, program, host, preferences, packageJsonImportFilter, fromCacheOnly) {
152664
- var _a = getNewImportFixes(program, importingFile,
152665
- /*position*/ undefined,
152666
- /*isValidTypeOnlyUseSite*/ false,
152667
- /*useRequire*/ false, exportInfo, host, preferences, fromCacheOnly), fixes = _a.fixes, computedWithoutCacheCount = _a.computedWithoutCacheCount;
152760
+ function getModuleSpecifierForBestExportInfo(exportInfo, symbolName, position, isValidTypeOnlyUseSite, importingFile, program, host, preferences, packageJsonImportFilter, fromCacheOnly) {
152761
+ var _a = getImportFixes(exportInfo, { symbolName: symbolName, position: position }, isValidTypeOnlyUseSite,
152762
+ /*useRequire*/ false, program, importingFile, host, preferences, fromCacheOnly), fixes = _a.fixes, computedWithoutCacheCount = _a.computedWithoutCacheCount;
152668
152763
  var result = getBestFix(fixes, importingFile, program, packageJsonImportFilter || ts.createPackageJsonImportFilter(importingFile, preferences, host), host);
152669
152764
  return result && __assign(__assign({}, result), { computedWithoutCacheCount: computedWithoutCacheCount });
152670
152765
  }
152671
152766
  codefix.getModuleSpecifierForBestExportInfo = getModuleSpecifierForBestExportInfo;
152672
- function getImportFixes(exportInfos, symbolName,
152767
+ function getImportFixes(exportInfos, useNamespaceInfo,
152673
152768
  /** undefined only for missing JSX namespace */
152674
- position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences) {
152769
+ isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, fromCacheOnly) {
152675
152770
  var checker = program.getTypeChecker();
152676
152771
  var existingImports = ts.flatMap(exportInfos, function (info) { return getExistingImportDeclarations(info, checker, sourceFile, program.getCompilerOptions()); });
152677
- var useNamespace = position === undefined ? undefined : tryUseExistingNamespaceImport(existingImports, symbolName, position, checker);
152772
+ var useNamespace = useNamespaceInfo && tryUseExistingNamespaceImport(existingImports, useNamespaceInfo.symbolName, useNamespaceInfo.position, checker);
152678
152773
  var addToExisting = tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, program.getCompilerOptions());
152679
- // Don't bother providing an action to add a new import if we can add to an existing one.
152680
- var addImport = addToExisting ? [addToExisting] : getFixesForAddImport(exportInfos, existingImports, program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, host, preferences);
152681
- return __spreadArray(__spreadArray([], (useNamespace ? [useNamespace] : ts.emptyArray), true), addImport, true);
152774
+ if (addToExisting) {
152775
+ // Don't bother providing an action to add a new import if we can add to an existing one.
152776
+ return {
152777
+ computedWithoutCacheCount: 0,
152778
+ fixes: __spreadArray(__spreadArray([], (useNamespace ? [useNamespace] : ts.emptyArray), true), [addToExisting], false),
152779
+ };
152780
+ }
152781
+ 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;
152782
+ return {
152783
+ computedWithoutCacheCount: computedWithoutCacheCount,
152784
+ fixes: __spreadArray(__spreadArray([], (useNamespace ? [useNamespace] : ts.emptyArray), true), fixes, true),
152785
+ };
152682
152786
  }
152683
152787
  function tryUseExistingNamespaceImport(existingImports, symbolName, position, checker) {
152684
152788
  // It is possible that multiple import statements with the same specifier exist in the file.
@@ -152868,9 +152972,9 @@ var ts;
152868
152972
  });
152869
152973
  return { computedWithoutCacheCount: computedWithoutCacheCount, fixes: fixes };
152870
152974
  }
152871
- function getFixesForAddImport(exportInfos, existingImports, program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
152975
+ function getFixesForAddImport(exportInfos, existingImports, program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, host, preferences, fromCacheOnly) {
152872
152976
  var existingDeclaration = ts.firstDefined(existingImports, function (info) { return newImportInfoFromExistingSpecifier(info, isValidTypeOnlyUseSite, useRequire, program.getTypeChecker(), program.getCompilerOptions()); });
152873
- return existingDeclaration ? [existingDeclaration] : getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfos, host, preferences).fixes;
152977
+ return existingDeclaration ? { fixes: [existingDeclaration] } : getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfos, host, preferences, fromCacheOnly);
152874
152978
  }
152875
152979
  function newImportInfoFromExistingSpecifier(_a, isValidTypeOnlyUseSite, useRequire, checker, compilerOptions) {
152876
152980
  var _b;
@@ -152966,7 +153070,8 @@ var ts;
152966
153070
  var symbolName = umdSymbol.name;
152967
153071
  var exportInfo = [{ symbol: umdSymbol, moduleSymbol: symbol, moduleFileName: undefined, exportKind: 3 /* UMD */, targetFlags: symbol.flags, isFromPackageJson: false }];
152968
153072
  var useRequire = shouldUseRequire(sourceFile, program);
152969
- var fixes = getImportFixes(exportInfo, symbolName, ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences);
153073
+ var position = ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined;
153074
+ var fixes = getImportFixes(exportInfo, position ? { position: position, symbolName: symbolName } : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences).fixes;
152970
153075
  return { fixes: fixes, symbolName: symbolName, errorIdentifierText: (_b = ts.tryCast(token, ts.isIdentifier)) === null || _b === void 0 ? void 0 : _b.text };
152971
153076
  }
152972
153077
  function getUmdSymbol(token, checker) {
@@ -153038,7 +153143,7 @@ var ts;
153038
153143
  var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences);
153039
153144
  var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) {
153040
153145
  var _ = _a[0], exportInfos = _a[1];
153041
- return getImportFixes(exportInfos, symbolName, symbolToken.getStart(sourceFile), isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences);
153146
+ return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes;
153042
153147
  }));
153043
153148
  return { fixes: fixes, symbolName: symbolName, errorIdentifierText: symbolToken.text };
153044
153149
  }