typescript 5.0.0-dev.20230123 → 5.0.0-dev.20230126

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.
@@ -42,7 +42,7 @@ var ts = (() => {
42
42
  "src/compiler/corePublic.ts"() {
43
43
  "use strict";
44
44
  versionMajorMinor = "5.0";
45
- version = `${versionMajorMinor}.0-dev.20230123`;
45
+ version = `${versionMajorMinor}.0-dev.20230126`;
46
46
  Comparison = /* @__PURE__ */ ((Comparison3) => {
47
47
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
48
48
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -13247,6 +13247,20 @@ ${lanes.join("\n")}
13247
13247
  BigUint64Array: ["at"],
13248
13248
  ObjectConstructor: ["hasOwn"],
13249
13249
  Error: ["cause"]
13250
+ },
13251
+ es2023: {
13252
+ Array: ["findLastIndex", "findLast"],
13253
+ Int8Array: ["findLastIndex", "findLast"],
13254
+ Uint8Array: ["findLastIndex", "findLast"],
13255
+ Uint8ClampedArray: ["findLastIndex", "findLast"],
13256
+ Int16Array: ["findLastIndex", "findLast"],
13257
+ Uint16Array: ["findLastIndex", "findLast"],
13258
+ Int32Array: ["findLastIndex", "findLast"],
13259
+ Uint32Array: ["findLastIndex", "findLast"],
13260
+ Float32Array: ["findLastIndex", "findLast"],
13261
+ Float64Array: ["findLastIndex", "findLast"],
13262
+ BigInt64Array: ["findLastIndex", "findLast"],
13263
+ BigUint64Array: ["findLastIndex", "findLast"]
13250
13264
  }
13251
13265
  };
13252
13266
  }
@@ -48708,7 +48722,7 @@ ${lanes.join("\n")}
48708
48722
  return writer ? symbolToStringWorker(writer).getText() : usingSingleLineStringWriter(symbolToStringWorker);
48709
48723
  function symbolToStringWorker(writer2) {
48710
48724
  const entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags);
48711
- const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 308 /* SourceFile */ ? createPrinter({ removeComments: true, neverAsciiEscape: true }) : createPrinter({ removeComments: true });
48725
+ const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 308 /* SourceFile */ ? createPrinterWithRemoveCommentsNeverAsciiEscape() : createPrinterWithRemoveComments();
48712
48726
  const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
48713
48727
  printer.writeNode(
48714
48728
  4 /* Unspecified */,
@@ -48730,7 +48744,7 @@ ${lanes.join("\n")}
48730
48744
  sigOutput = kind === 1 /* Construct */ ? 177 /* ConstructSignature */ : 176 /* CallSignature */;
48731
48745
  }
48732
48746
  const sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */);
48733
- const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true });
48747
+ const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
48734
48748
  const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
48735
48749
  printer.writeNode(
48736
48750
  4 /* Unspecified */,
@@ -48747,8 +48761,7 @@ ${lanes.join("\n")}
48747
48761
  const typeNode = nodeBuilder.typeToTypeNode(type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0));
48748
48762
  if (typeNode === void 0)
48749
48763
  return Debug.fail("should always get typenode");
48750
- const options = { removeComments: type !== unresolvedType };
48751
- const printer = createPrinter(options);
48764
+ const printer = type !== unresolvedType ? createPrinterWithRemoveComments() : createPrinterWithDefaults();
48752
48765
  const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
48753
48766
  printer.writeNode(
48754
48767
  4 /* Unspecified */,
@@ -52099,7 +52112,7 @@ ${lanes.join("\n")}
52099
52112
  typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */)
52100
52113
  // TODO: GH#18217
52101
52114
  );
52102
- const printer = createPrinter({ removeComments: true });
52115
+ const printer = createPrinterWithRemoveComments();
52103
52116
  const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
52104
52117
  printer.writeNode(
52105
52118
  4 /* Unspecified */,
@@ -67127,7 +67140,7 @@ ${lanes.join("\n")}
67127
67140
  return getNonMissingTypeOfSymbol(symbol);
67128
67141
  }
67129
67142
  function getControlFlowContainer(node) {
67130
- return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 265 /* ModuleBlock */ || node2.kind === 308 /* SourceFile */ || node2.kind === 295 /* CatchClause */ || node2.kind === 169 /* PropertyDeclaration */);
67143
+ return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 265 /* ModuleBlock */ || node2.kind === 308 /* SourceFile */ || node2.kind === 169 /* PropertyDeclaration */);
67131
67144
  }
