JavaScript + Types = Typescript
TypeScript as a compilter
npm i -g typescript
./node_modules/.bin/tsc
@babel/preset-typescript
tsc ONLY for checking types babel -d --extensions .ts, .tsx dist src
bolt typecheck
Generics
interface User {
name: string;
id: number;
}
const fetchStuff = async (url) => {
const resp = await fetch(url);
const json = await resp.json()
return json;
};
const main = async main() {
const user = await fetchStuff('/api/v3/users/me');
user.
}
search state
When to use an interface vs a type?
Interfacing with JS files? Function
Usage of TypeScript in React / Redux