Skip to main content
要为项目中的 Bun 内置 API 添加 TypeScript 定义,请安装 @types/bun
terminal

以下是 Bun 项目推荐的完整 compilerOptions。使用此 tsconfig.json,你可以使用顶层 await、带扩展名或不带扩展名的导入,以及 JSX。
tsconfig.json

如果你使用的是 TypeScript 6.0 或更高版本,还需要在 compilerOptions 中添加 "types": ["bun"]。详情请参见 TypeScript 6 和 7
参见 TypeScript