67132
67145
  function isSymbolAssigned(symbol) {
67133
67146
  if (!symbol.valueDeclaration) {
@@ -67388,14 +67401,13 @@ ${lanes.join("\n")}
67388
67401
  const isParameter2 = getRootDeclaration(declaration).kind === 166 /* Parameter */;
67389
67402
  const declarationContainer = getControlFlowContainer(declaration);
67390
67403
  let flowContainer = getControlFlowContainer(node);
67391
- const isCatch = flowContainer.kind === 295 /* CatchClause */;
67392
67404
  const isOuterVariable = flowContainer !== declarationContainer;
67393
67405
  const isSpreadDestructuringAssignmentTarget = node.parent && node.parent.parent && isSpreadAssignment(node.parent) && isDestructuringAssignmentTarget(node.parent.parent);
67394
67406
  const isModuleExports = symbol.flags & 134217728 /* ModuleExports */;
67395
67407
  while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* FunctionExpression */ || flowContainer.kind === 216 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) {
67396
67408
  flowContainer = getControlFlowContainer(flowContainer);
67397
67409
  }
67398
- const assumeInitialized = isParameter2 || isCatch || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
67410
+ const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
67399
67411
  const initialType = assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : type === autoType || type === autoArrayType ? undefinedType : getOptionalType(type);
67400
67412
  const flowType = getFlowTypeOfReference(node, type, initialType, flowContainer);
67401
67413
  if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {
@@ -80655,7 +80667,7 @@ ${lanes.join("\n")}
80655
80667
  if (typeAnnotationNode) {
80656
80668
  checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression);
80657
80669
  }
80658
- const isIllegalExportDefaultInCJS = !node.isExportEquals && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
80670
+ const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
80659
80671
  if (node.expression.kind === 79 /* Identifier */) {
80660
80672
  const id = node.expression;
80661
80673
  const sym = resolveEntityName(
@@ -113784,7 +113796,7 @@ ${lanes.join("\n")}
113784
113796
  function getEmitListItem(emit, parenthesizerRule) {
113785
113797
  return emit.length === 1 ? emitListItemNoParenthesizer : typeof parenthesizerRule === "object" ? emitListItemWithParenthesizerRuleSelector : emitListItemWithParenthesizerRule;
113786
113798
  }
113787
- var brackets, notImplementedResolver, TempFlags;
113799
+ var brackets, notImplementedResolver, createPrinterWithDefaults, createPrinterWithRemoveComments, createPrinterWithRemoveCommentsNeverAsciiEscape, createPrinterWithRemoveCommentsOmitTrailingSemicolon, TempFlags;
113788
113800
  var init_emitter = __esm({
113789
113801
  "src/compiler/emitter.ts"() {
113790
113802
  "use strict";
@@ -113835,6 +113847,10 @@ ${lanes.join("\n")}
113835
113847
  getDeclarationStatementsForSourceFile: notImplemented,
113836
113848
  isImportRequiredByAugmentation: notImplemented
113837
113849
  };
113850
+ createPrinterWithDefaults = memoize(() => createPrinter({}));
113851
+ createPrinterWithRemoveComments = memoize(() => createPrinter({ removeComments: true }));
113852
+ createPrinterWithRemoveCommentsNeverAsciiEscape = memoize(() => createPrinter({ removeComments: true, neverAsciiEscape: true }));
113853
+ createPrinterWithRemoveCommentsOmitTrailingSemicolon = memoize(() => createPrinter({ removeComments: true, omitTrailingSemicolon: true }));
113838
113854
  TempFlags = /* @__PURE__ */ ((TempFlags2) => {
113839
113855
  TempFlags2[TempFlags2["Auto"] = 0] = "Auto";
113840
113856
  TempFlags2[TempFlags2["CountMask"] = 268435455] = "CountMask";
@@ -126889,7 +126905,7 @@ ${lanes.join("\n")}
126889
126905
  function nodeToDisplayParts(node, enclosingDeclaration) {
126890
126906
  const file = enclosingDeclaration.getSourceFile();
126891
126907
  return mapToDisplayParts((writer) => {
126892
- const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true });
126908
+ const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
126893
126909
  printer.writeNode(4 /* Unspecified */, node, file, writer);
126894
126910
  });
126895
126911
  }
@@ -132743,12 +132759,9 @@ ${lanes.join("\n")}
132743
132759
  Debug.assertEqual(action.type, "install package");
132744
132760
  return host.installPackage ? host.installPackage({ fileName: getPath(action.file), packageName: action.packageName }) : Promise.reject("Host does not implement `installPackage`");
132745
132761
  }
132746
- function getDocCommentTemplateAtPosition2(fileName, position, options) {
132747
- return ts_JsDoc_exports.getDocCommentTemplateAtPosition(getNewLineOrDefaultFromHost(
132748
- host,
132749
- /*formatSettings*/
132750
- void 0
132751
- ), syntaxTreeCache.getCurrentSourceFile(fileName), position, options);
132762
+ function getDocCommentTemplateAtPosition2(fileName, position, options, formatOptions) {
132763
+ const formatSettings = formatOptions ? ts_formatting_exports.getFormatContext(formatOptions, host).options : void 0;
132764
+ return ts_JsDoc_exports.getDocCommentTemplateAtPosition(getNewLineOrDefaultFromHost(host, formatSettings), syntaxTreeCache.getCurrentSourceFile(fileName), position, options);
132752
132765
  }
132753
132766
  function isValidBraceCompletionAtPosition(fileName, position, openingBrace) {
132754
132767
  if (openingBrace === 60 /* lessThan */) {
@@ -134620,10 +134633,10 @@ ${lanes.join("\n")}
134620
134633
  }
134621
134634
  );
134622
134635
  }
134623
- getDocCommentTemplateAtPosition(fileName, position, options) {
134636
+ getDocCommentTemplateAtPosition(fileName, position, options, formatOptions) {
134624
134637
  return this.forwardJSONCall(
134625
134638
  `getDocCommentTemplateAtPosition('${fileName}', ${position})`,
134626
- () => this.languageService.getDocCommentTemplateAtPosition(fileName, position, options)
134639
+ () => this.languageService.getDocCommentTemplateAtPosition(fileName, position, options, formatOptions)
134627
134640
  );
134628
134641
  }
134629
134642
  /// NAVIGATE TO
@@ -135517,7 +135530,7 @@ ${lanes.join("\n")}
135517
135530
  }
135518
135531
  }
135519
135532
  if (text === void 0) {
135520
- const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true });
135533
+ const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
135521
135534
  text = usingSingleLineStringWriter((writer) => printer.writeNode(4 /* Unspecified */, node, node.getSourceFile(), writer));
135522
135535
  }
135523
135536
  return { text, pos: declName.getStart(), end: declName.getEnd() };
@@ -142522,7 +142535,7 @@ ${lanes.join("\n")}
142522
142535
  Diagnostics.Delete_all_unused_param_tags
142523
142536
  );
