Supported by Babel: It’s enough to add a tag ➔ Community :( Not involved in the development ➔ Core team :( Facebook and community goals seemed to diverge We were afraid of choosing a language doomed to be forgotten or confined in its niche
of typings for third-party libraries ➔ Core team :) The project looks stable and Microsoft’s goals are aligned with the ones of the community ➔ Better React support :O It’s a win!
our stack Identify a project able to support the cost of the experiment (time and budget) May 2017 JS to TS! Start of the code migration July 2017 Evaluation of the experiment. Do we like TypeScript? The TypeScript Experiment
keep having some JavaScript code for months. TypeScript and Babel use different transpilers: in our tests TypeScript transpiled some code differently than Babel!
code Not a lot of libraries natively support TypeScript, but thanks to DefinitelyTyped and the .d.ts interfaces, you can use them as if they were written in TypeScript
the project as quickly as possible, but to evaluate its outcome. Leaf-components first: 1. Data management is harder to type 2. Complex containers are easier to type if all their children are typed 3. Leaf-components: many, small and isolated. Developers can work on them in parallel (knowledge share!) LE M O N
Started backporting it on our internal tools • Completed migration of pilot project • Every new project uses TypeScript by default • Started backporting on active projects
are first of all documentation :) Code is easier to read ➔ We tend to write better code Because it’s easier to represent good code with types ➔ Union types To represent only consistent states Unexpected things we liked
type '{ view: "product"; }' is not assignable to parameter of type 'View'. Type '{ view: "product"; }' is not assignable to type '{ view: "product"; productId: number; }'. Property 'productId' is missing in type '{ view: "product"; }'.
third-party libraries Often incomplete or with mistakes ➔ Typing complex dynamic logic is difficult Of course, you shouldn’t write code like that… but every project has at least one example of that! Things to improve