Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I develop Node.js (Express) app in both JavaScript and TypeScript together?

I have Node.js project (Express REST API) written in JavaScript. We decided to rewrite whole project to TypeScript. Is possible to do it slowly, part by part, but still be able to start server? I want rewrite just some parts so project will be partly JS partly TS. Is it possible?

Does ts-node-dev compile ts and ignore js?

like image 633
Baterka Avatar asked Apr 22 '26 16:04

Baterka


1 Answers

Yes this should be possible based on a main principle of TypeScript: TS is a superset of JS and all JS is also legal TS.

If you want to be particularly granular in how you are migrating your project, you should configure the TS compiler to only pay attention to files in which you are implementing the change from JS to TS.

like image 184
krmckone Avatar answered Apr 24 '26 05:04

krmckone



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!