@typescript-deploys/pr-build 4.7.0-pr-48791-5 → 4.7.0-pr-47461-10

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/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.20220420";
103
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220425";
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,
@@ -17307,11 +17307,19 @@ var ts;
17307
17307
  return !!name && isDynamicName(name);
17308
17308
  }
17309
17309
  ts.hasDynamicName = hasDynamicName;
17310
+ function getComputedPropertyNameExpression(name) {
17311
+ return ts.isElementAccessExpression(name.expression)
17312
+ ? skipParentheses(name.expression.argumentExpression)
17313
+ : name.expression;
17314
+ }
17315
+ ts.getComputedPropertyNameExpression = getComputedPropertyNameExpression;
17310
17316
  function isDynamicName(name) {
17311
17317
  if (!(name.kind === 162 /* ComputedPropertyName */ || name.kind === 207 /* ElementAccessExpression */)) {
17312
17318
  return false;
17313
17319
  }
17314
- var expr = ts.isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression;
17320
+ var expr = ts.isElementAccessExpression(name)
17321
+ ? skipParentheses(name.argumentExpression)
17322
+ : getComputedPropertyNameExpression(name);
17315
17323
  return !isStringOrNumericLiteralLike(expr) &&
17316
17324
  !isSignedNumericLiteral(expr);
17317
17325
  }
@@ -17325,7 +17333,7 @@ var ts;
17325
17333
  case 8 /* NumericLiteral */:
17326
17334
  return ts.escapeLeadingUnderscores(name.text);
17327
17335
  case 162 /* ComputedPropertyName */:
17328
- var nameExpression = name.expression;
17336
+ var nameExpression = getComputedPropertyNameExpression(name);
17329
17337
  if (isStringOrNumericLiteralLike(nameExpression)) {
17330
17338
  return ts.escapeLeadingUnderscores(nameExpression.text);
17331
17339
  }
@@ -18293,10 +18301,10 @@ var ts;
18293
18301
  return ts.combinePaths(newDirPath, sourceFilePath);
18294
18302
  }
18295
18303
  ts.getSourceFilePathInNewDirWorker = getSourceFilePathInNewDirWorker;
18296
- function writeFile(host, diagnostics, fileName, data, writeByteOrderMark, sourceFiles) {
18297
- host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) {
18304
+ function writeFile(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) {
18305
+ host.writeFile(fileName, text, writeByteOrderMark, function (hostErrorMessage) {
18298
18306
  diagnostics.add(createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage));
18299
- }, sourceFiles);
18307
+ }, sourceFiles, data);
18300
18308
  }
18301
18309
  ts.writeFile = writeFile;
18302
18310
  function ensureDirectoriesExist(directoryPath, createDirectory, directoryExists) {
@@ -34298,7 +34306,7 @@ var ts;
34298
34306
  // it out, but don't allow any ambiguity, and return 'undefined' if this could be an
34299
34307
  // expression instead.
34300
34308
  return triState === 1 /* True */ ?
34301
- parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, disallowReturnTypeInArrowFunction) :
34309
+ parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, /*disallowReturnTypeInArrowFunction*/ false) :
34302
34310
  tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction); });
34303
34311
  }
34304
34312
  // True -> We definitely expect a parenthesized arrow function here.
@@ -34513,8 +34521,13 @@ var ts;
34513
34521
  // This is a valid arrow function with "z" as the return type.
34514
34522
  //
34515
34523
  // 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, even if we aren't
34524
+ // terminates the expression, so we cannot allow a return type if we aren't
34517
34525
  // certain whether or not the preceding text was parsed as a parameter list.
34526
+ //
34527
+ // For example,
34528
+ // a() ? (b: number, c?: string): void => d() : e
34529
+ // is determined by isParenthesizedArrowFunctionExpression to unambiguously
34530
+ // be an arrow expression, so we allow a return type.
34518
34531
  if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
34519
34532
  return undefined;
34520
34533
  }
@@ -44442,7 +44455,7 @@ var ts;
44442
44455
  return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + moduleName + "\"");
44443
44456
  }
44444
44457
  if (name.kind === 162 /* ComputedPropertyName */) {
44445
- var nameExpression = name.expression;
44458
+ var nameExpression = ts.getComputedPropertyNameExpression(name);
44446
44459
  // treat computed property names where expression is string/numeric literal as just string/numeric literal
44447
44460
  if (ts.isStringOrNumericLiteralLike(nameExpression)) {
44448
44461
  return ts.escapeLeadingUnderscores(nameExpression.text);
@@ -73427,6 +73440,7 @@ var ts;
73427
73440
  }
73428
73441
  }
73429
73442
  else {
73443
+ error(attributeDecl.expression, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types);
73430
73444
  typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType;
73431
73445
  }
73432
73446
  }
@@ -75664,6 +75678,7 @@ var ts;
75664
75678
  // decorators are applied to a declaration by the emitter, and not to an expression.
75665
75679
  var isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
75666
75680
  var argCheckMode = !isDecorator && !isSingleNonGenericCandidate && ts.some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
75681
+ argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
75667
75682
  // The following variables are captured and modified by calls to chooseOverload.
75668
75683
  // If overload resolution or type argument inference fails, we want to report the
75669
75684
  // best error possible. The best error is one which says that an argument was not
@@ -75879,7 +75894,7 @@ var ts;
75879
75894
  // If one or more context sensitive arguments were excluded, we start including
75880
75895
  // them now (and keeping do so for any subsequent candidates) and perform a second
75881
75896
  // round of type inference and applicability checking for this particular candidate.
