Since then (two years really flies by!) I have had the opportunity to play with TypeScript a bit more and I can say that I am quite a fan.
I would not suggest it for everything in Discourse, but there are parts of the codebase where stronger typing would certainly help from a development perspective. I consider TypeScript something like a super linter, where you can avoid null exceptions and accessing members that aren’t there.
The big problem right now is the pipeline doesn’t support it. Our current JS build process is still based on sprockets in Rails, with a bunch of custom code to use Babel for ES6 features.
We’ve had some internal discussions about reviewing other build pipelines such as rollup, ember cli or webpack to see if those tools can be used instead of sprockets. There are several advantages to this:
- Our sprockets hacks are holding us back from upgrading Rails right now
- Not upgrading Rails is holding us back from the newer version of Ruby which has better memory usage/performance
- Sprockets is really slow and uses a lot of memory. We’d like to be able to upgrade Discourse without hitting swap on low memory servers.
- We’d like to improve development speed
- We’d like for front end designers to work on Discourse locally without the entire ruby app
I suspect that based on internal discussions that we will have an opportunity to look into a new build pipeline this year (maybe even this quarter). Once that is in place we will be in a much better position to add something like TypeScript.