142524
142537
  }
142525
- function getRenameAction(context, { name, signature, jsDocParameterTag }) {
142538
+ function getRenameAction(context, { name, jsDocHost, signature, jsDocParameterTag }) {
142526
142539
  if (!length(signature.parameters))
142527
142540
  return void 0;
142528
142541
  const sourceFile = context.sourceFile;
@@ -142545,7 +142558,7 @@ ${lanes.join("\n")}
142545
142558
  jsDocParameterTag.isNameFirst,
142546
142559
  jsDocParameterTag.comment
142547
142560
  );
142548
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) => changeTracker.replaceJSDocComment(sourceFile, signature, map(tags, (t) => t === jsDocParameterTag ? newJSDocParameterTag : t)));
142561
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) => changeTracker.replaceJSDocComment(sourceFile, jsDocHost, map(tags, (t) => t === jsDocParameterTag ? newJSDocParameterTag : t)));
142549
142562
  return createCodeFixActionWithoutFixAll(renameUnmatchedParameter, changes, [Diagnostics.Rename_param_tag_name_0_to_1, name.getText(sourceFile), parameterName]);
142550
142563
  }
142551
142564
  function getInfo10(sourceFile, pos) {
@@ -153998,8 +154011,7 @@ ${lanes.join("\n")}
153998
154011
  }
