@types/bun。
terminal
以下是 Bun 项目推荐的完整
compilerOptions 配置。有了这个 tsconfig.json,你可以使用顶层 await,带扩展名或无扩展名的导入,以及 JSX。
tsconfig.json
参考 生态系统 > TypeScript 以获取 Bun 中 TypeScript 支持的完整指南。
@types/bun。
bun add -d @types/bun # 开发依赖
compilerOptions 配置。有了这个 tsconfig.json,你可以使用顶层 await,带扩展名或无扩展名的导入,以及 JSX。
{
"compilerOptions": {
// 环境配置与最新特性
"lib": ["ESNext"],
"target": "ESNext",
"module": "Preserve",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
// 打包模式
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
// 最佳实践
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
// 一些更严格的选项(默认关闭)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
}
}