Annotate promise-returning APIs explicitly.
Section: Async and Promise Types
Use `Promise<T>`
typescript
typescript
function wait(ms: number): Promise<void> {
return new Promise(resolve => setTimeout(resolve, ms));
}Explanation
Useful for utilities, service functions, and browser or Node wrappers.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Async and Promise Types
Type an async function
Return a typed promise from an async function.
Model a result union
Represent success and failure without throwing.
Narrow with `instanceof`
Refine class-based unions using constructor checks.