75882
- argCheckMode = 0 /* Normal */;
75897
+ argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
75883
75898
  if (inferenceContext) {
75884
75899
  var typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
75885
75900
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
@@ -109961,6 +109976,7 @@ var ts;
109961
109976
  else {
109962
109977
  printer.writeFile(sourceFile, writer, sourceMapGenerator);
109963
109978
  }
109979
+ var sourceMapUrlPos;
109964
109980
  if (sourceMapGenerator) {
109965
109981
  if (sourceMapDataList) {
109966
109982
  sourceMapDataList.push({
@@ -109972,6 +109988,7 @@ var ts;
109972
109988
  if (sourceMappingURL) {
109973
109989
  if (!writer.isAtStartOfLine())
109974
109990
  writer.rawWrite(newLine);
109991
+ sourceMapUrlPos = writer.getTextPos();
109975
109992
  writer.writeComment("//# " + "sourceMappingURL" + "=" + sourceMappingURL); // Tools can sometimes see this line as a source mapping url comment
109976
109993
  }
109977
109994
  // Write the source map
@@ -109984,7 +110001,7 @@ var ts;
109984
110001
  writer.writeLine();
109985
110002
  }
109986
110003
  // Write the output file
109987
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles);
110004
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
109988
110005
  // Reset state
109989
110006
  writer.clear();
109990
110007
  }
@@ -110506,7 +110523,7 @@ var ts;
110506
110523
  setWriter(/*output*/ undefined, /*_sourceMapGenerator*/ undefined);
110507
110524
  }
110508
110525
  function getCurrentLineMap() {
110509
- return currentLineMap || (currentLineMap = ts.getLineStarts(currentSourceFile));
110526
+ return currentLineMap || (currentLineMap = ts.getLineStarts(ts.Debug.checkDefined(currentSourceFile)));
110510
110527
  }
110511
110528
  function emit(node, parenthesizerRule) {
110512
110529
  if (node === undefined)
@@ -111681,7 +111698,7 @@ var ts;
111681
111698
  increaseIndent();
111682
111699
  }
111683
111700
  var preferNewLine = node.multiLine ? 65536 /* PreferNewLine */ : 0 /* None */;
111684
- var allowTrailingComma = currentSourceFile.languageVersion >= 1 /* ES5 */ && !ts.isJsonSourceFile(currentSourceFile) ? 64 /* AllowTrailingComma */ : 0 /* None */;
111701
+ var allowTrailingComma = currentSourceFile && currentSourceFile.languageVersion >= 1 /* ES5 */ && !ts.isJsonSourceFile(currentSourceFile) ? 64 /* AllowTrailingComma */ : 0 /* None */;
111685
111702
  emitList(node, node.properties, 526226 /* ObjectLiteralExpressionProperties */ | allowTrailingComma | preferNewLine);
111686
111703
  if (indentedFlag) {
111687
111704
  decreaseIndent();
@@ -112037,7 +112054,7 @@ var ts;
112037
112054
  emitExpression(node.expression, parenthesizer.parenthesizeExpressionOfExpressionStatement);
112038
112055
  // Emit semicolon in non json files
112039
112056
  // 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)) {
112057
+ if (!currentSourceFile || !ts.isJsonSourceFile(currentSourceFile) || ts.nodeIsSynthesized(node.expression)) {
112041
112058
  writeTrailingSemicolon();
112042
112059
  }
112043
112060
  }
@@ -112330,7 +112347,7 @@ var ts;
112330
112347
  if (body.multiLine) {
112331
112348
  return false;
112332
112349
  }
112333
- if (!ts.nodeIsSynthesized(body) && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {
112350
+ if (!ts.nodeIsSynthesized(body) && currentSourceFile && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {
112334
112351
  return false;
112335
112352
  }
112336
112353
  if (getLeadingLineTerminatorCount(body, body.statements, 2 /* PreserveLines */)
@@ -112355,12 +112372,7 @@ var ts;
112355
112372
  var emitBlockFunctionBody = shouldEmitBlockFunctionBodyOnSingleLine(body)
112356
112373
  ? emitBlockFunctionBodyOnSingleLine
112357
112374
  : emitBlockFunctionBodyWorker;
112358
- if (emitBodyWithDetachedComments) {
112359
- emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody);
112360
- }
112361
- else {
112362
- emitBlockFunctionBody(body);
112363
- }
112375
+ emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody);
112364
112376
  decreaseIndent();
112365
112377
  writeToken(19 /* CloseBraceToken */, body.statements.end, writePunctuation, body);
112366
112378
  onAfterEmitNode === null || onAfterEmitNode === void 0 ? void 0 : onAfterEmitNode(body);
@@ -112757,7 +112769,8 @@ var ts;
112757
112769
  var emitAsSingleStatement = statements.length === 1 &&
112758
112770
  (
112759
112771
  // treat synthesized nodes as located on the same line for emit purposes
112760
- ts.nodeIsSynthesized(parentNode) ||
112772
+ !currentSourceFile ||
112773
+ ts.nodeIsSynthesized(parentNode) ||
112761
112774
  ts.nodeIsSynthesized(statements[0]) ||
112762
112775
  ts.rangeStartPositionsAreOnSameLine(parentNode, statements[0], currentSourceFile));
112763
112776
  var format = 163969 /* CaseOrDefaultClauseStatements */;
@@ -112988,16 +113001,14 @@ var ts;
112988
113001
  function emitSourceFile(node) {
112989
113002
  writeLine();
112990
113003
  var statements = node.statements;
112991
- if (emitBodyWithDetachedComments) {
112992
- // Emit detached comment if there are no prologue directives or if the first node is synthesized.
112993
- // The synthesized node will have no leading comment so some comments may be missed.
112994
- var shouldEmitDetachedComment = statements.length === 0 ||
112995
- !ts.isPrologueDirective(statements[0]) ||
112996
- ts.nodeIsSynthesized(statements[0]);
112997
- if (shouldEmitDetachedComment) {
112998
- emitBodyWithDetachedComments(node, statements, emitSourceFileWorker);
112999
- return;
113000
- }
113004
+ // Emit detached comment if there are no prologue directives or if the first node is synthesized.
113005
+ // The synthesized node will have no leading comment so some comments may be missed.
113006
+ var shouldEmitDetachedComment = statements.length === 0 ||
113007
+ !ts.isPrologueDirective(statements[0]) ||
113008
+ ts.nodeIsSynthesized(statements[0]);
113009
+ if (shouldEmitDetachedComment) {
113010
+ emitBodyWithDetachedComments(node, statements, emitSourceFileWorker);
113011
+ return;
113001
113012
  }
113002
113013
  emitSourceFileWorker(node);
113003
113014
  }
@@ -113386,7 +113397,7 @@ var ts;
113386
113397
  }
113387
113398
  if (isEmpty) {
113388
113399
  // Write a line terminator if the parent node was multi-line
113389
- if (format & 1 /* MultiLine */ && !(preserveSourceNewlines && (!parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile)))) {
113400
+ if (format & 1 /* MultiLine */ && !(preserveSourceNewlines && (!parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile)))) {
113390
113401
  writeLine();
113391
113402
  }
113392
113403
  else if (format & 256 /* SpaceBetweenBraces */ && !(format & 524288 /* NoSpaceIfEmpty */)) {
@@ -113647,7 +113658,7 @@ var ts;
113647
113658
  }
113648
113659
  var firstChild_1 = children[0];
113649
113660
  if (firstChild_1 === undefined) {
113650
- return !parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
113661
+ return !parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
113651
113662
  }
113652
113663
  if (firstChild_1.pos === nextListElementPos) {
113653
113664
  // If this child starts at the beginning of a list item in a parent list, its leading
@@ -113671,7 +113682,7 @@ var ts;
113671
113682
  // JsxText will be written with its leading whitespace, so don't add more manually.
113672
113683
  return 0;
113673
113684
  }
113674
- if (parentNode &&
113685
+ if (currentSourceFile && parentNode &&
113675
113686
  !ts.positionIsSynthesized(parentNode.pos) &&
113676
113687
  !ts.nodeIsSynthesized(firstChild_1) &&
113677
113688
  (!firstChild_1.parent || ts.getOriginalNode(firstChild_1.parent) === ts.getOriginalNode(parentNode))) {
@@ -113695,7 +113706,7 @@ var ts;
113695
113706
  // JsxText will be written with its leading whitespace, so don't add more manually.
113696
113707
  return 0;
113697
113708
  }
113698
- else if (!ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
113709
+ else if (currentSourceFile && !ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
113699
113710
  if (preserveSourceNewlines && siblingNodePositionsAreComparable(previousNode, nextNode)) {
113700
113711
  return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(previousNode, nextNode, currentSourceFile, includeComments); });
113701
113712
  }
@@ -113727,9 +113738,9 @@ var ts;
113727
113738
  }
113728
113739
  var lastChild = ts.lastOrUndefined(children);
113729
113740
  if (lastChild === undefined) {
113730
- return !parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
113741
+ return !parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
113731
113742
  }
113732
- if (parentNode && !ts.positionIsSynthesized(parentNode.pos) && !ts.nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) {
113743
+ if (currentSourceFile && parentNode && !ts.positionIsSynthesized(parentNode.pos) && !ts.nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) {
113733
113744
  if (preserveSourceNewlines) {
113734
113745
  var end_1 = ts.isNodeArray(children) && !ts.positionIsSynthesized(children.end) ? children.end : lastChild.end;
113735
113746
  return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenPositionAndNextNonWhitespaceCharacter(end_1, parentNode.end, currentSourceFile, includeComments); });
@@ -113802,7 +113813,7 @@ var ts;
113802
113813
  if (ts.getStartsOnNewLine(node2)) {
113803
113814
  return 1;
113804
113815
  }
113805
- if (!ts.nodeIsSynthesized(parent) && !ts.nodeIsSynthesized(node1) && !ts.nodeIsSynthesized(node2)) {
113816
+ if (currentSourceFile && !ts.nodeIsSynthesized(parent) && !ts.nodeIsSynthesized(node1) && !ts.nodeIsSynthesized(node2)) {
113806
113817
  if (preserveSourceNewlines) {
113807
113818
  return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(node1, node2, currentSourceFile, includeComments); });
113808
113819
  }
@@ -113812,7 +113823,7 @@ var ts;
113812
113823
  }
113813
113824
  function isEmptyBlock(block) {
113814
113825
  return block.statements.length === 0
113815
- && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile);
113826
+ && (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile));
113816
113827
  }
113817
113828
  function skipSynthesizedParentheses(node) {
113818
113829
  while (node.kind === 212 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) {
@@ -113824,16 +113835,23 @@ var ts;
113824
113835
  if (ts.isGeneratedIdentifier(node)) {
113825
113836
  return generateName(node);
113826
113837
  }
113827
- else if ((ts.isIdentifier(node) || ts.isPrivateIdentifier(node)) && (ts.nodeIsSynthesized(node) || !node.parent || !currentSourceFile || (node.parent && currentSourceFile && ts.getSourceFileOfNode(node) !== ts.getOriginalNode(currentSourceFile)))) {
113828
- return ts.idText(node);
113829
- }
113830
- else if (node.kind === 10 /* StringLiteral */ && node.textSourceNode) {
113838
+ if (ts.isStringLiteral(node) && node.textSourceNode) {
113831
113839
  return getTextOfNode(node.textSourceNode, includeTrivia);
113832
113840
  }
113833
- else if (ts.isLiteralExpression(node) && (ts.nodeIsSynthesized(node) || !node.parent)) {
113834
- return node.text;
113841
+ var sourceFile = currentSourceFile; // const needed for control flow
113842
+ var canUseSourceFile = !!sourceFile && !!node.parent && !ts.nodeIsSynthesized(node);
113843
+ if (ts.isMemberName(node)) {
113844
+ if (!canUseSourceFile || ts.getSourceFileOfNode(node) !== ts.getOriginalNode(sourceFile)) {
113845
+ return ts.idText(node);
113846
+ }
113835
113847
  }
113836
- return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node, includeTrivia);
113848
+ else {
113849
+ ts.Debug.assertNode(node, ts.isLiteralExpression); // not strictly necessary
113850
+ if (!canUseSourceFile) {
113851
+ return node.text;
113852
+ }
113853
+ }
113854
+ return ts.getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia);
113837
113855
  }
113838
113856
  function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) {
113839
113857
  if (node.kind === 10 /* StringLiteral */ && node.textSourceNode) {
@@ -114412,7 +114430,7 @@ var ts;
114412
114430
  return true;
114413
114431
  }
114414
114432
  function emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {
114415
- if (!shouldWriteComment(currentSourceFile.text, commentPos))
114433
+ if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
114416
114434
  return;
114417
114435
  if (!hasWrittenComment) {
114418
114436
  ts.emitNewLineBeforeLeadingCommentOfPosition(getCurrentLineMap(), writer, rangePos, commentPos);
@@ -114439,7 +114457,7 @@ var ts;
114439
114457
  forEachTrailingCommentToEmit(pos, emitTrailingComment);
114440
114458
  }
114441
114459
  function emitTrailingComment(commentPos, commentEnd, _kind, hasTrailingNewLine) {
114442
- if (!shouldWriteComment(currentSourceFile.text, commentPos))
114460
+ if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
114443
114461
  return;
114444
114462
  // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment2*/
114445
114463
  if (!writer.isAtStartOfLine()) {
@@ -114461,6 +114479,8 @@ var ts;
114461
114479
  exitComment();
114462
114480
  }
114463
114481
  function emitTrailingCommentOfPositionNoNewline(commentPos, commentEnd, kind) {
114482
+ if (!currentSourceFile)
114483
+ return;
114464
114484
  // trailing comments of a position are emitted at /*trailing comment1 */space/*trailing comment*/space
114465
114485
  emitPos(commentPos);
114466
114486
  ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
@@ -114470,6 +114490,8 @@ var ts;
114470
114490
  }
114471
114491
  }
114472
114492
  function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) {
114493
+ if (!currentSourceFile)
114494
+ return;
114473
114495
  // trailing comments of a position are emitted at /*trailing comment1 */space/*trailing comment*/space
114474
114496
  emitPos(commentPos);
114475
114497
  ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
@@ -114502,6 +114524,8 @@ var ts;
114502
114524
  return detachedCommentsInfo !== undefined && ts.last(detachedCommentsInfo).nodePos === pos;
114503
114525
  }
114504
114526
  function forEachLeadingCommentWithoutDetachedComments(cb) {
114527
+ if (!currentSourceFile)
114528
+ return;
114505
114529
  // get the leading comments from detachedPos
114506
114530
  var pos = ts.last(detachedCommentsInfo).detachedCommentEndPos;
114507
114531
  if (detachedCommentsInfo.length - 1) {
@@ -114513,7 +114537,7 @@ var ts;
114513
114537
  ts.forEachLeadingCommentRange(currentSourceFile.text, pos, cb, /*state*/ pos);
114514
114538
  }
114515
114539
  function emitDetachedCommentsAndUpdateCommentsInfo(range) {
114516
- var currentDetachedCommentInfo = ts.emitDetachedComments(currentSourceFile.text, getCurrentLineMap(), writer, emitComment, range, newLine, commentsDisabled);
114540
+ var currentDetachedCommentInfo = currentSourceFile && ts.emitDetachedComments(currentSourceFile.text, getCurrentLineMap(), writer, emitComment, range, newLine, commentsDisabled);
114517
114541
  if (currentDetachedCommentInfo) {
114518
114542
  if (detachedCommentsInfo) {
114519
114543
  detachedCommentsInfo.push(currentDetachedCommentInfo);
@@ -114524,7 +114548,7 @@ var ts;
114524
114548
  }
114525
114549
  }
114526
114550
  function emitComment(text, lineMap, writer, commentPos, commentEnd, newLine) {
114527
- if (!shouldWriteComment(currentSourceFile.text, commentPos))
114551
+ if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
114528
114552
  return;
114529
114553
  emitPos(commentPos);
114530
114554
  ts.writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine);
@@ -114536,7 +114560,7 @@ var ts;
114536
114560
  * @return true if the comment is a triple-slash comment else false
114537
114561
  */
114538
114562
  function isTripleSlashComment(commentPos, commentEnd) {
114539
- return ts.isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd);
114563
+ return !!currentSourceFile && ts.isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd);
114540
114564
  }
114541
114565
  // Source Maps
114542
114566
  function getParsedSourceMap(node) {
@@ -115451,7 +115475,11 @@ var ts;
115451
115475
  return newValue;
115452
115476
  };
115453
115477
  if (originalWriteFile) {
115454
- host.writeFile = function (fileName, data, writeByteOrderMark, onError, sourceFiles) {
115478
+ host.writeFile = function (fileName, data) {
115479
+ var rest = [];
115480
+ for (var _i = 2; _i < arguments.length; _i++) {
115481
+ rest[_i - 2] = arguments[_i];
115482
+ }
115455
115483
  var key = toPath(fileName);
115456
115484
  fileExistsCache.delete(key);
115457
115485
  var value = readFileCache.get(key);
@@ -115465,7 +115493,7 @@ var ts;
115465
115493
  sourceFileCache.delete(key);
115466
115494
  }
115467
115495
  }
115468
- originalWriteFile.call(host, fileName, data, writeByteOrderMark, onError, sourceFiles);
115496
+ originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false));
115469
115497
  };
