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

前端 未结 22 2620
猫巷女王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:50

    I had the same issue with the aws-sdk and I solved it by using "target": "es2015". This is my tsconfig.json file.

    {
        "compilerOptions": {
            "outDir": "./dist/",
            "sourceMap": false,
            "noImplicitAny": false,
            "module": "commonjs",
            "target": "es2015"
        },
        "include": [
            "src/**/*"
        ],
        "exclude": [
            "node_modules",
            "**/*.spec.ts"
        ]
    }
    

提交回复
热议问题