Next: typescripts-type-system
Typescript is a superset of Javascript, with extra functionality:
We can annotate the type of a function like so:
function greet(who: string) {
console.log("Hello", who);
}
Typescript has better error handling than javascript:
let city = "new york city";
console.log(city.toUppercase());
Will throw this error:
TypeError: city.toUppercase is not a function
Typescript’s type checker can spot the problem a little bit better:
let city = "new york city";
console.log(city.toUppercase());
// ~~~~~~~~~~~ Property 'toUppercase' does not exist on type
// 'string'. Did you mean 'toUpperCase'?
Next: typescripts-type-system