美文网首页
【TS】使用Promise报错

【TS】使用Promise报错

作者: 大Q本Q | 来源:发表于2019-07-19 13:56 被阅读0次

    IDE

    webstorm

    报错提示

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

    解决方法:

    1. npm i --save-dev @types/es6-promise
    2. /node_modules/vue-template-compiler/types/tsconfig.json
    {
        "compilerOptions": {
            "target": "es5",
            "module": "commonjs",
            "declaration": false,
            "noImplicitAny": false,
            "noLib": false,
            "moduleResolution": "node",
            "strict": true,
            "noEmit": true,
            "lib": [
                "ES5",
                "ES2015",
                "DOM",
                "ScriptHost"
            ]
        },
        "filesGlob": [
            "./**/*.ts",
            "!./node_modules/**/*.ts"
        ],
        "files": [
            "./main.ts",
            "./typings/es6-promise/es6-promise.d.ts"
        ],
        "compileOnSave": false,
        "include": [
            "**/*.ts"
        ]
    }
    

    相关文章

      网友评论

          本文标题:【TS】使用Promise报错

          本文链接:https://www.haomeiwen.com/subject/bsgjlctx.html