115470
115498
  }
115471
115499
  // directoryExists
@@ -116398,6 +116426,7 @@ var ts;
116398
116426
  useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
116399
116427
  getFileIncludeReasons: function () { return fileReasons; },
116400
116428
  structureIsReused: structureIsReused,
116429
+ writeFile: writeFile,
116401
116430
  };
116402
116431
  onProgramCreateComplete();
116403
116432
  // Add file processingDiagnostics
@@ -116895,7 +116924,7 @@ var ts;
116895
116924
  getProjectReferenceRedirect: getProjectReferenceRedirect,
116896
116925
  isSourceOfProjectReferenceRedirect: isSourceOfProjectReferenceRedirect,
116897
116926
  getSymlinkCache: getSymlinkCache,
116898
- writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }),
116927
+ writeFile: writeFileCallback || writeFile,
116899
116928
  isEmitBlocked: isEmitBlocked,
116900
116929
  readFile: function (f) { return host.readFile(f); },
116901
116930
  fileExists: function (f) {
@@ -116915,6 +116944,9 @@ var ts;
116915
116944
  getFileIncludeReasons: program.getFileIncludeReasons,
116916
116945
  };
116917
116946
  }
116947
+ function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
116948
+ host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
116949
+ }
116918
116950
  function emitBuildInfo(writeFileCallback) {
116919
116951
  ts.Debug.assert(!ts.outFile(options));
116920
116952
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* Emit */, "emitBuildInfo", {}, /*separateBeginAndEnd*/ true);
@@ -119357,6 +119389,7 @@ var ts;
119357
119389
  }
