美文网首页
n ../../node_modules/@storybook/

n ../../node_modules/@storybook/

作者: SevenLonely | 来源:发表于2020-08-26 08:57 被阅读0次

    如题,在开发angular插件的时候发现报了如题错误

    n ../../node_modules/@storybook/channels/dist/index.d.ts:25:9 - error TS1086: An accessor cannot be declared in an ambient context.
    
    原因

    因为angular版本不匹配。 插件库用的typescript版本为3.8.3,在使用项目中typescript版本为3.5.3所以导致了出现如上的错误。

    解决办法

    尝试在tsconfig.json中配置 "skipLibCheck" :true, 即可解决问题

    {
      "compilerOptions": {
        "baseUrl": "src",
        "outDir": "./dist/out-tsc",
        "sourceMap": true,
        "declaration": false,
        "downlevelIteration": true,
        "experimentalDecorators": true,
        "module": "esnext",
        "moduleResolution": "node",
        "importHelpers": true,
        "target": "es2015",
    
        **"skipLibCheck": true,**
    
        "typeRoots": [
          "node_modules/@types"
        ],
        "lib": [
          "es2018",
          "dom"
        ]
      },
    }
    

    相关文章

      网友评论

          本文标题:n ../../node_modules/@storybook/

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