简体   繁体   中英

Can I run a webserver with ts-node or similar with a codebase of mixed JS and TS?

I have a server running Node that is written in JavaScript. I would like to begin adding new features in TypeScript, and gradually convert the old code as we go.

I also don't want to recompile manually every time I make changes, using ts-node would be ideal if I had a purely ts codebase.

Is there configuration for ts-node that will ignore js files in the mix, or another launcher wrapper that can handle this logic?

Adding this option to your tsconfig.json would do the trick:

{
  "compilerOptions": {
    ...
    "checkJs": false
    ...
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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