typescript 5.9.0-dev.20250624 → 5.9.0-dev.20250626

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 = `${versionMajorMinor}.0-dev.20250624`;
21
+ var version = `${versionMajorMinor}.0-dev.20250626`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -17198,8 +17198,14 @@ function base64encode(host, input) {
17198
17198
  function readJsonOrUndefined(path, hostOrText) {
17199
17199
  const jsonText = isString(hostOrText) ? hostOrText : hostOrText.readFile(path);
17200
17200
  if (!jsonText) return void 0;
17201
- const result = parseConfigFileTextToJson(path, jsonText);
17202
- return !result.error ? result.config : void 0;
17201
+ let result = tryParseJson(jsonText);
17202
+ if (result === void 0) {
17203
+ const looseResult = parseConfigFileTextToJson(path, jsonText);
17204
+ if (!looseResult.error) {
17205
+ result = looseResult.config;
17206
+ }
17207
+ }
17208
+ return result;
17203
17209
  }
17204
17210
  function readJson(path, host) {
17205
17211
  return readJsonOrUndefined(path, host) || {};
@@ -31211,6 +31217,7 @@ var Parser;
31211
31217
  /*skipKeyword*/
31212
31218
  true
31213
31219
  );
31220
+ parseOptional(28 /* CommaToken */);
31214
31221
  if (!parseExpected(20 /* CloseBraceToken */)) {
31215
31222
  const lastError = lastOrUndefined(parseDiagnostics);
31216
31223
  if (lastError && lastError.code === Diagnostics._0_expected.code) {
@@ -67432,9 +67439,13 @@ function createTypeChecker(host) {
67432
67439
  return types[0];
67433
67440
  }
67434
67441
  const primaryTypes = strictNullChecks ? sameMap(types, (t) => filterType(t, (u) => !(u.flags & 98304 /* Nullable */))) : types;
67435
- const superTypeOrUnion = literalTypesWithSameBaseType(primaryTypes) ? getUnionType(primaryTypes) : reduceLeft(primaryTypes, (s, t) => isTypeSubtypeOf(s, t) ? t : s);
67442
+ const superTypeOrUnion = literalTypesWithSameBaseType(primaryTypes) ? getUnionType(primaryTypes) : getSingleCommonSupertype(primaryTypes);
67436
67443
  return primaryTypes === types ? superTypeOrUnion : getNullableType(superTypeOrUnion, getCombinedTypeFlags(types) & 98304 /* Nullable */);
67437
67444
  }
67445
+ function getSingleCommonSupertype(types) {
67446
+ const candidate = reduceLeft(types, (s, t) => isTypeStrictSubtypeOf(s, t) ? t : s);
67447
+ return every(types, (t) => t === candidate || isTypeStrictSubtypeOf(t, candidate)) ? candidate : reduceLeft(types, (s, t) => isTypeSubtypeOf(s, t) ? t : s);
67448
+ }
67438
67449
  function getCommonSubtype(types) {
67439
67450
  return reduceLeft(types, (s, t) => isTypeSubtypeOf(t, s) ? t : s);
67440
67451
  }
@@ -89848,7 +89859,7 @@ function createTypeChecker(host) {
89848
89859
  if (languageVersion < 2 /* ES2015 */ && isPrivateIdentifier(node.name)) {
89849
89860
  return grammarErrorOnNode(node.name, Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher);
89850
89861
  }
89851
- if (languageVersion < 2 /* ES2015 */ && isAutoAccessorPropertyDeclaration(node)) {
89862
+ if (languageVersion < 2 /* ES2015 */ && isAutoAccessorPropertyDeclaration(node) && !(node.flags & 33554432 /* Ambient */)) {
89852
89863
  return grammarErrorOnNode(node.name, Diagnostics.Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher);
89853
89864
  }
89854
89865
  if (isAutoAccessorPropertyDeclaration(node) && checkGrammarForInvalidQuestionMark(node.questionToken, Diagnostics.An_accessor_property_cannot_be_declared_optional)) {
@@ -89933,7 +89944,7 @@ function createTypeChecker(host) {
89933
89944
  function checkGrammarBigIntLiteral(node) {
89934
89945
  const literalType = isLiteralTypeNode(node.parent) || isPrefixUnaryExpression(node.parent) && isLiteralTypeNode(node.parent.parent);
89935
89946
  if (!literalType) {
89936
- if (languageVersion < 7 /* ES2020 */) {
89947
+ if (!(node.flags & 33554432 /* Ambient */) && languageVersion < 7 /* ES2020 */) {
89937
89948
  if (grammarErrorOnNode(node, Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ES2020)) {
89938
89949
  return true;
89939
89950
  }
@@ -5907,6 +5907,7 @@ declare namespace ts {
5907
5907
  */
5908
5908
  interface SourceFileLike {
5909
5909
  readonly text: string;
5910
+ languageVariant?: LanguageVariant;
5910
5911
  }
5911
5912
  interface SourceFileLike {
5912
5913
  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 = `${versionMajorMinor}.0-dev.20250624`;
2288
+ var version = `${versionMajorMinor}.0-dev.20250626`;
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__ */ ((LanguageVariant4) => {
6794
- LanguageVariant4[LanguageVariant4["Standard"] = 0] = "Standard";
6795
- LanguageVariant4[LanguageVariant4["JSX"] = 1] = "JSX";
6796
- return LanguageVariant4;
6793
+ var LanguageVariant = /* @__PURE__ */ ((LanguageVariant3) => {
6794
+ LanguageVariant3[LanguageVariant3["Standard"] = 0] = "Standard";
6795
+ LanguageVariant3[LanguageVariant3["JSX"] = 1] = "JSX";
6796
+ return LanguageVariant3;
6797
6797
  })(LanguageVariant || {});
6798
6798
  var WatchDirectoryFlags = /* @__PURE__ */ ((WatchDirectoryFlags3) => {
6799
6799
  WatchDirectoryFlags3[WatchDirectoryFlags3["None"] = 0] = "None";
@@ -21084,8 +21084,14 @@ function base64decode(host, input) {
21084
21084
  function readJsonOrUndefined(path, hostOrText) {
21085
21085
  const jsonText = isString(hostOrText) ? hostOrText : hostOrText.readFile(path);
21086
21086
  if (!jsonText) return void 0;
21087
- const result = parseConfigFileTextToJson(path, jsonText);
21088
- return !result.error ? result.config : void 0;
21087
+ let result = tryParseJson(jsonText);
21088
+ if (result === void 0) {
21089
+ const looseResult = parseConfigFileTextToJson(path, jsonText);
21090
+ if (!looseResult.error) {
21091
+ result = looseResult.config;
21092
+ }
21093
+ }
21094
+ return result;
21089
21095
  }
21090
21096
  function readJson(path, host) {
21091
21097
  return readJsonOrUndefined(path, host) || {};
@@ -35472,6 +35478,7 @@ var Parser;
35472
35478
  /*skipKeyword*/
35473
35479
  true
35474
35480
  );
35481
+ parseOptional(28 /* CommaToken */);
35475
35482
  if (!parseExpected(20 /* CloseBraceToken */)) {
35476
35483
  const lastError = lastOrUndefined(parseDiagnostics);
35477
35484
  if (lastError && lastError.code === Diagnostics._0_expected.code) {
@@ -72043,9 +72050,13 @@ function createTypeChecker(host) {
72043
72050
  return types[0];
72044
72051
  }
72045
72052
  const primaryTypes = strictNullChecks ? sameMap(types, (t) => filterType(t, (u) => !(u.flags & 98304 /* Nullable */))) : types;
72046
- const superTypeOrUnion = literalTypesWithSameBaseType(primaryTypes) ? getUnionType(primaryTypes) : reduceLeft(primaryTypes, (s, t) => isTypeSubtypeOf(s, t) ? t : s);
72053
+ const superTypeOrUnion = literalTypesWithSameBaseType(primaryTypes) ? getUnionType(primaryTypes) : getSingleCommonSupertype(primaryTypes);
72047
72054
  return primaryTypes === types ? superTypeOrUnion : getNullableType(superTypeOrUnion, getCombinedTypeFlags(types) & 98304 /* Nullable */);
72048
72055
  }
72056
+ function getSingleCommonSupertype(types) {
72057
+ const candidate = reduceLeft(types, (s, t) => isTypeStrictSubtypeOf(s, t) ? t : s);
72058
+ return every(types, (t) => t === candidate || isTypeStrictSubtypeOf(t, candidate)) ? candidate : reduceLeft(types, (s, t) => isTypeSubtypeOf(s, t) ? t : s);
72059
+ }
72049
72060
  function getCommonSubtype(types) {
72050
72061
  return reduceLeft(types, (s, t) => isTypeSubtypeOf(t, s) ? t : s);
72051
72062
  }
@@ -94459,7 +94470,7 @@ function createTypeChecker(host) {
94459
94470
  if (languageVersion < 2 /* ES2015 */ && isPrivateIdentifier(node.name)) {
94460
94471
  return grammarErrorOnNode(node.name, Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher);
94461
94472
  }
94462
- if (languageVersion < 2 /* ES2015 */ && isAutoAccessorPropertyDeclaration(node)) {
94473
+ if (languageVersion < 2 /* ES2015 */ && isAutoAccessorPropertyDeclaration(node) && !(node.flags & 33554432 /* Ambient */)) {
94463
94474
  return grammarErrorOnNode(node.name, Diagnostics.Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher);
94464
94475
  }
94465
94476
  if (isAutoAccessorPropertyDeclaration(node) && checkGrammarForInvalidQuestionMark(node.questionToken, Diagnostics.An_accessor_property_cannot_be_declared_optional)) {
@@ -94544,7 +94555,7 @@ function createTypeChecker(host) {
94544
94555
  function checkGrammarBigIntLiteral(node) {
94545
94556
  const literalType = isLiteralTypeNode(node.parent) || isPrefixUnaryExpression(node.parent) && isLiteralTypeNode(node.parent.parent);
94546
94557
  if (!literalType) {
94547
- if (languageVersion < 7 /* ES2020 */) {
94558
+ if (!(node.flags & 33554432 /* Ambient */) && languageVersion < 7 /* ES2020 */) {
94548
94559
  if (grammarErrorOnNode(node, Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ES2020)) {
94549
94560
  return true;
94550
94561
  }
@@ -140282,7 +140293,7 @@ function isInsideJsxElementOrAttribute(sourceFile, position) {
140282
140293
  if (token && token.kind === 20 /* CloseBraceToken */ && token.parent.kind === 295 /* JsxExpression */) {
140283
140294
  return true;
140284
140295
  }
140285
- if (token.kind === 30 /* LessThanToken */ && token.parent.kind === 288 /* JsxClosingElement */) {
140296
+ if (token.kind === 31 /* LessThanSlashToken */ && token.parent.kind === 288 /* JsxClosingElement */) {
140286
140297
  return true;
140287
140298
  }
140288
140299
  return false;
@@ -140310,7 +140321,7 @@ function isInJSXText(sourceFile, position) {
140310
140321
  function isInsideJsxElement(sourceFile, position) {
140311
140322
  function isInsideJsxElementTraversal(node) {
140312
140323
  while (node) {
140313
- 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 */) {
140324
+ 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 */) {
140314
140325
  node = node.parent;
140315
140326
  } else if (node.kind === 285 /* JsxElement */) {
140316
140327
  if (position > node.getStart(sourceFile)) return true;
@@ -151752,7 +151763,9 @@ function createChildren(node, sourceFile) {
151752
151763
  });
151753
151764
  return children;
151754
151765
  }
151766
+ const languageVariant = (sourceFile == null ? void 0 : sourceFile.languageVariant) ?? 0 /* Standard */;
151755
151767
  scanner.setText((sourceFile || node.getSourceFile()).text);
151768
+ scanner.setLanguageVariant(languageVariant);
151756
151769
  let pos = node.pos;
151757
151770
  const processNode = (child) => {
151758
151771
  addSyntheticNodes(children, pos, child.pos, node);
@@ -151769,6 +151782,7 @@ function createChildren(node, sourceFile) {
151769
151782
  node.forEachChild(processNode, processNodes);
151770
151783
  addSyntheticNodes(children, pos, node.end, node);
151771
151784
  scanner.setText(void 0);
151785
+ scanner.setLanguageVariant(0 /* Standard */);
151772
151786
  return children;
151773
151787
  }
151774
151788
  function addSyntheticNodes(nodes, pos, end, parent2) {
@@ -167476,7 +167490,7 @@ function getJsxClosingTagCompletion(location, sourceFile) {
167476
167490
  switch (node.kind) {
167477
167491
  case 288 /* JsxClosingElement */:
167478
167492
  return true;
167479
- case 44 /* SlashToken */:
167493
+ case 31 /* LessThanSlashToken */:
167480
167494
  case 32 /* GreaterThanToken */:
167481
167495
  case 80 /* Identifier */:
167482
167496
  case 212 /* PropertyAccessExpression */:
@@ -168812,7 +168826,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
168812
168826
  location = currentToken;
168813
168827
  }
168814
168828
  break;
168815
- case 44 /* SlashToken */:
168829
+ case 31 /* LessThanSlashToken */:
168816
168830
  if (currentToken.parent.kind === 286 /* JsxSelfClosingElement */) {
168817
168831
  location = currentToken;
168818
168832
  }
@@ -168821,7 +168835,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
168821
168835
  }
168822
168836
  switch (parent2.kind) {
168823
168837
  case 288 /* JsxClosingElement */:
168824
- if (contextToken.kind === 44 /* SlashToken */) {
168838
+ if (contextToken.kind === 31 /* LessThanSlashToken */) {
168825
168839
  isStartingCloseTag = true;
168826
168840
  location = contextToken;
168827
168841
  }
@@ -170441,7 +170455,7 @@ function isValidTrigger(sourceFile, triggerCharacter, contextToken, position) {
170441
170455
  case "<":
170442
170456
  return !!contextToken && contextToken.kind === 30 /* LessThanToken */ && (!isBinaryExpression(contextToken.parent) || binaryExpressionMayBeOpenTag(contextToken.parent));
170443
170457
  case "/":
170444
- return !!contextToken && (isStringLiteralLike(contextToken) ? !!tryGetImportFromModuleSpecifier(contextToken) : contextToken.kind === 44 /* SlashToken */ && isJsxClosingElement(contextToken.parent));
170458
+ return !!contextToken && (isStringLiteralLike(contextToken) ? !!tryGetImportFromModuleSpecifier(contextToken) : contextToken.kind === 31 /* LessThanSlashToken */ && isJsxClosingElement(contextToken.parent));
170445
170459
  case " ":
170446
170460
  return !!contextToken && isImportKeyword(contextToken) && contextToken.parent.kind === 308 /* SourceFile */;
170447
170461
  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.0-dev.20250624",
5
+ "version": "5.9.0-dev.20250626",
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": "78c16795cdee70b9d9f0f248b6dbb6ba50994a59"
119
+ "gitHead": "02672d281c26e561708127da1d8d1a6cae45fee2"
120
120
  }