Async/Await with TypeScript

Async/await syntax in TypeScript for handling promises.

Snippet:

async function fetchData(): Promise<string> { const response = await fetch("url"); return await response.json(); }

Example:

async function getUser(): Promise<User> { const res = await fetch("/api/user"); return await res.json(); }