完全支持 TypeScript
【Full TypeScript support】
要使用 TypeScript 并完全支持所有 TypeScript 功能,包括 tsconfig.json,你可以使用第三方包。这些说明以 tsx 为例,但还有许多其他类似的库可用。
【To use TypeScript with full support for all TypeScript features, including
tsconfig.json, you can use a third-party package. These instructions use
tsx as an example but there are many other similar libraries available.】
-
使用你项目中使用的任何包管理器将该包安装为开发依赖。例如,使用
npm:npm install --save-dev tsx -
然后你可以通过以下方式运行你的 TypeScript 代码:
npx tsx your-file.ts或者,你也可以通过以下方式使用
node运行:node --import=tsx your-file.ts