Javascript vs. Typescript

Decision:

  • We will do Sprint 53 using typescript. New components should be in TypeScript. For modifications to existing components written in Javascript, they would stay Javascript. At the sprint review, we’ll make a decision to do one of the following:

    • Adopt TypeScript (to some degree) moving forward

    • Extend the experiment into another sprint

    • Stop using Javascript


Background:

Currently, there are a handful of .ts files (96.8% js, 0.04% ts) in the LiteFarm repo. The decision point here is whether new code should become Typescript.

Richard’s position: Any new code should be written in typescript. Existing code should be left as is for now.

Anant’s comment: This will make it more difficult to come up to speed on the project. Also there will be some interoperability issues. For example, you can call a ts function within js but there are differences in declaration and syntax.

 

Questions:

  • Typescript only on the front-end? It can be used on the back-end we just need to configure it to be used.

  • Is it trivial to go from typescript to javascript? Richard thought so.

  • Is everyone comfortable using typescript right now? It seems like only Richard was comfortable with typescript right now. Mwaya is only now becoming comfortable with javascript.

 

Potential options: Do 1 - 2 sprints using only typescript. At the retro reflect on whether we want to continue in their vein. For new components they would be in ts. For modifications to existing components, they would stay JS.