@tsrx/core 0.1.67 → 0.1.69

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Core compiler infrastructure for TSRX syntax",
4
4
  "license": "MIT",
5
5
  "author": "Dominic Gannaway",
6
- "version": "0.1.67",
6
+ "version": "0.1.69",
7
7
  "type": "module",
8
8
  "repository": {
9
9
  "type": "git",
@@ -80,7 +80,7 @@
80
80
  "esrap": "^2.3.2",
81
81
  "magic-string": "^0.30.18",
82
82
  "zimmerframe": "^1.1.2",
83
- "@tsrx/runtime": "0.1.5"
83
+ "@tsrx/runtime": "0.1.6"
84
84
  },
85
85
  "devDependencies": {
86
86
  "@types/node": "^24.3.0",
package/src/plugin.js CHANGED
@@ -2886,8 +2886,14 @@ export function TSRXPlugin(config) {
2886
2886
  * @param {AST.TSTypeParameterDeclaration} node
2887
2887
  */
2888
2888
  reportReservedArrowTypeParam(node) {
2889
- // Allow <T>() => {} syntax without requiring trailing comma
2890
- if (this.#collect && node.params.length === 1 && node.extra?.trailingComma === undefined) {
2889
+ // Constraints and defaults already disambiguate a generic arrow from JSX.
2890
+ if (
2891
+ this.#collect &&
2892
+ node.params.length === 1 &&
2893
+ node.extra?.trailingComma === undefined &&
2894
+ !node.params[0].constraint &&
2895
+ !node.params[0].default
2896
+ ) {
2891
2897
  error(
2892
2898
  'This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.',
2893
2899
  this.#filename,
@@ -309,6 +309,9 @@ const TOOLING_LOCATION_WRAPPED_NODE_TYPES = new Set([
309
309
  'ExportDefaultDeclaration',
310
310
  'ExportAllDeclaration',
311
311
  'TSPropertySignature',
312
+ // Whole defaults own diagnostics that can extend beyond the last mapped
313
+ // token of a type assertion, such as `items = EMPTY_ARRAY as string[]`.
314
+ 'AssignmentPattern',
312
315
  ]);
313
316
 
314
317
  // Be careful when adding visitors that are already defined in `wrappers`.