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

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

    Finally tsc started working without any errors. But multiple changes. Thanks to Sandro Keil, Pointy & unional

    • Removed dt~aws-lambda
    • Removed options like noEmit,declaration
    • Modified Gruntfile and removed ignoreSettings

    tsconfig.json

    {
        "compileOnSave": true,
        "compilerOptions": {
            "module": "commonjs",
            "target": "es5",
            "noImplicitAny": false,
            "strictNullChecks": true,
            "alwaysStrict": true,
            "preserveConstEnums": true,
            "sourceMap": false,
            "moduleResolution": "Node",
            "lib": [
                "dom",
                "es2015",
                "es5",
                "es6"
            ]
        },
        "include": [
            "*",
            "src/**/*"
        ],
        "exclude": [
            "./node_modules"
        ]
    }
    

    Gruntfile.js

    ts: {
                app: {
                    tsconfig: {
                        tsconfig: "./tsconfig.json"
                    }
                },
    ...
    

提交回复
热议问题