Promise with TypeScript

Promise with TypeScript allows you to define the resolved type of a promise.

Snippet:

const promise: Promise<string> = new Promise((resolve, reject) => { resolve("Hello World"); });

Example:

const data: Promise<Data> = fetchData();