What to do to mix coffescript and typescript files in the same nodejs project?

410 views Asked by At

In a server side node project with the standard package.json, How should we mix coffescript and typescript files?

The npm install, npm test and npm start functionality should still be available. The commands themselves are not essencial.

Extra info:

  • the coffeescript and Typescript need to be able to talk to each other as much as possible

  • the project is written in Expres

1

There are 1 answers

6
basarat On

How should we mix coffescript and typescript files?

Just add node.d.ts and then you should be able to just var/require coffescript files from typescript just fine. To require typescript files compile them to JS (using an IDE like atom, or grunt / gulp packages) and then you should be able to require them just fine.

To use TypeScript from typescript use import/require (instead of var/require) and then compile with --module commonjs.