119358
119390
  }
119359
119391
  }
119392
+ BuilderState.updateExportedModules = updateExportedModules;
119360
119393
  /**
119361
119394
  * Updates the exported modules from cache into state's exported modules map
119362
119395
  * This should be called whenever it is safe to commit the state of the builder
@@ -119780,6 +119813,18 @@ var ts;
119780
119813
  }
119781
119814
  return undefined;
119782
119815
  }
119816
+ function removeDiagnosticsOfLibraryFiles(state) {
119817
+ if (!state.cleanedDiagnosticsOfLibFiles) {
119818
+ state.cleanedDiagnosticsOfLibFiles = true;
119819
+ var program_1 = ts.Debug.checkDefined(state.program);
119820
+ var options_2 = program_1.getCompilerOptions();
119821
+ ts.forEach(program_1.getSourceFiles(), function (f) {
119822
+ return program_1.isSourceFileDefaultLibrary(f) &&
119823
+ !ts.skipTypeChecking(f, options_2, program_1) &&
119824
+ removeSemanticDiagnosticsOf(state, f.resolvedPath);
119825
+ });
119826
+ }
119827
+ }
119783
119828
  /**
119784
119829
  * Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
119785
119830
  * 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 +119834,17 @@ var ts;
119789
119834
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
119790
119835
  // If affected files is everything except default library, then nothing more to do
119791
119836
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
119792
- if (!state.cleanedDiagnosticsOfLibFiles) {
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
- }
119837
+ removeDiagnosticsOfLibraryFiles(state);
119802
119838
  // When a change affects the global scope, all files are considered to be affected without updating their signature
119803
119839
  // That means when affected file is handled, its signature can be out of date
119804
119840
  // To avoid this, ensure that we update the signature for any affected file in this scenario.
119805
119841
  ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
119806
119842
  return;
119807
119843
  }
119808
- else {
119809
- 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);
119810
- }
119811
- if (!state.compilerOptions.assumeChangesOnlyAffectDirectDependencies) {
119812
- forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host); });
119813
- }
119844
+ 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);
119845
+ if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
119846
+ return;
119847
+ handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
119814
119848
  }
119815
119849
  /**
119816
119850
  * Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
@@ -119852,16 +119886,41 @@ var ts;
119852
119886
  var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
119853
119887
  return newSignature !== oldSignature;
119854
119888
  }
119889
+ function forEachKeyOfExportedModulesMap(state, filePath, fn) {
119890
+ // Go through exported modules from cache first
119891
+ var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
119892
+ var result = keys && ts.forEachKey(keys, fn);
119893
+ if (result)
119894
+ return result;
119895
+ // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
119896
+ keys = state.exportedModulesMap.getKeys(filePath);
119897
+ return keys && ts.forEachKey(keys, function (exportedFromPath) {
119898
+ var _a;
119899
+ // If the cache had an updated value, skip
119900
+ return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
119901
+ !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
119902
+ fn(exportedFromPath) :
119903
+ undefined;
119904
+ });
119905
+ }
119906
+ function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
119907
+ var _a;
119908
+ if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
119909
+ return false;
119910
+ // Every file needs to be handled
119911
+ ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, /*firstSourceFile*/ undefined)
119912
+ .forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, host); });
119913
+ removeDiagnosticsOfLibraryFiles(state);
119914
+ return true;
119915
+ }
119855
119916
  /**
119856
- * Iterate on referencing modules that export entities from affected file
119917
+ * Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
119857
119918
  */
