We either add the imports globally (scoped-jsx) or add them to the very first import with source 'react'. However, this is incorrect when we're dealing with module augmentation.
This is a reduced example from vercel/nextjs where we had to manually adjust the codemod
-import {type JSX} from 'react'
declare module 'react-dom/server.browser'
declare module 'react-dom/server.edge' {
+ import {type JSX} from 'react'
}
It's going to be a bit involved to get this working since we have to leverage scope analysis to fix it.
We either add the imports globally (
scoped-jsx
) or add them to the very first import with source'react'
. However, this is incorrect when we're dealing with module augmentation.This is a reduced example from vercel/nextjs where we had to manually adjust the codemod
It's going to be a bit involved to get this working since we have to leverage scope analysis to fix it.