📜  ts 异步函数类型 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:33.956000             🧑  作者: Mango

代码示例1
// async anonymous  function always returns a Promise
const dramaticWelcome: Promise = async () => {
    console.log("Hello");

    for (let i = 0; i < 5; i++) {
        // await is converting Promise into number
        const count: number = await delay(500, i);
        console.log(count);
    }

    console.log("World!");
}