119858
- function forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, fn) {
119859
- var _a, _b;
119919
+ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
119860
119920
  // If there was change in signature (dts output) for the changed file,
119861
119921
  // then only we need to handle pending file emit
119862
- if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath)) {
119922
+ if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
119863
119923
  return;
119864
- }
119865
119924
  if (!isChangedSignature(state, affectedFile.resolvedPath))
119866
119925
  return;
119867
119926
  // Since isolated modules dont change js files, files affected by change in signature is itself
@@ -119874,7 +119933,9 @@ var ts;
119874
119933
  var currentPath = queue.pop();
119875
119934
  if (!seenFileNamesMap.has(currentPath)) {
119876
119935
  seenFileNamesMap.set(currentPath, true);
119877
- fn(state, currentPath);
119936
+ if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, host))
119937
+ return;
119938
+ handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, host);
119878
119939
  if (isChangedSignature(state, currentPath)) {
119879
119940
  var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
119880
119941
  queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
@@ -119886,56 +119947,38 @@ var ts;
119886
119947
  var seenFileAndExportsOfFile = new ts.Set();
119887
119948
  // Go through exported modules from cache first
119888
119949
  // If exported modules has path, all files referencing file exported from are affected
119889
- (_a = state.currentAffectedFilesExportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
119890
- return forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
119891
- });
119892
- // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
119893
- (_b = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.forEach(function (exportedFromPath) {
119894
- var _a;
119895
- // If the cache had an updated value, skip
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);
119950
+ forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
119951
+ if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
119952
+ return true;
119953
+ var references = state.referencedMap.getKeys(exportedFromPath);
119954
+ return references && ts.forEachKey(references, function (filePath) {
119955
+ return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
119956
+ });
119899
119957
  });
119900
119958
  }
119901
119959
  /**
119902
- * Iterate on files referencing referencedPath
119960
+ * handle dts and semantic diagnostics on file and iterate on anything that exports this file
119961
+ * return true when all work is done and we can exit handling dts emit and semantic diagnostics
119903
119962
  */
119904
- function forEachFilesReferencingPath(state, referencedPath, seenFileAndExportsOfFile, fn) {
119963
+ function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
119905
119964
  var _a;
119906
- (_a = state.referencedMap.getKeys(referencedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (filePath) {
119907
- return forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn);
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);
119965
+ if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
119966
+ return undefined;
119967
+ if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
119968
+ return true;
119969
+ handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
119919
119970
  ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
119920
- // Go through exported modules from cache first
119921
119971
  // If exported modules has path, all files referencing file exported from are affected
119922
- (_a = state.currentAffectedFilesExportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
119923
- return forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
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);
119972
+ forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
119973
+ return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
119932
119974
  });
119933
119975
  // Remove diagnostics of files that import this file (without going to exports of referencing files)
119934
- (_c = state.referencedMap.getKeys(filePath)) === null || _c === void 0 ? void 0 : _c.forEach(function (referencingFilePath) {
119976
+ (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
119935
119977
  return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
119936
- fn(state, referencingFilePath);
119937
- } // Dont add to seen since this is not yet done with the export removal
119938
- );
119978
+ handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
119979
+ state, referencingFilePath, cancellationToken, computeHash, host);
119980
+ });
119981
+ return undefined;
119939
119982
  }
119940
119983
  /**
119941
119984
  * This is called after completing operation on the next affected file.
@@ -120311,7 +120354,43 @@ var ts;
120311
120354
  return toAffectedFileEmitResult(state,
120312
120355
  // When whole program is affected, do emit only once (eg when --out or --outFile is specified)
120313
120356
  // Otherwise just affected file
120314
- 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);
120357
+ ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120358
+ getWriteFileUpdatingSignatureCallback(writeFile) :
120359
+ writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
120360
+ }
120361
+ function getWriteFileUpdatingSignatureCallback(writeFile) {
120362
+ return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
120363
+ var _a;
120364
+ if (ts.isDeclarationFileName(fileName)) {
120365
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120366
+ var file = sourceFiles[0];
120367
+ var info = state.fileInfos.get(file.resolvedPath);
120368
+ var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
120369
+ if (signature === file.version) {
120370
+ var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
120371
+ if (newSignature !== file.version) { // Update it
120372
+ if (host.storeFilesChangingSignatureDuringEmit)
120373
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120374
+ if (state.exportedModulesMap)
120375
+ ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
120376
+ if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
120377
+ state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
120378
+ }
120379
+ else {
120380
+ info.signature = newSignature;
120381
+ if (state.exportedModulesMap)
120382
+ ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
120383
+ }
120384
+ }
120385
+ }
120386
+ }
120387
+ if (writeFile)
120388
+ writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
120389
+ else if (host.writeFile)
120390
+ host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
120391
+ else
120392
+ state.program.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
120393
+ };
120315
120394
  }
120316
120395
  /**
120317
120396
  * Emits the JavaScript and declaration files.
@@ -120368,7 +120447,9 @@ var ts;
120368
120447
  }
120369
120448
  }
120370
120449
  }
120371
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
120450
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120451
+ getWriteFileUpdatingSignatureCallback(writeFile) :
120452
+ writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
120372
120453
  }
120373
120454
  /**
120374
120455
  * Return the semantic diagnostics for the next affected file or undefined if iteration is complete
@@ -122560,6 +122641,7 @@ var ts;
122560
122641
  createHash: ts.maybeBind(host, host.createHash),
122561
122642
  readDirectory: ts.maybeBind(host, host.readDirectory),
122562
122643
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
122644
+ storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
122563
122645
  };
122564
122646
  function writeFile(fileName, text, writeByteOrderMark, onError) {
122565
122647
  try {
@@ -122619,6 +122701,7 @@ var ts;
122619
122701
  createHash: ts.maybeBind(system, system.createHash),
122620
122702
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
122621
122703
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
122704
+ storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
122622
122705
  };
122623
122706
  }
122624
122707
  ts.createProgramHost = createProgramHost;
@@ -122707,6 +122790,7 @@ var ts;
122707
122790
  var host = ts.createCompilerHostWorker(options, /*setParentNodes*/ undefined, system);
122708
122791
  host.createHash = ts.maybeBind(system, system.createHash);
122709
122792
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
122793
+ host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
122710
122794
  ts.setGetSourceFileAsHashVersioned(host, system);
122711
122795
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
122712
122796
  return host;
@@ -131039,7 +131123,7 @@ var ts;
131039
131123
  GlobalsSearch[GlobalsSearch["Success"] = 1] = "Success";
131040
131124
  GlobalsSearch[GlobalsSearch["Fail"] = 2] = "Fail";
131041
131125
  })(GlobalsSearch || (GlobalsSearch = {}));
131042
- function resolvingModuleSpecifiers(logPrefix, host, program, sourceFile, preferences, isForImportStatementCompletion, cb) {
131126
+ function resolvingModuleSpecifiers(logPrefix, host, program, sourceFile, position, preferences, isForImportStatementCompletion, isValidTypeOnlyUseSite, cb) {
131043
131127
  var _a, _b, _c;
131044
131128
  var start = ts.timestamp();
131045
131129
  var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
@@ -131054,9 +131138,9 @@ var ts;
131054
131138
  (_b = host.log) === null || _b === void 0 ? void 0 : _b.call(host, logPrefix + ": response is " + (resolutionLimitExceeded ? "incomplete" : "complete"));
131055
131139
  (_c = host.log) === null || _c === void 0 ? void 0 : _c.call(host, logPrefix + ": " + (ts.timestamp() - start));
131056
131140
  return result;
131057
- function tryResolve(exportInfo, isFromAmbientModule) {
131141
+ function tryResolve(exportInfo, symbolName, isFromAmbientModule) {
131058
131142
  if (isFromAmbientModule) {
131059
- var result_1 = ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, sourceFile, program, host, preferences);
131143
+ var result_1 = ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, symbolName, position, isValidTypeOnlyUseSite, sourceFile, program, host, preferences);
131060
131144
  if (result_1) {
131061
131145
  ambientCount++;
131062
131146
  }
@@ -131065,7 +131149,7 @@ var ts;
131065
131149
  var shouldResolveModuleSpecifier = isForImportStatementCompletion || preferences.allowIncompleteCompletions && resolvedCount < Completions.moduleSpecifierResolutionLimit;
131066
131150
  var shouldGetModuleSpecifierFromCache = !shouldResolveModuleSpecifier && preferences.allowIncompleteCompletions && cacheAttemptCount < Completions.moduleSpecifierResolutionCacheAttemptLimit;
131067
131151
  var result = (shouldResolveModuleSpecifier || shouldGetModuleSpecifierFromCache)
131068
- ? ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, sourceFile, program, host, preferences, packageJsonImportFilter, shouldGetModuleSpecifierFromCache)
131152
+ ? ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, symbolName, position, isValidTypeOnlyUseSite, sourceFile, program, host, preferences, packageJsonImportFilter, shouldGetModuleSpecifierFromCache)
131069
131153
  : undefined;
131070
131154
  if (!shouldResolveModuleSpecifier && !shouldGetModuleSpecifierFromCache || shouldGetModuleSpecifierFromCache && !result) {
131071
131155
  resolutionLimitExceeded = true;
@@ -131170,8 +131254,8 @@ var ts;
131170
131254
  return undefined;
131171
131255
  var lowerCaseTokenText = location.text.toLowerCase();
131172
131256
  var exportMap = ts.getExportInfoMap(file, host, program, cancellationToken);
131173
- var newEntries = resolvingModuleSpecifiers("continuePreviousIncompleteResponse", host, program, file, preferences,
131174
- /*isForImportStatementCompletion*/ false, function (context) {
131257
+ var newEntries = resolvingModuleSpecifiers("continuePreviousIncompleteResponse", host, program, file, location.getStart(), preferences,
131258
+ /*isForImportStatementCompletion*/ false, ts.isValidTypeOnlyAliasUseSite(location), function (context) {
131175
131259
  var entries = ts.mapDefined(previousResponse.entries, function (entry) {
131176
131260
  if (!entry.hasAction || !entry.source || !entry.data || completionEntryDataIsResolved(entry.data)) {
131177
131261
  // Not an auto import or already resolved; keep as is
@@ -131183,7 +131267,7 @@ var ts;
131183
131267
  }
131184
131268
  var origin = ts.Debug.checkDefined(getAutoImportSymbolFromCompletionEntryData(entry.name, entry.data, program, host)).origin;
131185
131269
  var info = exportMap.get(file.path, entry.data.exportMapKey);
131186
- var result = info && context.tryResolve(info, !ts.isExternalModuleNameRelative(ts.stripQuotes(origin.moduleSymbol.name)));
131270
+ var result = info && context.tryResolve(info, entry.name, !ts.isExternalModuleNameRelative(ts.stripQuotes(origin.moduleSymbol.name)));
131187
131271
  if (!result)
131188
131272
  return entry;
131189
131273
  var newOrigin = __assign(__assign({}, origin), { kind: 32 /* ResolvedExport */, moduleSpecifier: result.moduleSpecifier });
@@ -131775,22 +131859,44 @@ var ts;
131775
131859
  }
131776
131860
  }
131777
131861
  function createSnippetPrinter(printerOptions) {
131862
+ var escapes;
131778
131863
  var baseWriter = ts.textChanges.createWriter(ts.getNewLineCharacter(printerOptions));
131779
131864
  var printer = ts.createPrinter(printerOptions, baseWriter);
131780
- 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)); } });
131865
+ 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
131866
  return {
131782
131867
  printSnippetList: printSnippetList,
131783
131868
  printAndFormatSnippetList: printAndFormatSnippetList,
131784
131869
  };
131870
+ // The formatter/scanner will have issues with snippet-escaped text,
131871
+ // so instead of writing the escaped text directly to the writer,
131872
+ // generate a set of changes that can be applied to the unescaped text
131873
+ // to escape it post-formatting.
131874
+ function escapingWrite(s, write) {
131875
+ var escaped = ts.escapeSnippetText(s);
131876
+ if (escaped !== s) {
131877
+ var start = baseWriter.getTextPos();
131878
+ write();
131879
+ var end = baseWriter.getTextPos();
131880
+ escapes = ts.append(escapes || (escapes = []), { newText: escaped, span: { start: start, length: end - start } });
131881
+ }
131882
+ else {
131883
+ write();
131884
+ }
131885
+ }
131785
131886
  /* Snippet-escaping version of `printer.printList`. */
131786
131887
  function printSnippetList(format, list, sourceFile) {
131888
+ var unescaped = printUnescapedSnippetList(format, list, sourceFile);
131889
+ return escapes ? ts.textChanges.applyChanges(unescaped, escapes) : unescaped;
131890
+ }
131891
+ function printUnescapedSnippetList(format, list, sourceFile) {
131892
+ escapes = undefined;
131787
131893
  writer.clear();
131788
131894
  printer.writeList(format, list, sourceFile, writer);
131789
131895
  return writer.getText();
131790
131896
  }
131791
131897
  function printAndFormatSnippetList(format, list, sourceFile, formatContext) {
131792
131898
  var syntheticFile = {
131793
- text: printSnippetList(format, list, sourceFile),
131899
+ text: printUnescapedSnippetList(format, list, sourceFile),
131794
131900
  getLineAndCharacterOfPosition: function (pos) {
131795
131901
  return ts.getLineAndCharacterOfPosition(this, pos);
131796
131902
  },
@@ -131802,7 +131908,10 @@ var ts;
131802
131908
  /* indentation */ 0,
131803
131909
  /* delta */ 0, __assign(__assign({}, formatContext), { options: formatOptions }));
131804
131910
  });
131805
- return ts.textChanges.applyChanges(syntheticFile.text, changes);
131911
+ var allChanges = escapes
131912
+ ? ts.stableSort(ts.concatenate(changes, escapes), function (a, b) { return ts.compareTextSpans(a.span, b.span); })
131913
+ : changes;
131914
+ return ts.textChanges.applyChanges(syntheticFile.text, allChanges);
131806
131915
  }
