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

前端 未结 22 2618
猫巷女王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 20:01

    Solved by changing the target in compilerOptions.

    {
    "compilerOptions": {
        "module": "es2015",
        "target": "es2015",
        "lib": [
            "es2016",
            "dom"
        ],
        "moduleResolution": "node",
        "noImplicitAny": false,
        "sourceMap": false,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "outDir": "./public/js/app"
    },
    "exclude": [
        "node_modules",
        "public/js",
        "assets/app/polyfills.ts"
    ],
    "angularCompilerOptions": {
        "skipMetadataEmit": true
    }
    }
    

提交回复
热议问题