typescript: error TS2693: 'Promise' only refers to a type, but is being used as a value here

前端 未结 22 2686
猫巷女王i
猫巷女王i 2020-11-29 19:35

I am trying to use Typescript for my AWS Lambda and i am getting the following errors where ever I use promises.

error TS2693: \'Promise\' only refers to a type,          


        
22条回答
  •  孤街浪徒
    2020-11-29 19:46

    I had the same problem and this saved me from the problem in second:

    write in console this:

    npm i --save bluebird
    npm i --save-dev @types/bluebird @types/core-js@0.9.36
    

    in the file where the problem is copy paste this:

    import * as Promise from 'bluebird';
    

提交回复
热议问题