Loading topic
Array<T>. It also assumes you know async/await syntax and can narrow union types. The chapter covers what type an async function has, how TypeScript infers it, and which mistakes the compiler does not catch.5 min readasync functions. Sometimes the API you need still uses callbacks, events, or timers. In that case you build the promise yourself with the Promise constructor. This chapter shows how to type that constructor, how to wrap callback APIs w5 min readArray<T>, union types and narrowing, and the async/await syntax. You should also know that an async function returns a Promise<T>, which the previous chapters covered. Here you will learn how to derive the type of6 min readcatch clause has type unknown, how to narrow it safely, and where TypeScript's help on errors ends. It assumes you know basic TypeScript types, union types and narrowing, and async/await. It also assumes you have seen try/catch in JavaScript.6 min readasync/await. You should also know that Promise<T> is the type of a value that arrives later. The four combinators below take several promises and return one. Each does so with a different rule6 min readPromise<T> type, and basic type narrowing. It covers what the compiler reports when you forget an await, what it misses, and how to close the gap with a linter.5 min readArray<T>, how async/await works, and the Promise<T> and Awaited<T> types from earlier chapters. All examples assume "strict": true in tsconfig.json.5 min readasync/await, and how to narrow union types. It also assumes you have read the earlier chapters on Promise<T>, async functions, and why a catch variable is unknown.5 min readAbortController and AbortSignal, and the type system helps with the plumbing around them. T7 min readPromise<T> resolves once, so it cannot model these. TypeScript models them with async iterables, async generators, and the for await loop.6 min readArray<T>, async/await, and union narrowing. You should also have read the earlier chapters on Promise<T>, Awaited<T>, and error handling with unknown.6 min read