Loading topic
tsc to see the types it reports. The examples5 min readreturn statement gives back undefined.5 min readasync/await syntax, and that you can annotate parameters and return types in TypeScript. It covers how TypeScript types the value an async function produces, how await unwraps that value, and the mistakes that come up most often.5 min read(value: string) => number. Overloads build on all three.5 min readfunction identity<T>(x: T): T. It also assumes you know union types and object types. A constraint limits which types a caller may pass for a type parameter. It also tells the compiler what the function body may do with values of 5 min readtypeof, in and equality narrowing, union types, and how to write a function with typed parameters and a return type. It builds on the earlier chapters on annotations and function types.4 min readthis behaves in JavaScript: it depends on how a function is called, arrow functions capture it from their surroundings, and bind, call and apply set it explicitly. You should also be comfortable with function types and with calling methods on objects and cla5 min read(a: string) => number. It also assumes you know what void and never mean as return types, and that you have used strict mode in tsconfig.json. Here you will learn the rules the compiler applies when you assign one functio6 min readtypeof does in a type position, and that you have read the earlier chapters on function types and generics. You should be comfortable with Promise<T> and with generi4 min read