我正在使用TypeScript编写Babel插件,但是很难找到很多相关的示例或文档。例如,我正在编写一个具有以下签名的访问者插件:
export default function myPlugin({ types: t }: typeof babel): PluginObj {
我从以下几个类型中得到:
import type { PluginObj, PluginPass } from '@babel/core';
让我困扰的部分是来自
{ types: t }: typeof babel
。import type * as babel from '@babel/core';
我在网上找到的一些例子都使用了这个,但这真的是它应该输入的方式吗?
@babel/core
似乎没有提供类型。你是否添加了@types/babel-core
? - rschristiancustomize-cra
? - rschristian