@@ -36,7 +36,11 @@ function purgeFromJsx(options?: acorn.Options) {
3636 ) . parse ( content , options || { ecmaVersion : "latest" } ) ,
3737 state ,
3838 {
39- JSXOpeningElement ( acornNode , state , callback ) {
39+ JSXOpeningElement (
40+ acornNode : acorn . Node ,
41+ state : NodeState ,
42+ callback : ( node : acorn . Node , state : NodeState ) => void ,
43+ ) {
4044 const node = acornNode as JSXOpeningElement ;
4145 const nameState : NodeState = { } ;
4246
@@ -49,7 +53,11 @@ function purgeFromJsx(options?: acorn.Options) {
4953 callback ( node . attributes [ i ] , state ) ;
5054 }
5155 } ,
52- JSXAttribute ( acornNode , state , callback ) {
56+ JSXAttribute (
57+ acornNode : acorn . Node ,
58+ state : NodeState ,
59+ callback : ( node : acorn . Node , state : NodeState ) => void ,
60+ ) {
5361 const node = acornNode as JSXAttribute ;
5462
5563 if ( ! node . value ) {
@@ -78,22 +86,22 @@ function purgeFromJsx(options?: acorn.Options) {
7886 break ;
7987 }
8088 } ,
81- JSXIdentifier ( acornNode , state ) {
89+ JSXIdentifier ( acornNode : acorn . Node , state : NodeState ) {
8290 const node = acornNode as JSXIdentifier ;
8391 state . text = node . name ;
8492 } ,
85- JSXNamespacedName ( acornNode , state ) {
93+ JSXNamespacedName ( acornNode : acorn . Node , state : NodeState ) {
8694 const node = acornNode as JSXNamespacedName ;
8795 state . text = node . namespace . name + ":" + node . name . name ;
8896 } ,
8997 // Only handle Literal for now, not JSXExpressionContainer | JSXElement
90- Literal ( acornNode , state ) {
98+ Literal ( acornNode : acorn . Node , state : NodeState ) {
9199 const node = acornNode as Literal ;
92100 if ( typeof node . value === "string" ) {
93101 state . text = node . value ;
94102 }
95103 } ,
96- } ,
104+ } as unknown as walk . RecursiveVisitors < NodeState > ,
97105 { ...walk . base } ,
98106 ) ;
99107
0 commit comments