typescript 5.9.0-dev.20250502 → 5.9.0-dev.20250504

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.20250502`;
21
+ var version = `${versionMajorMinor}.0-dev.20250504`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -6770,7 +6770,7 @@ var Diagnostics = {
6770
6770
  Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom: diag(2812, 1 /* Error */, "Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom_2812", "Property '{0}' does not exist on type '{1}'. Try changing the 'lib' compiler option to include 'dom'."),
6771
6771
  Class_declaration_cannot_implement_overload_list_for_0: diag(2813, 1 /* Error */, "Class_declaration_cannot_implement_overload_list_for_0_2813", "Class declaration cannot implement overload list for '{0}'."),
6772
6772
  Function_with_bodies_can_only_merge_with_classes_that_are_ambient: diag(2814, 1 /* Error */, "Function_with_bodies_can_only_merge_with_classes_that_are_ambient_2814", "Function with bodies can only merge with classes that are ambient."),
6773
- arguments_cannot_be_referenced_in_property_initializers: diag(2815, 1 /* Error */, "arguments_cannot_be_referenced_in_property_initializers_2815", "'arguments' cannot be referenced in property initializers."),
6773
+ arguments_cannot_be_referenced_in_property_initializers_or_class_static_initialization_blocks: diag(2815, 1 /* Error */, "arguments_cannot_be_referenced_in_property_initializers_or_class_static_initialization_blocks_2815", "'arguments' cannot be referenced in property initializers or class static initialization blocks."),
6774
6774
  Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class: diag(2816, 1 /* Error */, "Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class_2816", "Cannot use 'this' in a static property initializer of a decorated class."),
6775
6775
  Property_0_has_no_initializer_and_is_not_definitely_assigned_in_a_class_static_block: diag(2817, 1 /* Error */, "Property_0_has_no_initializer_and_is_not_definitely_assigned_in_a_class_static_block_2817", "Property '{0}' has no initializer and is not definitely assigned in a class static block."),
6776
6776
  Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers: diag(2818, 1 /* Error */, "Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializer_2818", "Duplicate identifier '{0}'. Compiler reserves name '{1}' when emitting 'super' references in static initializers."),
@@ -47788,12 +47788,15 @@ function createTypeChecker(host) {
47788
47788
  return isForInOrOfStatement(grandparent) && isSameScopeDescendentOf(usage2, grandparent.expression, declContainer);
47789
47789
  }
47790
47790
  function isUsedInFunctionOrInstanceProperty(usage2, declaration2) {
47791
+ return isUsedInFunctionOrInstancePropertyWorker(usage2, declaration2);
47792
+ }
47793
+ function isUsedInFunctionOrInstancePropertyWorker(usage2, declaration2) {
47791
47794
  return !!findAncestor(usage2, (current) => {
47792
47795
  if (current === declContainer) {
47793
47796
  return "quit";
47794
47797
  }
47795
47798
  if (isFunctionLike(current)) {
47796
- return true;
47799
+ return !getImmediatelyInvokedFunctionExpression(current);
47797
47800
  }
47798
47801
  if (isClassStaticBlockDeclaration(current)) {
47799
47802
  return declaration2.pos < usage2.pos;
@@ -47824,6 +47827,15 @@ function createTypeChecker(host) {
47824
47827
  }
47825
47828
  }
47826
47829
  }
47830
+ const decorator = tryCast(current.parent, isDecorator);
47831
+ if (decorator && decorator.expression === current) {
47832
+ if (isParameter(decorator.parent)) {
47833
+ return isUsedInFunctionOrInstancePropertyWorker(decorator.parent.parent.parent, declaration2) ? true : "quit";
47834
+ }
47835
+ if (isMethodDeclaration(decorator.parent)) {
47836
+ return isUsedInFunctionOrInstancePropertyWorker(decorator.parent.parent, declaration2) ? true : "quit";
47837
+ }
47838
+ }
47827
47839
  return false;
47828
47840
  });
47829
47841
  }
@@ -71602,8 +71614,12 @@ function createTypeChecker(host) {
71602
71614
  function checkIdentifierCalculateNodeCheckFlags(node, symbol) {
71603
71615
  if (isThisInTypeQuery(node)) return;
71604
71616
  if (symbol === argumentsSymbol) {
71605
- if (isInPropertyInitializerOrClassStaticBlock(node)) {
71606
- error(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers);
71617
+ if (isInPropertyInitializerOrClassStaticBlock(
71618
+ node,
71619
+ /*ignoreArrowFunctions*/
71620
+ true
71621
+ )) {
71622
+ error(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers_or_class_static_initialization_blocks);
71607
71623
  return;
71608
71624
  }
71609
71625
  let container = getContainingFunction(node);
@@ -74883,31 +74899,21 @@ function createTypeChecker(host) {
74883
74899
  addRelatedInfo(diagnosticMessage, createDiagnosticForNode(valueDeclaration, Diagnostics._0_is_declared_here, declarationName));
74884
74900
  }
74885
74901
  }
74886
- function isInPropertyInitializerOrClassStaticBlock(node) {
74902
+ function isInPropertyInitializerOrClassStaticBlock(node, ignoreArrowFunctions) {
74887
74903
  return !!findAncestor(node, (node2) => {
74888
74904
  switch (node2.kind) {
74889
74905
  case 172 /* PropertyDeclaration */:
74906
+ case 175 /* ClassStaticBlockDeclaration */:
74890
74907
  return true;
74891
- case 303 /* PropertyAssignment */:
74892
- case 174 /* MethodDeclaration */:
74893
- case 177 /* GetAccessor */:
74894
- case 178 /* SetAccessor */:
74895
- case 305 /* SpreadAssignment */:
74896
- case 167 /* ComputedPropertyName */:
74897
- case 239 /* TemplateSpan */:
74898
- case 294 /* JsxExpression */:
74899
- case 291 /* JsxAttribute */:
74900
- case 292 /* JsxAttributes */:
74901
- case 293 /* JsxSpreadAttribute */:
74902
- case 286 /* JsxOpeningElement */:
74903
- case 233 /* ExpressionWithTypeArguments */:
74904
- case 298 /* HeritageClause */:
74905
- return false;
74908
+ case 186 /* TypeQuery */:
74909
+ case 287 /* JsxClosingElement */:
74910
+ return "quit";
74906
74911
  case 219 /* ArrowFunction */:
74907
- case 244 /* ExpressionStatement */:
74908
- return isBlock(node2.parent) && isClassStaticBlockDeclaration(node2.parent.parent) ? true : "quit";
74912
+ return ignoreArrowFunctions ? false : "quit";
74913
+ case 241 /* Block */:
74914
+ return isFunctionLikeDeclaration(node2.parent) && node2.parent.kind !== 219 /* ArrowFunction */ ? "quit" : false;
74909
74915
  default:
74910
- return isExpressionNode(node2) ? false : "quit";
74916
+ return false;
74911
74917
  }
74912
74918
  });
74913
74919
  }
package/lib/lib.es5.d.ts CHANGED
@@ -1158,6 +1158,7 @@ interface JSON {
1158
1158
  * @param text A valid JSON string.
1159
1159
  * @param reviver A function that transforms the results. This function is called for each member of the object.
1160
1160
  * If a member contains nested objects, the nested objects are transformed before the parent object is.
1161
+ * @throws {SyntaxError} If `text` is not valid JSON.
1161
1162
  */
1162
1163
  parse(text: string, reviver?: (this: any, key: string, value: any) => any): any;
1163
1164
  /**
@@ -1165,6 +1166,7 @@ interface JSON {
1165
1166
  * @param value A JavaScript value, usually an object or array, to be converted.
1166
1167
  * @param replacer A function that transforms the results.
1167
1168
  * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
1169
+ * @throws {TypeError} If a circular reference or a BigInt value is found.
1168
1170
  */
1169
1171
  stringify(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
1170
1172
  /**
@@ -1172,6 +1174,7 @@ interface JSON {
1172
1174
  * @param value A JavaScript value, usually an object or array, to be converted.
1173
1175
  * @param replacer An array of strings and numbers that acts as an approved list for selecting the object properties that will be stringified.
1174
1176
  * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
1177
+ * @throws {TypeError} If a circular reference or a BigInt value is found.
1175
1178
  */
1176
1179
  stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string;
1177
1180
  }
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.20250502`;
2288
+ var version = `${versionMajorMinor}.0-dev.20250504`;
2289
2289
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2290
2290
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2291
2291
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -10156,7 +10156,7 @@ var Diagnostics = {
10156
10156
  Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom: diag(2812, 1 /* Error */, "Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom_2812", "Property '{0}' does not exist on type '{1}'. Try changing the 'lib' compiler option to include 'dom'."),
10157
10157
  Class_declaration_cannot_implement_overload_list_for_0: diag(2813, 1 /* Error */, "Class_declaration_cannot_implement_overload_list_for_0_2813", "Class declaration cannot implement overload list for '{0}'."),
10158
10158
  Function_with_bodies_can_only_merge_with_classes_that_are_ambient: diag(2814, 1 /* Error */, "Function_with_bodies_can_only_merge_with_classes_that_are_ambient_2814", "Function with bodies can only merge with classes that are ambient."),
10159
- arguments_cannot_be_referenced_in_property_initializers: diag(2815, 1 /* Error */, "arguments_cannot_be_referenced_in_property_initializers_2815", "'arguments' cannot be referenced in property initializers."),
10159
+ arguments_cannot_be_referenced_in_property_initializers_or_class_static_initialization_blocks: diag(2815, 1 /* Error */, "arguments_cannot_be_referenced_in_property_initializers_or_class_static_initialization_blocks_2815", "'arguments' cannot be referenced in property initializers or class static initialization blocks."),
10160
10160
  Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class: diag(2816, 1 /* Error */, "Cannot_use_this_in_a_static_property_initializer_of_a_decorated_class_2816", "Cannot use 'this' in a static property initializer of a decorated class."),
10161
10161
  Property_0_has_no_initializer_and_is_not_definitely_assigned_in_a_class_static_block: diag(2817, 1 /* Error */, "Property_0_has_no_initializer_and_is_not_definitely_assigned_in_a_class_static_block_2817", "Property '{0}' has no initializer and is not definitely assigned in a class static block."),
10162
10162
  Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers: diag(2818, 1 /* Error */, "Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializer_2818", "Duplicate identifier '{0}'. Compiler reserves name '{1}' when emitting 'super' references in static initializers."),
@@ -52398,12 +52398,15 @@ function createTypeChecker(host) {
52398
52398
  return isForInOrOfStatement(grandparent) && isSameScopeDescendentOf(usage2, grandparent.expression, declContainer);
52399
52399
  }
52400
52400
  function isUsedInFunctionOrInstanceProperty(usage2, declaration2) {
52401
+ return isUsedInFunctionOrInstancePropertyWorker(usage2, declaration2);
52402
+ }
52403
+ function isUsedInFunctionOrInstancePropertyWorker(usage2, declaration2) {
52401
52404
  return !!findAncestor(usage2, (current) => {
52402
52405
  if (current === declContainer) {
52403
52406
  return "quit";
52404
52407
  }
52405
52408
  if (isFunctionLike(current)) {
52406
- return true;
52409
+ return !getImmediatelyInvokedFunctionExpression(current);
52407
52410
  }
52408
52411
  if (isClassStaticBlockDeclaration(current)) {
52409
52412
  return declaration2.pos < usage2.pos;
@@ -52434,6 +52437,15 @@ function createTypeChecker(host) {
52434
52437
  }
52435
52438
  }
52436
52439
  }
52440
+ const decorator = tryCast(current.parent, isDecorator);
52441
+ if (decorator && decorator.expression === current) {
52442
+ if (isParameter(decorator.parent)) {
52443
+ return isUsedInFunctionOrInstancePropertyWorker(decorator.parent.parent.parent, declaration2) ? true : "quit";
52444
+ }
52445
+ if (isMethodDeclaration(decorator.parent)) {
52446
+ return isUsedInFunctionOrInstancePropertyWorker(decorator.parent.parent, declaration2) ? true : "quit";
52447
+ }
52448
+ }
52437
52449
  return false;
52438
52450
  });
52439
52451
  }
