Types in JavaScript

First Reaction

Error?

function logPerson(person){
    console.log('Person with Name:' + person.name.toUpperCase());
}

Depends

function logPerson(person){
    console.log('Person with Name:' + person.name.toUpperCase());
}

logPerson({name: 'foo'});
logPerson({bar: 'bar'});

Types

WAT is this?

WAT is this?

http://trends.builtwith.com/javascript/jQuery

Cost

Convinience

Soundness

Cost

Convinience

Soundness

JSDoc

https://developers.google.com/closure/compiler/docs/js-for-compiler#types

http://usejsdoc.org/tags-type.html

FlowType

http://flowtype.org/

TypeScript

http://www.typescriptlang.org/

Types

Primitives

Types

Magic Literals

Magic literals

Others Types

Objects

Call Signatures

Type Unions

Arrays

Construct Signatures

Open Ended

Ambient

Generics

Cost

Convinience

Soundness

Cost

Convinience

Soundness

Thank you

@basarat

Types in JavaScript

By basarat

Types in JavaScript

  • 1,745