Property 'allSettled' does not exist on type 'PromiseConstructor'.ts(2339)

后端 未结 3 1268
慢半拍i
慢半拍i 2020-12-16 11:14

I\'m trying to use the Promise.allSettled API with TypeScript. Code here:

server.test.ts:

it(\'shou         


        
3条回答
  •  时光说笑
    2020-12-16 11:50

    It's ES2020 and at Stage 4, so not available everywhere without a polyfill. It got typed and merged into TS. Try installing the latest @types/node package and see if that pulls it in.

    Update: Looks like it will be adding es2020.promise to the libs, when it does land.

    Update: npm i typescript@3.8.0-beta woot woot!

提交回复
热议问题