typescript 5.9.1-rc → 5.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/_tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.9";
21
- var version = "5.9.1-rc";
21
+ var version = "5.9.3";
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -20254,10 +20254,22 @@ function createParenthesizerRules(factory2) {
20254
20254
  }
20255
20255
  return parenthesizerRule;
20256
20256
  }
20257
+ function mixingBinaryOperatorsRequiresParentheses(a, b) {
20258
+ if (a === 61 /* QuestionQuestionToken */) {
20259
+ return b === 56 /* AmpersandAmpersandToken */ || b === 57 /* BarBarToken */;
20260
+ }
20261
+ if (b === 61 /* QuestionQuestionToken */) {
20262
+ return a === 56 /* AmpersandAmpersandToken */ || a === 57 /* BarBarToken */;
20263
+ }
20264
+ return false;
20265
+ }
20257
20266
  function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {
20267
+ const emittedOperand = skipPartiallyEmittedExpressions(operand);
20268
+ if (isBinaryExpression(emittedOperand) && mixingBinaryOperatorsRequiresParentheses(binaryOperator, emittedOperand.operatorToken.kind)) {
20269
+ return true;
20270
+ }
20258
20271
  const binaryOperatorPrecedence = getOperatorPrecedence(227 /* BinaryExpression */, binaryOperator);
20259
20272
  const binaryOperatorAssociativity = getOperatorAssociativity(227 /* BinaryExpression */, binaryOperator);
20260
- const emittedOperand = skipPartiallyEmittedExpressions(operand);
20261
20273
  if (!isLeftSideOfBinary && operand.kind === 220 /* ArrowFunction */ && binaryOperatorPrecedence > 3 /* Assignment */) {
20262
20274
  return true;
20263
20275
  }
@@ -53296,7 +53308,22 @@ function createTypeChecker(host) {
53296
53308
  function getPropertyNameNodeForSymbol(symbol, context) {
53297
53309
  const hashPrivateName = getClonedHashPrivateName(symbol);
53298
53310
  if (hashPrivateName) {
53299
- return hashPrivateName;
53311
+ const shouldEmitErroneousFieldName = !!context.tracker.reportPrivateInBaseOfClassExpression && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */;
53312
+ if (!shouldEmitErroneousFieldName) {
53313
+ return hashPrivateName;
53314
+ } else {
53315
+ let rawName2 = unescapeLeadingUnderscores(symbol.escapedName);
53316
+ rawName2 = rawName2.replace(/__#\d+@#/g, "__#private@#");
53317
+ return createPropertyNameNodeForIdentifierOrLiteral(
53318
+ rawName2,
53319
+ getEmitScriptTarget(compilerOptions),
53320
+ /*singleQuote*/
53321
+ false,
53322
+ /*stringNamed*/
53323
+ true,
53324
+ !!(symbol.flags & 8192 /* Method */)
53325
+ );
53326
+ }
53300
53327
  }
53301
53328
  const stringNamed = !!length(symbol.declarations) && every(symbol.declarations, isStringNamed);
53302
53329
  const singleQuote = !!length(symbol.declarations) && every(symbol.declarations, isSingleQuotedStringNamed);
@@ -124188,10 +124215,9 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
124188
124215
  }
124189
124216
  const getCommonSourceDirectory3 = memoize(() => getCommonSourceDirectoryOfConfig(resolvedRef.commandLine, !host.useCaseSensitiveFileNames()));
124190
124217
  commandLine.fileNames.forEach((fileName) => {
124191
- if (isDeclarationFileName(fileName)) return;
124192
124218
  const path = toPath3(fileName);
124193
124219
  let outputDts;
124194
- if (!fileExtensionIs(fileName, ".json" /* Json */)) {
124220
+ if (!isDeclarationFileName(fileName) && !fileExtensionIs(fileName, ".json" /* Json */)) {
124195
124221
  if (!commandLine.options.outFile) {
124196
124222
  outputDts = getOutputDeclarationFileName(fileName, resolvedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory3);
124197
124223
  mapOutputFileToResolvedRef.set(toPath3(outputDts), { resolvedRef, source: fileName });
@@ -374,6 +374,8 @@ interface Float16ArrayConstructor {
374
374
  new (length?: number): Float16Array<ArrayBuffer>;
375
375
  new (array: ArrayLike<number> | Iterable<number>): Float16Array<ArrayBuffer>;
376
376
  new <TArrayBuffer extends ArrayBufferLike = ArrayBuffer>(buffer: TArrayBuffer, byteOffset?: number, length?: number): Float16Array<TArrayBuffer>;
377
+ new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float16Array<ArrayBuffer>;
378
+ new (array: ArrayLike<number> | ArrayBuffer): Float16Array<ArrayBuffer>;
377
379
 
378
380
  /**
379
381
  * The size in bytes of each element in the array.
@@ -5907,7 +5907,6 @@ declare namespace ts {
5907
5907
  */
5908
5908
  interface SourceFileLike {
5909
5909
  readonly text: string;
5910
- languageVariant?: LanguageVariant;
5911
5910
  }
5912
5911
  interface SourceFileLike {
5913
5912
  getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
package/lib/typescript.js CHANGED
@@ -2285,7 +2285,7 @@ module.exports = __toCommonJS(typescript_exports);
2285
2285
 
2286
2286
  // src/compiler/corePublic.ts
2287
2287
  var versionMajorMinor = "5.9";
2288
- var version = "5.9.1-rc";
2288
+ var version = "5.9.3";
2289
2289
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2290
2290
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2291
2291
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6790,10 +6790,10 @@ var ScriptTarget = /* @__PURE__ */ ((ScriptTarget12) => {
6790
6790
  ScriptTarget12[ScriptTarget12["Latest"] = 99 /* ESNext */] = "Latest";
6791
6791
  return ScriptTarget12;
6792
6792
  })(ScriptTarget || {});
6793
- var LanguageVariant = /* @__PURE__ */ ((LanguageVariant3) => {
6794
- LanguageVariant3[LanguageVariant3["Standard"] = 0] = "Standard";
6795
- LanguageVariant3[LanguageVariant3["JSX"] = 1] = "JSX";
6796
- return LanguageVariant3;
6793
+ var LanguageVariant = /* @__PURE__ */ ((LanguageVariant4) => {
6794
+ LanguageVariant4[LanguageVariant4["Standard"] = 0] = "Standard";
6795
+ LanguageVariant4[LanguageVariant4["JSX"] = 1] = "JSX";
6796
+ return LanguageVariant4;
6797
6797
  })(LanguageVariant || {});
6798
6798
  var WatchDirectoryFlags = /* @__PURE__ */ ((WatchDirectoryFlags3) => {
6799
6799
  WatchDirectoryFlags3[WatchDirectoryFlags3["None"] = 0] = "None";
@@ -24351,10 +24351,22 @@ function createParenthesizerRules(factory2) {
24351
24351
  }
24352
24352
  return parenthesizerRule;
24353
24353
  }
24354
+ function mixingBinaryOperatorsRequiresParentheses(a, b) {
24355
+ if (a === 61 /* QuestionQuestionToken */) {
24356
+ return b === 56 /* AmpersandAmpersandToken */ || b === 57 /* BarBarToken */;
24357
+ }
24358
+ if (b === 61 /* QuestionQuestionToken */) {
24359
+ return a === 56 /* AmpersandAmpersandToken */ || a === 57 /* BarBarToken */;
24360
+ }
24361
+ return false;
24362
+ }
24354
24363
  function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {
24364
+ const emittedOperand = skipPartiallyEmittedExpressions(operand);
24365
+ if (isBinaryExpression(emittedOperand) && mixingBinaryOperatorsRequiresParentheses(binaryOperator, emittedOperand.operatorToken.kind)) {
24366
+ return true;
24367
+ }
24355
24368
  const binaryOperatorPrecedence = getOperatorPrecedence(227 /* BinaryExpression */, binaryOperator);
24356
24369
  const binaryOperatorAssociativity = getOperatorAssociativity(227 /* BinaryExpression */, binaryOperator);
24357
- const emittedOperand = skipPartiallyEmittedExpressions(operand);
24358
24370
  if (!isLeftSideOfBinary && operand.kind === 220 /* ArrowFunction */ && binaryOperatorPrecedence > 3 /* Assignment */) {
24359
24371
  return true;
24360
24372
  }
@@ -57907,7 +57919,22 @@ function createTypeChecker(host) {
57907
57919
  function getPropertyNameNodeForSymbol(symbol, context) {
57908
57920
  const hashPrivateName = getClonedHashPrivateName(symbol);
57909
57921
  if (hashPrivateName) {
57910
- return hashPrivateName;
57922
+ const shouldEmitErroneousFieldName = !!context.tracker.reportPrivateInBaseOfClassExpression && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */;
57923
+ if (!shouldEmitErroneousFieldName) {
57924
+ return hashPrivateName;
57925
+ } else {
57926
+ let rawName2 = unescapeLeadingUnderscores(symbol.escapedName);
57927
+ rawName2 = rawName2.replace(/__#\d+@#/g, "__#private@#");
57928
+ return createPropertyNameNodeForIdentifierOrLiteral(
57929
+ rawName2,
57930
+ getEmitScriptTarget(compilerOptions),
57931
+ /*singleQuote*/
57932
+ false,
57933
+ /*stringNamed*/
57934
+ true,
57935
+ !!(symbol.flags & 8192 /* Method */)
57936
+ );
57937
+ }
57911
57938
  }
57912
57939
  const stringNamed = !!length(symbol.declarations) && every(symbol.declarations, isStringNamed);
57913
57940
  const singleQuote = !!length(symbol.declarations) && every(symbol.declarations, isSingleQuotedStringNamed);
@@ -129038,10 +129065,9 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
129038
129065
  }
129039
129066
  const getCommonSourceDirectory3 = memoize(() => getCommonSourceDirectoryOfConfig(resolvedRef.commandLine, !host.useCaseSensitiveFileNames()));
129040
129067
  commandLine.fileNames.forEach((fileName) => {
129041
- if (isDeclarationFileName(fileName)) return;
129042
129068
  const path = toPath3(fileName);
129043
129069
  let outputDts;
129044
- if (!fileExtensionIs(fileName, ".json" /* Json */)) {
129070
+ if (!isDeclarationFileName(fileName) && !fileExtensionIs(fileName, ".json" /* Json */)) {
129045
129071
  if (!commandLine.options.outFile) {
129046
129072
  outputDts = getOutputDeclarationFileName(fileName, resolvedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory3);
129047
129073
  mapOutputFileToResolvedRef.set(toPath3(outputDts), { resolvedRef, source: fileName });
@@ -140403,7 +140429,7 @@ function isInsideJsxElementOrAttribute(sourceFile, position) {
140403
140429
  if (token && token.kind === 20 /* CloseBraceToken */ && token.parent.kind === 295 /* JsxExpression */) {
140404
140430
  return true;
140405
140431
  }
140406
- if (token.kind === 31 /* LessThanSlashToken */ && token.parent.kind === 288 /* JsxClosingElement */) {
140432
+ if (token.kind === 30 /* LessThanToken */ && token.parent.kind === 288 /* JsxClosingElement */) {
140407
140433
  return true;
140408
140434
  }
140409
140435
  return false;
@@ -140431,7 +140457,7 @@ function isInJSXText(sourceFile, position) {
140431
140457
  function isInsideJsxElement(sourceFile, position) {
140432
140458
  function isInsideJsxElementTraversal(node) {
140433
140459
  while (node) {
140434
- if (node.kind >= 286 /* JsxSelfClosingElement */ && node.kind <= 295 /* JsxExpression */ || node.kind === 12 /* JsxText */ || node.kind === 30 /* LessThanToken */ || node.kind === 32 /* GreaterThanToken */ || node.kind === 80 /* Identifier */ || node.kind === 20 /* CloseBraceToken */ || node.kind === 19 /* OpenBraceToken */ || node.kind === 44 /* SlashToken */ || node.kind === 31 /* LessThanSlashToken */) {
140460
+ if (node.kind >= 286 /* JsxSelfClosingElement */ && node.kind <= 295 /* JsxExpression */ || node.kind === 12 /* JsxText */ || node.kind === 30 /* LessThanToken */ || node.kind === 32 /* GreaterThanToken */ || node.kind === 80 /* Identifier */ || node.kind === 20 /* CloseBraceToken */ || node.kind === 19 /* OpenBraceToken */ || node.kind === 44 /* SlashToken */) {
140435
140461
  node = node.parent;
140436
140462
  } else if (node.kind === 285 /* JsxElement */) {
140437
140463
  if (position > node.getStart(sourceFile)) return true;
@@ -151873,9 +151899,7 @@ function createChildren(node, sourceFile) {
151873
151899
  });
151874
151900
  return children;
151875
151901
  }
151876
- const languageVariant = (sourceFile == null ? void 0 : sourceFile.languageVariant) ?? 0 /* Standard */;
151877
151902
  scanner.setText((sourceFile || node.getSourceFile()).text);
151878
- scanner.setLanguageVariant(languageVariant);
151879
151903
  let pos = node.pos;
151880
151904
  const processNode = (child) => {
151881
151905
  addSyntheticNodes(children, pos, child.pos, node);
@@ -151892,7 +151916,6 @@ function createChildren(node, sourceFile) {
151892
151916
  node.forEachChild(processNode, processNodes);
151893
151917
  addSyntheticNodes(children, pos, node.end, node);
151894
151918
  scanner.setText(void 0);
151895
- scanner.setLanguageVariant(0 /* Standard */);
151896
151919
  return children;
151897
151920
  }
151898
151921
  function addSyntheticNodes(nodes, pos, end, parent2) {
@@ -167606,7 +167629,7 @@ function getJsxClosingTagCompletion(location, sourceFile) {
167606
167629
  switch (node.kind) {
167607
167630
  case 288 /* JsxClosingElement */:
167608
167631
  return true;
167609
- case 31 /* LessThanSlashToken */:
167632
+ case 44 /* SlashToken */:
167610
167633
  case 32 /* GreaterThanToken */:
167611
167634
  case 80 /* Identifier */:
167612
167635
  case 212 /* PropertyAccessExpression */:
@@ -168942,7 +168965,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
168942
168965
  location = currentToken;
168943
168966
  }
168944
168967
  break;
168945
- case 31 /* LessThanSlashToken */:
168968
+ case 44 /* SlashToken */:
168946
168969
  if (currentToken.parent.kind === 286 /* JsxSelfClosingElement */) {
168947
168970
  location = currentToken;
168948
168971
  }
@@ -168951,7 +168974,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
168951
168974
  }
168952
168975
  switch (parent2.kind) {
168953
168976
  case 288 /* JsxClosingElement */:
168954
- if (contextToken.kind === 31 /* LessThanSlashToken */) {
168977
+ if (contextToken.kind === 44 /* SlashToken */) {
168955
168978
  isStartingCloseTag = true;
168956
168979
  location = contextToken;
168957
168980
  }
@@ -170572,7 +170595,7 @@ function isValidTrigger(sourceFile, triggerCharacter, contextToken, position) {
170572
170595
  case "<":
170573
170596
  return !!contextToken && contextToken.kind === 30 /* LessThanToken */ && (!isBinaryExpression(contextToken.parent) || binaryExpressionMayBeOpenTag(contextToken.parent));
170574
170597
  case "/":
170575
- return !!contextToken && (isStringLiteralLike(contextToken) ? !!tryGetImportFromModuleSpecifier(contextToken) : contextToken.kind === 31 /* LessThanSlashToken */ && isJsxClosingElement(contextToken.parent));
170598
+ return !!contextToken && (isStringLiteralLike(contextToken) ? !!tryGetImportFromModuleSpecifier(contextToken) : contextToken.kind === 44 /* SlashToken */ && isJsxClosingElement(contextToken.parent));
170576
170599
  case " ":
170577
170600
  return !!contextToken && isImportKeyword(contextToken) && contextToken.parent.kind === 308 /* SourceFile */;
170578
170601
  default:
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.9.1-rc",
5
+ "version": "5.9.3",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -116,5 +116,5 @@
116
116
  "node": "20.1.0",
117
117
  "npm": "8.19.4"
118
118
  },
119
- "gitHead": "ad825f2bee3362886d642c48cb97c82df82b3ddb"
119
+ "gitHead": "c63de15a992d37f0d6cec03ac7631872838602cb"
120
120
  }