Struggling to find ample examples or documentation on writing a Babel plugin in TypeScript. Currently, I am working on a visitor plugin with the following signature:
export default function myPlugin({ types: t }: typeof babel): PluginObj {
In order to obtain certain types, I am using:
import type { PluginObj, PluginPass } from '@babel/core';
The aspect that is causing me confusion is the { types: t }: typeof babel
derived from
import type * as babel from '@babel/core';
While this syntax has been used in some online examples, I am unsure if it is the correct way to type it. Any guidance would be appreciated.