11import { createCodeMutation } from "./_base" ;
2- import traverse from "@babel/traverse " ;
2+ import { traverse , NodePath } from "./babel-interop " ;
33import * as t from "@babel/types" ;
44import { getOrCreateImport } from "./utils" ;
55import { CompilerPayload } from "./_base" ;
@@ -14,7 +14,7 @@ export function jsxFragmentMutation(
1414 let fragmentImportName : string | null = null ;
1515
1616 traverse ( ast , {
17- ImportDeclaration ( path ) {
17+ ImportDeclaration ( path : NodePath < t . ImportDeclaration > ) {
1818 if ( path . node . source . value !== "react" ) return ;
1919
2020 for ( const specifier of path . node . specifiers ) {
@@ -31,7 +31,7 @@ export function jsxFragmentMutation(
3131 } ) ;
3232
3333 traverse ( ast , {
34- JSXFragment ( path ) {
34+ JSXFragment ( path : NodePath < t . JSXFragment > ) {
3535 foundFragments = true ;
3636
3737 if ( ! fragmentImportName ) {
@@ -62,7 +62,7 @@ export function transformFragmentShorthand(ast: t.Node): boolean {
6262 let fragmentImportName : string | null = null ;
6363
6464 traverse ( ast , {
65- ImportDeclaration ( path ) {
65+ ImportDeclaration ( path : NodePath < t . ImportDeclaration > ) {
6666 if ( path . node . source . value !== "react" ) return ;
6767
6868 for ( const specifier of path . node . specifiers ) {
@@ -79,7 +79,7 @@ export function transformFragmentShorthand(ast: t.Node): boolean {
7979 } ) ;
8080
8181 traverse ( ast , {
82- JSXFragment ( path ) {
82+ JSXFragment ( path : NodePath < t . JSXFragment > ) {
8383 transformed = true ;
8484
8585 if ( ! fragmentImportName ) {
0 commit comments