Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How's the migration path? I use TypeScript for new React apps I build, but I'm dealing with some JS projects where there's just no way to convert everything to TS all at once.

Does TS work well alongside legacy JS so you can update individual files incrementally as you go along? I remember trying it once and facing some unexpected blockers, but I don't remember what they were.



It's very seamless. There's a flag, allowJs, that lets you import js files with only sanity checks (no actual typechecking). You can then start converting individual files to Typescript as you go.


Thanks! I wish I could remember what I ran into the last time. I guess I'll just have to try.


I believe the allowJS flag is new and disabled by default. It may not have existed when you last tried. That’s what happened with our team. We tried to switch in either 0.x or low 1.x and at the time I believe we had to convert everything to TS (although, we may just not have been aware of the allowJS flag at the time).




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: