Tsallaka zuwa abun ciki
Justice Tech School

Promises and async Types

Async functions return Promise<T>. await gives T.

Example
async function load(): Promise<number> { return 42; }
async function main() { const n = await load(); console.log(n + 1); }
main();

Result

43

Exercise

Return type.

async function f(): <number>

Quiz Test

What does await give from Promise<T>?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.