re: Refactoring old code vs Rewriting everything for long-term? VIEW POST


It's impossible to say for sure, since every project is different, but I'd shy away from doing a full rewrite unless you have a lot of time and/or people devoted to the project.

It might help you to write some high-level tests first. That will clarify how the app currently works. Tests also make it possible to refactor a bit more fearlessly since you'll get feedback as soon as a change breaks things. After you've made the changes necessary for your feature, you can assess what other parts of the app look dangerous to change and write tests for those.

If you want to migrate the existing project to TypeScript, I'd start from the bottom level components and work up. E.g. a sub-component can be written in TypeScript even if the modules using it are all plain JS.


Thanks for the reply!

On second thoughts, a complete rewrite would indeed take a lot of time.

Your advice really helped me.


Code of Conduct Report abuse