131807
131916
  }
131808
131917
  function originToCompletionEntryData(origin) {
@@ -132694,7 +132803,7 @@ var ts;
132694
132803
  moduleSymbol: moduleSymbol,
132695
132804
  symbol: firstAccessibleSymbol,
132696
132805
  targetFlags: ts.skipAlias(firstAccessibleSymbol, typeChecker).flags,
132697
- }], sourceFile, program, host, preferences) || {}).moduleSpecifier;
132806
+ }], firstAccessibleSymbol.name, position, ts.isValidTypeOnlyAliasUseSite(location), sourceFile, program, host, preferences) || {}).moduleSpecifier;
132698
132807
  if (moduleSpecifier) {
132699
132808
  var origin = {
132700
132809
  kind: getNullableSymbolOriginInfoKind(6 /* SymbolMemberExport */),
@@ -132949,7 +133058,7 @@ var ts;
132949
133058
  var exportInfo = ts.getExportInfoMap(sourceFile, host, program, cancellationToken);
132950
133059
  var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host);
132951
133060
  var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host);
132952
- resolvingModuleSpecifiers("collectAutoImports", host, program, sourceFile, preferences, !!importCompletionNode, function (context) {
133061
+ resolvingModuleSpecifiers("collectAutoImports", host, program, sourceFile, position, preferences, !!importCompletionNode, ts.isValidTypeOnlyAliasUseSite(location), function (context) {
132953
133062
  exportInfo.search(sourceFile.path,
132954
133063
  /*preferCapitalized*/ isRightOfOpenTag, function (symbolName, targetFlags) {
132955
133064
  if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings())))
@@ -132977,7 +133086,7 @@ var ts;
132977
133086
  }
132978
133087
  // If we don't need to resolve module specifiers, we can use any re-export that is importable at all
132979
133088
  // (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;
133089
+ var _a = context.tryResolve(info, symbolName, isFromAmbientModule) || {}, _b = _a.exportInfo, exportInfo = _b === void 0 ? defaultExportInfo : _b, moduleSpecifier = _a.moduleSpecifier;
132981
133090
  var isDefaultExport = exportInfo.exportKind === 1 /* Default */;
132982
133091
  var symbol = isDefaultExport && ts.getLocalSymbolForExportDefault(exportInfo.symbol) || exportInfo.symbol;
132983
133092
  pushAutoImportSymbol(symbol, {
@@ -151801,7 +151910,7 @@ var ts;
151801
151910
  var symbol = checker.getMergedSymbol(ts.skipAlias(exportedSymbol, checker));
151802
151911
  var exportInfo = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, /*isJsxTagName*/ false, host, program, preferences, useAutoImportProvider);
151803
151912
  var useRequire = shouldUseRequire(sourceFile, program);
151804
- var fix = getImportFixForSymbol(sourceFile, exportInfo, moduleSymbol, symbolName, program, /*position*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences);
151913
+ var fix = getImportFixForSymbol(sourceFile, exportInfo, moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences);
151805
151914
  if (fix) {
151806
151915
  addImport({ fixes: [fix], symbolName: symbolName, errorIdentifierText: undefined });
151807
151916
  }
@@ -151971,7 +152080,7 @@ var ts;
151971
152080
  : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, isJsxTagName, host, program, preferences, /*useAutoImportProvider*/ true);
151972
152081
  var useRequire = shouldUseRequire(sourceFile, program);
151973
152082
  var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position));
151974
- var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
152083
+ var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, { symbolName: symbolName, position: position }, isValidTypeOnlyUseSite, useRequire, host, preferences));
151975
152084
  return {
151976
152085
  moduleSpecifier: fix.moduleSpecifier,
151977
152086
  codeAction: codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix,
@@ -151987,10 +152096,10 @@ var ts;
151987
152096
  return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, includeSymbolNameInDescription, 1 /* Double */, compilerOptions));
151988
152097
  }
151989
152098
  codefix.getPromoteTypeOnlyCompletionAction = getPromoteTypeOnlyCompletionAction;
