Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

What even is TypeScript?

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment