Search code examples
javascriptnode.jstypescriptts-node

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?


Solution

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

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