Do you really want a layer above your JavaScript?

September 3, 2015 @Criteo Paris, France

Julien Lavigne du Cadet, Charles Niaulin, Erik Uzureau

Overview

  • Why use TypeScript at Criteo?
  • Some opinionated feedbacks
  • Is TypeScript right for your team?

What we do

Our Front Ends

TypeScript Pilot Project

  • Started in June 2014
  • 6 developers at first / several years commitment
  • 1 "front end" developer
  • Angular + C# backend

Why?

  • Large scale & greenfield
  • Strongly typed
  • Feels at home for C# developers
  • ES6 features before general availability

Meet the trolls

Static typing

What result would you expect ?

NaN !

Typescript in practice:

Typescript is not the silver bullet to catch errors

Uncaught TypeError: Cannot read property 'toString' of null

Does it compile in TS ?

YES

Does it compile in TS ?

YES

Does it compile in TS ?

YES

Does it compile in TS ?

NO

Most data/code you will interact with are not typed (JSON, JS libs)

Documentation closer to your code

... quicker than ...

Increase in lines of code, files

JS

TS

Or is it ? 

87 files in momentjs excluding tests & locale.

...Due to ES6 modules use

Setup

You have to manage definition files to use JS libs

Build time

Comfortable for c# / java developers

Refactoring sweetness

Uncomfortable for JS developers

Does not imply you don't have to know JS

What result do you expect ?

[NaN, NaN, NaN]

The working version

For fun

For fun

Lack of community support

And yet...

...For a project released in april 2014

TypeScript &

Your Team

Size of Project

# devs

Your Team's Experience

Lifetime of Project

Motivation

Alternatives

JavaScript

  • "strict mode"
  • js-hint, es-lint

Static Checkers

  • Google's Closure Compiler (@JsDoc)
  • Facebook Flow

ES6 / ES2015

  • Babel
  • Traceur

Merci.

criteo.com/careers

Do you really want a layer above your JavaScript?

By cniaulin

Do you really want a layer above your JavaScript?

  • 1,579