JSFoo: round the year submissions

JSFoo: round the year submissions

Submit talks on JavaScript and full stack engineering round the year

Abhishek Yadav

@zerothabhishek

Javascript type systems - a land of surprises

Submitted May 31, 2018

Adding types-checks to Javascript sounded like a promising idea to me. Having created my fair share of undefined bugs, I was definitely interested. To be honest, I didn’t think there was so much to it.

We have used types in the elementary C language courses - how hard could it be in Javascript? There are some type annotations, some union types, and some function types - what else?

And then I came across code like this -

function passesShamelessly(): string {
  let arr = [];
  return arr[0];  // <- No error in Typescript. No error in Flow-type.
}

It is not a mistake. Its deliberate and documented. And this is not the only surprise. Typescript and Flow-type can surpise you in ridiculous ways.

This talk chronicles my jounrney through such surprises. With this exploration, we get to know what goes on in the making of a a practical type system - the philosophies and the trade-offs. And also the disagreements - the key points where two implementations (Typescript/Flow) differ.

Outline

Draft slides: https://slides.com/zerothabhishek/deck-31/

Outline

The content is structured as six discrete examples. Each of these examples represent a feature of Typescript/Flow that can lead to an intersting discussion.

It is not intended to be tutorial on the nuances of type-systems. Its more about approaching the nuances from a use-cases.

Requirements

Some elementary experience with Typescript or Flow

Speaker bio

A Ruby programmer at heart, I was only trying to catch the Typescript bandwagon for a side project. Moonlighted a bit with Elm. Still quite an outsider to Javascript world, perhaps that lends the perspective.

Slides

https://slides.com/zerothabhishek/deck-31/

Comments

{{ gettext('Login to leave a comment') }}

{{ gettext('Post a comment…') }}
{{ gettext('New comment') }}
{{ formTitle }}

{{ errorMsg }}

{{ gettext('No comments posted yet') }}

Hosted by

JSFoo is a forum for discussing UI engineering; fullstack development; web applications engineering, performance, security and design; accessibility; and latest developments in #JavaScript. Follow JSFoo on Twitter more