153999
154012
  function printTypeInSingleLine(type) {
154000
154013
  const flags = 70221824 /* IgnoreErrors */ | 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
154001
- const options = { removeComments: true };
154002
- const printer = createPrinter(options);
154014
+ const printer = createPrinterWithRemoveComments();
154003
154015
  return usingSingleLineStringWriter((writer) => {
154004
154016
  const typeNode = checker.typeToTypeNode(
154005
154017
  type,
@@ -154415,6 +154427,8 @@ ${lanes.join("\n")}
154415
154427
  "lends",
154416
154428
  "license",
154417
154429
  "link",
154430
+ "linkcode",
154431
+ "linkplain",
154418
154432
  "listens",
154419
154433
  "member",
154420
154434
  "memberof",
@@ -154427,6 +154441,7 @@ ${lanes.join("\n")}
154427
154441
  "package",
154428
154442
  "param",
154429
154443
  "private",
154444
+ "prop",
154430
154445
  "property",
154431
154446
  "protected",
154432
154447
  "public",
@@ -161171,7 +161186,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
161171
161186
  }
161172
161187
  function getTypeHelpItem(symbol, typeParameters, checker, enclosingDeclaration, sourceFile) {
161173
161188
  const typeSymbolDisplay = symbolToDisplayParts(checker, symbol);
161174
- const printer = createPrinter({ removeComments: true });
161189
+ const printer = createPrinterWithRemoveComments();
161175
161190
  const parameters = typeParameters.map((t) => createSignatureHelpParameterForTypeParameter(t, checker, enclosingDeclaration, sourceFile, printer));
161176
161191
  const documentation = symbol.getDocumentationComment(checker);
161177
161192
  const tags = symbol.getJsDocTags(checker);
@@ -161214,7 +161229,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
161214
161229
  }
161215
161230
  function itemInfoForTypeParameters(candidateSignature, checker, enclosingDeclaration, sourceFile) {
161216
161231
  const typeParameters = (candidateSignature.target || candidateSignature).typeParameters;
161217
- const printer = createPrinter({ removeComments: true });
161232
+ const printer = createPrinterWithRemoveComments();
161218
161233
  const parameters = (typeParameters || emptyArray).map((t) => createSignatureHelpParameterForTypeParameter(t, checker, enclosingDeclaration, sourceFile, printer));
161219
161234
  const thisParameter = candidateSignature.thisParameter ? [checker.symbolToParameterDeclaration(candidateSignature.thisParameter, enclosingDeclaration, signatureHelpNodeBuilderFlags)] : [];
161220
161235
  return checker.getExpandedParameters(candidateSignature).map((paramList) => {
@@ -161226,7 +161241,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
161226
161241
  });
161227
161242
  }
161228
161243
  function itemInfoForParameters(candidateSignature, checker, enclosingDeclaration, sourceFile) {
161229
- const printer = createPrinter({ removeComments: true });
161244
+ const printer = createPrinterWithRemoveComments();
161230
161245
  const typeParameterParts = mapToDisplayParts((writer) => {
161231
161246
  if (candidateSignature.typeParameters && candidateSignature.typeParameters.length) {
161232
161247
  const args = factory.createNodeArray(candidateSignature.typeParameters.map((p) => checker.typeParameterToDeclaration(p, enclosingDeclaration, signatureHelpNodeBuilderFlags)));
@@ -161632,7 +161647,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
161632
161647
  let hasAddedSymbolInfo = false;
161633
161648
  const isThisExpression = location.kind === 108 /* ThisKeyword */ && isInExpressionContext(location) || isThisInTypeQuery(location);
161634
161649
  let type;
161635
- let printer;
161636
161650
  let documentationFromAlias;
161637
161651
  let tagsFromAlias;
161638
161652
  let hasMultipleSignatures = false;
@@ -162025,10 +162039,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
162025
162039
  }
162026
162040
  return { displayParts, documentation, symbolKind, tags: tags.length === 0 ? void 0 : tags };
162027
162041
  function getPrinter() {
162028
- if (!printer) {
162029
- printer = createPrinter({ removeComments: true });
162030
- }
162031
- return printer;
162042
+ return createPrinterWithRemoveComments();
162032
162043
  }
162033
162044
  function prefixNextMeaning() {
162034
162045
  if (displayParts.length) {
@@ -175499,7 +175510,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
175499
175510
  getDocCommentTemplate(args) {
175500
175511
  const { file, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(args);
175501
175512
  const position = this.getPositionInFile(args, file);
175502
- return languageService.getDocCommentTemplateAtPosition(file, position, this.getPreferences(file));
175513
+ return languageService.getDocCommentTemplateAtPosition(file, position, this.getPreferences(file), this.getFormatOptions(file));
175503
175514
  }
175504
175515
  getSpanOfEnclosingComment(args) {
175505
175516
  const { file, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(args);
@@ -177735,6 +177746,10 @@ ${e.message}`;
177735
177746
  createPatternMatcher: () => createPatternMatcher,
177736
177747
  createPrependNodes: () => createPrependNodes,
177737
177748
  createPrinter: () => createPrinter,
177749
+ createPrinterWithDefaults: () => createPrinterWithDefaults,
177750
+ createPrinterWithRemoveComments: () => createPrinterWithRemoveComments,
177751
+ createPrinterWithRemoveCommentsNeverAsciiEscape: () => createPrinterWithRemoveCommentsNeverAsciiEscape,
177752
+ createPrinterWithRemoveCommentsOmitTrailingSemicolon: () => createPrinterWithRemoveCommentsOmitTrailingSemicolon,
177738
177753
  createProgram: () => createProgram,
177739
177754
  createProgramHost: () => createProgramHost,
177740
177755
  createPropertyNameNodeForIdentifierOrLiteral: () => createPropertyNameNodeForIdentifierOrLiteral,
@@ -180087,6 +180102,10 @@ ${e.message}`;
180087
180102
  createPatternMatcher: () => createPatternMatcher,
180088
180103
  createPrependNodes: () => createPrependNodes,
180089
180104
  createPrinter: () => createPrinter,
180105
+ createPrinterWithDefaults: () => createPrinterWithDefaults,
180106
+ createPrinterWithRemoveComments: () => createPrinterWithRemoveComments,
180107
+ createPrinterWithRemoveCommentsNeverAsciiEscape: () => createPrinterWithRemoveCommentsNeverAsciiEscape,
180108
+ createPrinterWithRemoveCommentsOmitTrailingSemicolon: () => createPrinterWithRemoveCommentsOmitTrailingSemicolon,
180090
180109
  createProgram: () => createProgram,
180091
180110
  createProgramHost: () => createProgramHost,
180092
180111
  createPropertyNameNodeForIdentifierOrLiteral: () => createPropertyNameNodeForIdentifierOrLiteral,
@@ -6088,7 +6088,7 @@ declare namespace ts {
6088
6088
  getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
6089
6089
  getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
6090
6090
  getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
6091
- getDocCommentTemplateAtPosition(fileName: string, position: number, options?: DocCommentTemplateOptions): TextInsertion | undefined;
6091
+ getDocCommentTemplateAtPosition(fileName: string, position: number, options?: DocCommentTemplateOptions, formatOptions?: FormatCodeSettings): TextInsertion | undefined;
6092
6092
  isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean;
6093
6093
  /**
6094
6094
  * This will return a defined result if the position is after the `>` of the opening tag, or somewhere in the text, of a JSXElement with no closing tag.
package/lib/typescript.js CHANGED
@@ -42,7 +42,7 @@ var ts = (() => {
42
42
  "src/compiler/corePublic.ts"() {
43
43
  "use strict";
44
44
  versionMajorMinor = "5.0";
45
- version = `${versionMajorMinor}.0-dev.20230123`;
45
+ version = `${versionMajorMinor}.0-dev.20230126`;
46
46
  Comparison = /* @__PURE__ */ ((Comparison3) => {
47
47
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
48
48
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -13247,6 +13247,20 @@ ${lanes.join("\n")}
13247
13247
  BigUint64Array: ["at"],
13248
13248
  ObjectConstructor: ["hasOwn"],
13249
13249
  Error: ["cause"]
13250
+ },
13251
+ es2023: {
13252
+ Array: ["findLastIndex", "findLast"],
13253
+ Int8Array: ["findLastIndex", "findLast"],
13254
+ Uint8Array: ["findLastIndex", "findLast"],
13255
+ Uint8ClampedArray: ["findLastIndex", "findLast"],
13256
+ Int16Array: ["findLastIndex", "findLast"],
13257
+ Uint16Array: ["findLastIndex", "findLast"],
13258
+ Int32Array: ["findLastIndex", "findLast"],
13259
+ Uint32Array: ["findLastIndex", "findLast"],
13260
+ Float32Array: ["findLastIndex", "findLast"],
13261
+ Float64Array: ["findLastIndex", "findLast"],
13262
+ BigInt64Array: ["findLastIndex", "findLast"],
13263
+ BigUint64Array: ["findLastIndex", "findLast"]
13250
13264
  }
13251
13265
  };
13252
13266
  }
@@ -48708,7 +48722,7 @@ ${lanes.join("\n")}
48708
48722
  return writer ? symbolToStringWorker(writer).getText() : usingSingleLineStringWriter(symbolToStringWorker);
48709
48723
  function symbolToStringWorker(writer2) {
48710
48724
  const entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags);
48711
- const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 308 /* SourceFile */ ? createPrinter({ removeComments: true, neverAsciiEscape: true }) : createPrinter({ removeComments: true });
48725
+ const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 308 /* SourceFile */ ? createPrinterWithRemoveCommentsNeverAsciiEscape() : createPrinterWithRemoveComments();
48712
48726
  const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
48713
48727
  printer.writeNode(
48714
48728
  4 /* Unspecified */,
@@ -48730,7 +48744,7 @@ ${lanes.join("\n")}
48730
48744
  sigOutput = kind === 1 /* Construct */ ? 177 /* ConstructSignature */ : 176 /* CallSignature */;
48731
48745
  }
48732
48746
  const sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */);
48733
- const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true });
48747
+ const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
48734
48748
  const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
48735
48749
  printer.writeNode(
48736
48750
  4 /* Unspecified */,
@@ -48747,8 +48761,7 @@ ${lanes.join("\n")}
48747
48761
  const typeNode = nodeBuilder.typeToTypeNode(type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0));
48748
48762
  if (typeNode === void 0)
48749
48763
  return Debug.fail("should always get typenode");
48750
- const options = { removeComments: type !== unresolvedType };
48751
- const printer = createPrinter(options);
48764
+ const printer = type !== unresolvedType ? createPrinterWithRemoveComments() : createPrinterWithDefaults();
48752
48765
  const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
48753
48766
  printer.writeNode(
48754
48767
  4 /* Unspecified */,
@@ -52099,7 +52112,7 @@ ${lanes.join("\n")}
52099
52112
  typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */)
52100
52113
  // TODO: GH#18217
52101
52114
  );
52102
- const printer = createPrinter({ removeComments: true });
52115
+ const printer = createPrinterWithRemoveComments();
52103
52116
  const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
52104
52117
  printer.writeNode(
52105
52118
  4 /* Unspecified */,
@@ -67127,7 +67140,7 @@ ${lanes.join("\n")}
67127
67140
  return getNonMissingTypeOfSymbol(symbol);
67128
67141
  }
67129
67142
  function getControlFlowContainer(node) {
67130
- return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 265 /* ModuleBlock */ || node2.kind === 308 /* SourceFile */ || node2.kind === 295 /* CatchClause */ || node2.kind === 169 /* PropertyDeclaration */);
67143
+ return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 265 /* ModuleBlock */ || node2.kind === 308 /* SourceFile */ || node2.kind === 169 /* PropertyDeclaration */);
67131
67144
  }
67132
67145
  function isSymbolAssigned(symbol) {
67133
67146
  if (!symbol.valueDeclaration) {
@@ -67388,14 +67401,13 @@ ${lanes.join("\n")}
67388
67401
  const isParameter2 = getRootDeclaration(declaration).kind === 166 /* Parameter */;
67389
67402
  const declarationContainer = getControlFlowContainer(declaration);
67390
67403
  let flowContainer = getControlFlowContainer(node);
67391
- const isCatch = flowContainer.kind === 295 /* CatchClause */;
67392
67404
  const isOuterVariable = flowContainer !== declarationContainer;
67393
67405
  const isSpreadDestructuringAssignmentTarget = node.parent && node.parent.parent && isSpreadAssignment(node.parent) && isDestructuringAssignmentTarget(node.parent.parent);
67394
67406
  const isModuleExports = symbol.flags & 134217728 /* ModuleExports */;
67395
67407
  while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* FunctionExpression */ || flowContainer.kind === 216 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) {
67396
67408
  flowContainer = getControlFlowContainer(flowContainer);
67397
67409
  }
67398
- const assumeInitialized = isParameter2 || isCatch || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
67410
+ const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
67399
67411
  const initialType = assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : type === autoType || type === autoArrayType ? undefinedType : getOptionalType(type);
67400
67412
  const flowType = getFlowTypeOfReference(node, type, initialType, flowContainer);
67401
67413
  if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {
@@ -80655,7 +80667,7 @@ ${lanes.join("\n")}
80655
80667
  if (typeAnnotationNode) {
80656
80668
  checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression);
80657
80669
  }
80658
- const isIllegalExportDefaultInCJS = !node.isExportEquals && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
80670
+ const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
80659
80671
  if (node.expression.kind === 79 /* Identifier */) {
80660
80672
  const id = node.expression;
80661
80673
  const sym = resolveEntityName(
@@ -113784,7 +113796,7 @@ ${lanes.join("\n")}
113784
113796
  function getEmitListItem(emit, parenthesizerRule) {
113785
113797
  return emit.length === 1 ? emitListItemNoParenthesizer : typeof parenthesizerRule === "object" ? emitListItemWithParenthesizerRuleSelector : emitListItemWithParenthesizerRule;
113786
113798
  }
113787
- var brackets, notImplementedResolver, TempFlags;
113799
+ var brackets, notImplementedResolver, createPrinterWithDefaults, createPrinterWithRemoveComments, createPrinterWithRemoveCommentsNeverAsciiEscape, createPrinterWithRemoveCommentsOmitTrailingSemicolon, TempFlags;
113788
113800
  var init_emitter = __esm({
113789
113801
  "src/compiler/emitter.ts"() {
113790
113802
  "use strict";
@@ -113835,6 +113847,10 @@ ${lanes.join("\n")}
113835
113847
  getDeclarationStatementsForSourceFile: notImplemented,
113836
113848
  isImportRequiredByAugmentation: notImplemented
113837
113849
  };
113850
+ createPrinterWithDefaults = memoize(() => createPrinter({}));
113851
+ createPrinterWithRemoveComments = memoize(() => createPrinter({ removeComments: true }));
113852
+ createPrinterWithRemoveCommentsNeverAsciiEscape = memoize(() => createPrinter({ removeComments: true, neverAsciiEscape: true }));
113853
+ createPrinterWithRemoveCommentsOmitTrailingSemicolon = memoize(() => createPrinter({ removeComments: true, omitTrailingSemicolon: true }));
113838
113854
  TempFlags = /* @__PURE__ */ ((TempFlags2) => {
113839
113855
  TempFlags2[TempFlags2["Auto"] = 0] = "Auto";
113840
113856
  TempFlags2[TempFlags2["CountMask"] = 268435455] = "CountMask";
@@ -126903,7 +126919,7 @@ ${lanes.join("\n")}
126903
126919
  function nodeToDisplayParts(node, enclosingDeclaration) {
126904
126920
  const file = enclosingDeclaration.getSourceFile();
126905
126921
  return mapToDisplayParts((writer) => {
126906
- const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true });
126922
+ const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
126907
126923
  printer.writeNode(4 /* Unspecified */, node, file, writer);
126908
126924
  });
126909
126925
  }
@@ -132757,12 +132773,9 @@ ${lanes.join("\n")}
132757
132773
  Debug.assertEqual(action.type, "install package");
132758
132774
  return host.installPackage ? host.installPackage({ fileName: getPath(action.file), packageName: action.packageName }) : Promise.reject("Host does not implement `installPackage`");
132759
132775
  }
132760
- function getDocCommentTemplateAtPosition2(fileName, position, options) {
132761
- return ts_JsDoc_exports.getDocCommentTemplateAtPosition(getNewLineOrDefaultFromHost(
132762
- host,
132763
- /*formatSettings*/
132764
- void 0
132765
- ), syntaxTreeCache.getCurrentSourceFile(fileName), position, options);
132776
+ function getDocCommentTemplateAtPosition2(fileName, position, options, formatOptions) {
132777
+ const formatSettings = formatOptions ? ts_formatting_exports.getFormatContext(formatOptions, host).options : void 0;
132778
+ return ts_JsDoc_exports.getDocCommentTemplateAtPosition(getNewLineOrDefaultFromHost(host, formatSettings), syntaxTreeCache.getCurrentSourceFile(fileName), position, options);
132766
132779
  }
132767
132780
  function isValidBraceCompletionAtPosition(fileName, position, openingBrace) {
132768
132781
  if (openingBrace === 60 /* lessThan */) {
@@ -134634,10 +134647,10 @@ ${lanes.join("\n")}
134634
134647
  }
134635
134648
  );
134636
134649
  }
134637
- getDocCommentTemplateAtPosition(fileName, position, options) {
134650
+ getDocCommentTemplateAtPosition(fileName, position, options, formatOptions) {
134638
134651
  return this.forwardJSONCall(
134639
134652
  `getDocCommentTemplateAtPosition('${fileName}', ${position})`,
134640
- () => this.languageService.getDocCommentTemplateAtPosition(fileName, position, options)
134653
+ () => this.languageService.getDocCommentTemplateAtPosition(fileName, position, options, formatOptions)
134641
134654
  );
134642
134655
  }
134643
134656
  /// NAVIGATE TO
@@ -135531,7 +135544,7 @@ ${lanes.join("\n")}
135531
135544
  }
135532
135545
  }
135533
135546
  if (text === void 0) {
135534
- const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true });
135547
+ const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
135535
135548
  text = usingSingleLineStringWriter((writer) => printer.writeNode(4 /* Unspecified */, node, node.getSourceFile(), writer));
135536
135549
  }
135537
135550
  return { text, pos: declName.getStart(), end: declName.getEnd() };
@@ -142536,7 +142549,7 @@ ${lanes.join("\n")}
142536
142549
  Diagnostics.Delete_all_unused_param_tags
142537
142550
  );
142538
142551
  }
142539
- function getRenameAction(context, { name, signature, jsDocParameterTag }) {
142552
+ function getRenameAction(context, { name, jsDocHost, signature, jsDocParameterTag }) {
142540
142553
  if (!length(signature.parameters))
142541
142554
  return void 0;
142542
142555
  const sourceFile = context.sourceFile;
@@ -142559,7 +142572,7 @@ ${lanes.join("\n")}
142559
142572
  jsDocParameterTag.isNameFirst,
142560
142573
  jsDocParameterTag.comment
142561
142574
  );
142562
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) => changeTracker.replaceJSDocComment(sourceFile, signature, map(tags, (t) => t === jsDocParameterTag ? newJSDocParameterTag : t)));
142575
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) => changeTracker.replaceJSDocComment(sourceFile, jsDocHost, map(tags, (t) => t === jsDocParameterTag ? newJSDocParameterTag : t)));
142563
142576
  return createCodeFixActionWithoutFixAll(renameUnmatchedParameter, changes, [Diagnostics.Rename_param_tag_name_0_to_1, name.getText(sourceFile), parameterName]);
142564
142577
  }
