1
1
/**
2
2
* @typedef {import('estree-jsx').Node } Node
3
- * @typedef {import('estree-jsx').Comment } Comment
4
3
* @typedef {import('estree-jsx').Expression } Expression
5
- * @typedef {import('estree-jsx').Pattern } Pattern
6
4
* @typedef {import('estree-jsx').ObjectExpression } ObjectExpression
7
5
* @typedef {import('estree-jsx').Property } Property
8
6
* @typedef {import('estree-jsx').ImportSpecifier } ImportSpecifier
9
7
* @typedef {import('estree-jsx').SpreadElement } SpreadElement
10
8
* @typedef {import('estree-jsx').MemberExpression } MemberExpression
11
9
* @typedef {import('estree-jsx').Literal } Literal
12
10
* @typedef {import('estree-jsx').Identifier } Identifier
13
- * @typedef {import('estree-jsx').JSXElement } JSXElement
14
- * @typedef {import('estree-jsx').JSXFragment } JSXFragment
15
- * @typedef {import('estree-jsx').JSXText } JSXText
16
- * @typedef {import('estree-jsx').JSXExpressionContainer } JSXExpressionContainer
17
- * @typedef {import('estree-jsx').JSXEmptyExpression } JSXEmptyExpression
18
- * @typedef {import('estree-jsx').JSXSpreadChild } JSXSpreadChild
19
11
* @typedef {import('estree-jsx').JSXAttribute } JSXAttribute
20
- * @typedef {import('estree-jsx').JSXSpreadAttribute } JSXSpreadAttribute
21
12
* @typedef {import('estree-jsx').JSXMemberExpression } JSXMemberExpression
22
13
* @typedef {import('estree-jsx').JSXNamespacedName } JSXNamespacedName
23
14
* @typedef {import('estree-jsx').JSXIdentifier } JSXIdentifier
24
15
*
25
- * @typedef {import('estree-walker').SyncHandler } SyncHandler
26
- *
27
16
* @typedef Options
28
17
* @property {'automatic'|'classic' } [runtime='classic']
29
18
* @property {string } [importSource='react']
39
28
* @property {string } [jsxImportSource]
40
29
*/
41
30
31
+ // @ts -expect-error: typed incorrectly.
42
32
import { walk } from 'estree-walker'
43
33
import { name as isIdentifierName } from 'estree-util-is-identifier-name'
44
34
@@ -58,7 +48,6 @@ export function buildJsx(tree, options = {}) {
58
48
const imports = { }
59
49
60
50
walk ( tree , {
61
- // @ts -expect-error: types are wrong.
62
51
enter ( /** @type {Node } */ node ) {
63
52
if ( node . type === 'Program' ) {
64
53
const comments = node . comments || [ ]
@@ -107,7 +96,6 @@ export function buildJsx(tree, options = {}) {
107
96
}
108
97
}
109
98
} ,
110
- // @ts -expect-error: types are wrong.
111
99
// eslint-disable-next-line complexity
112
100
leave ( /** @type {Node } */ node ) {
113
101
if ( node . type === 'Program' ) {
@@ -406,6 +394,8 @@ export function buildJsx(tree, options = {}) {
406
394
407
395
parameters . unshift ( name )
408
396
397
+ // Types of `estree-walker` are wrong
398
+ // type-coverage:ignore-next-line
409
399
this . replace (
410
400
create ( node , {
411
401
type : 'CallExpression' ,
0 commit comments