VOL.2
Sr Software Engineer at Humu
@charliesbot
Co-host @Los Full Stackers podcast
OUTDATED
JS
TS
let aString = "I'm a string";
let aNumber = 1;
let aBoolean = true;
// string
// number
// boolean
const aString = "I'm a string";
const aNumber = 1;
const aBoolean = true;
// "I'm a string"
// 1
// true
It's a type definition whose type is any value you'd simply type out exactly
They describe a value that can be one of several types (|)
type Animal = 'cat' | 'dog' | 'fish';
(Why not?)
They help us to create a component that can work over a variety of types rather than a single one.
// How can we reuse this function for every single type
// that you could imagine? 🤔
function identity(x) {
return x;
}
Agaaaaain
Twitter: @charliesbot
Podcast: Los Full Stackers