142565
142578
  function getInfo10(sourceFile, pos) {
@@ -154012,8 +154025,7 @@ ${lanes.join("\n")}
154012
154025
  }
154013
154026
  function printTypeInSingleLine(type) {
154014
154027
  const flags = 70221824 /* IgnoreErrors */ | 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
154015
- const options = { removeComments: true };
154016
- const printer = createPrinter(options);
154028
+ const printer = createPrinterWithRemoveComments();
154017
154029
  return usingSingleLineStringWriter((writer) => {
154018
154030
  const typeNode = checker.typeToTypeNode(
154019
154031
  type,
@@ -154429,6 +154441,8 @@ ${lanes.join("\n")}
154429
154441
  "lends",
154430
154442
  "license",
154431
154443
  "link",
154444
+ "linkcode",
154445
+ "linkplain",
154432
154446
  "listens",
154433
154447
  "member",
154434
154448
  "memberof",
@@ -154441,6 +154455,7 @@ ${lanes.join("\n")}
154441
154455
  "package",
154442
154456
  "param",
154443
154457
  "private",
154458
+ "prop",
154444
154459
  "property",
154445
154460
  "protected",
154446
154461
  "public",
@@ -161185,7 +161200,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
161185
161200
  }
161186
161201
  function getTypeHelpItem(symbol, typeParameters, checker, enclosingDeclaration, sourceFile) {
161187
161202
  const typeSymbolDisplay = symbolToDisplayParts(checker, symbol);
161188
- const printer = createPrinter({ removeComments: true });
161203
+ const printer = createPrinterWithRemoveComments();
161189
161204
  const parameters = typeParameters.map((t) => createSignatureHelpParameterForTypeParameter(t, checker, enclosingDeclaration, sourceFile, printer));
161190
161205
  const documentation = symbol.getDocumentationComment(checker);
161191
161206
  const tags = symbol.getJsDocTags(checker);
@@ -161228,7 +161243,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
161228
161243
  }
161229
161244
  function itemInfoForTypeParameters(candidateSignature, checker, enclosingDeclaration, sourceFile) {
161230
161245
  const typeParameters = (candidateSignature.target || candidateSignature).typeParameters;
161231
- const printer = createPrinter({ removeComments: true });
161246
+ const printer = createPrinterWithRemoveComments();
161232
161247
  const parameters = (typeParameters || emptyArray).map((t) => createSignatureHelpParameterForTypeParameter(t, checker, enclosingDeclaration, sourceFile, printer));
161233
161248
  const thisParameter = candidateSignature.thisParameter ? [checker.symbolToParameterDeclaration(candidateSignature.thisParameter, enclosingDeclaration, signatureHelpNodeBuilderFlags)] : [];
161234
161249
  return checker.getExpandedParameters(candidateSignature).map((paramList) => {
@@ -161240,7 +161255,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
161240
161255
  });
161241
161256
  }
161242
161257
  function itemInfoForParameters(candidateSignature, checker, enclosingDeclaration, sourceFile) {
161243
- const printer = createPrinter({ removeComments: true });
161258
+ const printer = createPrinterWithRemoveComments();
161244
161259
  const typeParameterParts = mapToDisplayParts((writer) => {
161245
161260
  if (candidateSignature.typeParameters && candidateSignature.typeParameters.length) {
161246
161261
  const args = factory.createNodeArray(candidateSignature.typeParameters.map((p) => checker.typeParameterToDeclaration(p, enclosingDeclaration, signatureHelpNodeBuilderFlags)));
@@ -161646,7 +161661,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
161646
161661
  let hasAddedSymbolInfo = false;
161647
161662
  const isThisExpression = location.kind === 108 /* ThisKeyword */ && isInExpressionContext(location) || isThisInTypeQuery(location);
161648
161663
  let type;
161649
- let printer;
161650
161664
  let documentationFromAlias;
161651
161665
  let tagsFromAlias;
161652
161666
  let hasMultipleSignatures = false;
@@ -162039,10 +162053,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
162039
162053
  }
162040
162054
  return { displayParts, documentation, symbolKind, tags: tags.length === 0 ? void 0 : tags };
162041
162055
  function getPrinter() {
162042
- if (!printer) {
162043
- printer = createPrinter({ removeComments: true });
162044
- }
162045
- return printer;
162056
+ return createPrinterWithRemoveComments();
162046
162057
  }
162047
162058
  function prefixNextMeaning() {
162048
162059
  if (displayParts.length) {
@@ -166920,6 +166931,10 @@ ${options.prefix}` : "\n" : options.prefix
166920
166931
  createPatternMatcher: () => createPatternMatcher,
166921
166932
  createPrependNodes: () => createPrependNodes,
166922
166933
  createPrinter: () => createPrinter,
166934
+ createPrinterWithDefaults: () => createPrinterWithDefaults,
166935
+ createPrinterWithRemoveComments: () => createPrinterWithRemoveComments,
166936
+ createPrinterWithRemoveCommentsNeverAsciiEscape: () => createPrinterWithRemoveCommentsNeverAsciiEscape,
166937
+ createPrinterWithRemoveCommentsOmitTrailingSemicolon: () => createPrinterWithRemoveCommentsOmitTrailingSemicolon,
166923
166938
  createProgram: () => createProgram,
166924
166939
  createProgramHost: () => createProgramHost,
166925
166940
  createPropertyNameNodeForIdentifierOrLiteral: () => createPropertyNameNodeForIdentifierOrLiteral,