Skip to content

Instantly share code, notes, and snippets.

@jcreamer898
Created February 10, 2020 14:13
Show Gist options
  • Save jcreamer898/40290e70b6e13848c610d02ca88d1961 to your computer and use it in GitHub Desktop.
Save jcreamer898/40290e70b6e13848c610d02ca88d1961 to your computer and use it in GitHub Desktop.

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