Skip to content

Can I write my typeorm entities in typescript while having my app writed in javascript?

I found it way more intuitive to write typeorm entities in typescript format, however my whole app is indeed in javascript. I know those languages are compiling the same way, but will It cause any kind of problems to do so ? Thanks.

Answer

It won’t, if you enable the "allowJs": true flag in the tsconfig.json, and always compile the typescript codes alongside with the javascript codes.

This is actually recommended, when you would like to migrate your codebase from javascript to typescript incrementally.