typescript 5.0.0-dev.20230125 → 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.
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.20230125`;
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
  }
@@ -135528,7 +135544,7 @@ ${lanes.join("\n")}
135528
135544
  }
135529
135545
  }
135530
135546
  if (text === void 0) {
135531
- const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true });
135547
+ const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
135532
135548
  text = usingSingleLineStringWriter((writer) => printer.writeNode(4 /* Unspecified */, node, node.getSourceFile(), writer));
135533
135549
  }
135534
135550
  return { text, pos: declName.getStart(), end: declName.getEnd() };
@@ -142533,7 +142549,7 @@ ${lanes.join("\n")}
142533
142549
  Diagnostics.Delete_all_unused_param_tags
142534
142550
  );
142535
142551
  }
142536
- function getRenameAction(context, { name, signature, jsDocParameterTag }) {
142552
+ function getRenameAction(context, { name, jsDocHost, signature, jsDocParameterTag }) {
142537
142553
  if (!length(signature.parameters))
142538
142554
  return void 0;
142539
142555
  const sourceFile = context.sourceFile;
@@ -142556,7 +142572,7 @@ ${lanes.join("\n")}
142556
142572
  jsDocParameterTag.isNameFirst,
142557
142573
  jsDocParameterTag.comment
142558
142574
  );
142559
- 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)));
142560
142576
  return createCodeFixActionWithoutFixAll(renameUnmatchedParameter, changes, [Diagnostics.Rename_param_tag_name_0_to_1, name.getText(sourceFile), parameterName]);
142561
142577
  }
142562
142578
  function getInfo10(sourceFile, pos) {
@@ -154009,8 +154025,7 @@ ${lanes.join("\n")}
154009
154025
  }
154010
154026
  function printTypeInSingleLine(type) {
154011
154027
  const flags = 70221824 /* IgnoreErrors */ | 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
154012
- const options = { removeComments: true };
154013
- const printer = createPrinter(options);
154028
+ const printer = createPrinterWithRemoveComments();
154014
154029
  return usingSingleLineStringWriter((writer) => {
154015
154030
  const typeNode = checker.typeToTypeNode(
154016
154031
  type,
@@ -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,