151990
- function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
152099
+ function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, useNamespaceInfo, isValidTypeOnlyUseSite, useRequire, host, preferences) {
151991
152100
  ts.Debug.assert(exportInfos.some(function (info) { return info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol; }), "Some exportInfo should match the specified moduleSymbol");
151992
152101
  var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
151993
- return getBestFix(getImportFixes(exportInfos, symbolName, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences), sourceFile, program, packageJsonImportFilter, host);
152102
+ return getBestFix(getImportFixes(exportInfos, useNamespaceInfo, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes, sourceFile, program, packageJsonImportFilter, host);
151994
152103
  }
151995
152104
  function codeFixActionToCodeAction(_a) {
151996
152105
  var description = _a.description, changes = _a.changes, commands = _a.commands;
@@ -152045,25 +152154,32 @@ var ts;
152045
152154
  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
152155
  }
152047
152156
  }
152048
- function getModuleSpecifierForBestExportInfo(exportInfo, importingFile, program, host, preferences, packageJsonImportFilter, fromCacheOnly) {
152049
- var _a = getNewImportFixes(program, importingFile,
152050
- /*position*/ undefined,
152051
- /*isValidTypeOnlyUseSite*/ false,
152052
- /*useRequire*/ false, exportInfo, host, preferences, fromCacheOnly), fixes = _a.fixes, computedWithoutCacheCount = _a.computedWithoutCacheCount;
152157
+ function getModuleSpecifierForBestExportInfo(exportInfo, symbolName, position, isValidTypeOnlyUseSite, importingFile, program, host, preferences, packageJsonImportFilter, fromCacheOnly) {
152158
+ var _a = getImportFixes(exportInfo, { symbolName: symbolName, position: position }, isValidTypeOnlyUseSite,
152159
+ /*useRequire*/ false, program, importingFile, host, preferences, fromCacheOnly), fixes = _a.fixes, computedWithoutCacheCount = _a.computedWithoutCacheCount;
152053
152160
  var result = getBestFix(fixes, importingFile, program, packageJsonImportFilter || ts.createPackageJsonImportFilter(importingFile, preferences, host), host);
152054
152161
  return result && __assign(__assign({}, result), { computedWithoutCacheCount: computedWithoutCacheCount });
152055
152162
  }
152056
152163
  codefix.getModuleSpecifierForBestExportInfo = getModuleSpecifierForBestExportInfo;
152057
- function getImportFixes(exportInfos, symbolName,
152164
+ function getImportFixes(exportInfos, useNamespaceInfo,
152058
152165
  /** undefined only for missing JSX namespace */
152059
- position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences) {
152166
+ isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, fromCacheOnly) {
152060
152167
  var checker = program.getTypeChecker();
152061
152168
  var existingImports = ts.flatMap(exportInfos, function (info) { return getExistingImportDeclarations(info, checker, sourceFile, program.getCompilerOptions()); });
152062
- var useNamespace = position === undefined ? undefined : tryUseExistingNamespaceImport(existingImports, symbolName, position, checker);
152169
+ var useNamespace = useNamespaceInfo && tryUseExistingNamespaceImport(existingImports, useNamespaceInfo.symbolName, useNamespaceInfo.position, checker);
152063
152170
  var addToExisting = tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, program.getCompilerOptions());
152064
- // Don't bother providing an action to add a new import if we can add to an existing one.
152065
- var addImport = addToExisting ? [addToExisting] : getFixesForAddImport(exportInfos, existingImports, program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, host, preferences);
152066
- return __spreadArray(__spreadArray([], (useNamespace ? [useNamespace] : ts.emptyArray), true), addImport, true);
152171
+ if (addToExisting) {
152172
+ // Don't bother providing an action to add a new import if we can add to an existing one.
152173
+ return {
152174
+ computedWithoutCacheCount: 0,
152175
+ fixes: __spreadArray(__spreadArray([], (useNamespace ? [useNamespace] : ts.emptyArray), true), [addToExisting], false),
152176
+ };
152177
+ }
152178
+ 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;
152179
+ return {
152180
+ computedWithoutCacheCount: computedWithoutCacheCount,
152181
+ fixes: __spreadArray(__spreadArray([], (useNamespace ? [useNamespace] : ts.emptyArray), true), fixes, true),
152182
+ };
152067
152183
  }
152068
152184
  function tryUseExistingNamespaceImport(existingImports, symbolName, position, checker) {
152069
152185
  // It is possible that multiple import statements with the same specifier exist in the file.
@@ -152253,9 +152369,9 @@ var ts;
152253
152369
  });
152254
152370
  return { computedWithoutCacheCount: computedWithoutCacheCount, fixes: fixes };
152255
152371
  }
152256
- function getFixesForAddImport(exportInfos, existingImports, program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
152372
+ function getFixesForAddImport(exportInfos, existingImports, program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, host, preferences, fromCacheOnly) {
152257
152373
  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).fixes;
152374
+ return existingDeclaration ? { fixes: [existingDeclaration] } : getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfos, host, preferences, fromCacheOnly);
152259
152375
  }
152260
152376
  function newImportInfoFromExistingSpecifier(_a, isValidTypeOnlyUseSite, useRequire, checker, compilerOptions) {
152261
152377
  var _b;
@@ -152351,7 +152467,8 @@ var ts;
152351
152467
  var symbolName = umdSymbol.name;
152352
152468
  var exportInfo = [{ symbol: umdSymbol, moduleSymbol: symbol, moduleFileName: undefined, exportKind: 3 /* UMD */, targetFlags: symbol.flags, isFromPackageJson: false }];
152353
152469
  var useRequire = shouldUseRequire(sourceFile, program);
152354
- var fixes = getImportFixes(exportInfo, symbolName, ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences);
152470
+ var position = ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined;
152471
+ var fixes = getImportFixes(exportInfo, position ? { position: position, symbolName: symbolName } : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences).fixes;
152355
152472
  return { fixes: fixes, symbolName: symbolName, errorIdentifierText: (_b = ts.tryCast(token, ts.isIdentifier)) === null || _b === void 0 ? void 0 : _b.text };
152356
152473
  }
152357
152474
  function getUmdSymbol(token, checker) {
@@ -152423,7 +152540,7 @@ var ts;
152423
152540
  var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences);
152424
152541
  var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) {
152425
152542
  var _ = _a[0], exportInfos = _a[1];
152426
- return getImportFixes(exportInfos, symbolName, symbolToken.getStart(sourceFile), isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences);
152543
+ return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes;
152427
152544
  }));
152428
152545
  return { fixes: fixes, symbolName: symbolName, errorIdentifierText: symbolToken.text };
152429
152546
  }