【发布时间】:2019-08-04 05:06:19
【问题描述】:
我在 Typescript 中有一个 Next.js 项目。我需要将其恢复为 Javascript。我需要删除所有 Typescript 标记或将其编译为 ES2018 JS。
我尝试使用此配置在项目根目录运行 tsc 命令:
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": ".",
"paths": { "*": ["types/*"] },
"allowJs": true,
"allowSyntheticDefaultImports": true,
"jsx": "preserve",
"lib": ["dom", "es2018"],
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"preserveConstEnums": true,
"removeComments": false,
"skipLibCheck": true,
"sourceMap": true,
"strict": false,
"target": "esnext",
"esModuleInterop": true,
"experimentalDecorators": true,
"strictPropertyInitialization": false
},
"include": [
"app/**/*"
],
"exclude": [".next", "server/**/*.*"]
}
什么也没发生。
我希望将 .ts 文件替换为 .js 文件。如果不可能,我需要 .ts 文件旁边的 .js 文件。我可以手动删除 .ts 文件。
【问题讨论】:
-
你的配置中有
"noEmit": true。 -
问题解决了。如果你用回答按钮回答问题,我会用绿色勾号标记。
标签: javascript typescript next.js