@@ -76212,8 +76224,12 @@ function createTypeChecker(host) {
76212
76224
  function checkIdentifierCalculateNodeCheckFlags(node, symbol) {
76213
76225
  if (isThisInTypeQuery(node)) return;
76214
76226
  if (symbol === argumentsSymbol) {
76215
- if (isInPropertyInitializerOrClassStaticBlock(node)) {
76216
- error2(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers);
76227
+ if (isInPropertyInitializerOrClassStaticBlock(
76228
+ node,
76229
+ /*ignoreArrowFunctions*/
76230
+ true
76231
+ )) {
76232
+ error2(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers_or_class_static_initialization_blocks);
76217
76233
  return;
76218
76234
  }
76219
76235
  let container = getContainingFunction(node);
@@ -79493,31 +79509,21 @@ function createTypeChecker(host) {
79493
79509
  addRelatedInfo(diagnosticMessage, createDiagnosticForNode(valueDeclaration, Diagnostics._0_is_declared_here, declarationName));
79494
79510
  }
79495
79511
  }
79496
- function isInPropertyInitializerOrClassStaticBlock(node) {
79512
+ function isInPropertyInitializerOrClassStaticBlock(node, ignoreArrowFunctions) {
79497
79513
  return !!findAncestor(node, (node2) => {
79498
79514
  switch (node2.kind) {
79499
79515
  case 172 /* PropertyDeclaration */:
79516
+ case 175 /* ClassStaticBlockDeclaration */:
79500
79517
  return true;
79501
- case 303 /* PropertyAssignment */:
79502
- case 174 /* MethodDeclaration */:
79503
- case 177 /* GetAccessor */:
79504
- case 178 /* SetAccessor */:
79505
- case 305 /* SpreadAssignment */:
79506
- case 167 /* ComputedPropertyName */:
79507
- case 239 /* TemplateSpan */:
79508
- case 294 /* JsxExpression */:
79509
- case 291 /* JsxAttribute */:
79510
- case 292 /* JsxAttributes */:
79511
- case 293 /* JsxSpreadAttribute */:
79512
- case 286 /* JsxOpeningElement */:
79513
- case 233 /* ExpressionWithTypeArguments */:
79514
- case 298 /* HeritageClause */:
79515
- return false;
79518
+ case 186 /* TypeQuery */:
79519
+ case 287 /* JsxClosingElement */:
79520
+ return "quit";
79516
79521
  case 219 /* ArrowFunction */:
79517
- case 244 /* ExpressionStatement */:
79518
- return isBlock(node2.parent) && isClassStaticBlockDeclaration(node2.parent.parent) ? true : "quit";
79522
+ return ignoreArrowFunctions ? false : "quit";
79523
+ case 241 /* Block */:
79524
+ return isFunctionLikeDeclaration(node2.parent) && node2.parent.kind !== 219 /* ArrowFunction */ ? "quit" : false;
79519
79525
  default:
79520
- return isExpressionNode(node2) ? false : "quit";
79526
+ return false;
79521
79527
  }
79522
79528
  });
79523
79529
  }
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.20250502",
5
+ "version": "5.9.0-dev.20250504",
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": "11e79327598db412a161616849041487673fadab"
119
+ "gitHead": "d88d3a46810bfae0b072beb023a2b09b8026b82c"
120
120
  }