@tsrx/core 0.1.68 → 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 +1 -1
- package/src/plugin.js +8 -2
- package/src/transform/jsx/helpers.js +3 -0
package/package.json
CHANGED
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
|
-
//
|
|
2890
|
-
if (
|
|
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`.
|