简体   繁体   English

尝试从TS迁移JS时未创建文件

[英]No Files Created When Trying To Migrate JS from TS

I have a Next.js project in Typescript. 我在Typescript中有一个Next.js项目。 I need to get it back to Javascript. 我需要将其恢复为Javascript。 I need to remove all Typescript markup or compile it to ES2018 JS. 我需要删除所有Typescript标记或将其编译为ES2018 JS。

I tried to run tsc command at the project root with this config: 我尝试使用此配置在项目根目录下运行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/**/*.*"]
}

Nothing happened. 没啥事儿。

I want .ts files to be replaced with .js files. 我希望将.ts文件替换为.js文件。 If not possible, I need .js files next to .ts files. 如果不可能,我需要在.ts文件旁边的.js文件。 I can manually delete .ts files. 我可以手动删除.ts文件。

You have "noEmit": true in your config, which causes the compiler to not emit any .js files. 您在配置中具有"noEmit": true ,这将导致编译器不发出任何.js文件。 As for deleting the .ts files you will need to do that manually. 至于删除.ts文件,则需要手动进行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM