'stream'的所有声明必须具有相同的修饰符api-ai-javascript-Dialogflow

Joe*_*mas 5 angular dialogflow-es angular7

我正在尝试在Angular 7中集成Dialogflow。出现此错误。

  ** Angular Live Development Server is listening on localhost:4200, 
open your browser on http://localhost:4200/ **

Date: 2018-11-22T13:47:11.748Z
Hash: 4075ca64830b90f82558
Time: 4597ms
chunk {main} main.js, main.js.map (main) 1.85 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 92.4 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 16.2 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 318 kB [initial] [rendered]

ERROR in node_modules/api-ai-javascript/declarations.d.ts(39,5): error TS2687: All declarations of 'stream' must have identical modifiers.

? ?wdm?: Failed to compile.
Run Code Online (Sandbox Code Playgroud)

ton*_*nes 6

我想我一直在关注相同的教程,我在这里遇到了这个线程中的解决方案

你忙导入库的部分应该有这个路径

import { ApiAiClient } from 'api-ai-javascript/es6/ApiAiClient'
Run Code Online (Sandbox Code Playgroud)

在你的 tsconfig.json

{
 "compileOnSave": false,
 "compilerOptions": {
   ...
   "baseUrl":"./",
   "typeRoots": ["node_modules/@types"],
   "lib": ["es2017", "dom"],
   "paths":{
      "api-ai-javascript/*":["node_modules/api-ai-javascript/es6/*]
   }
 }
}
Run Code Online (Sandbox Code Playgroud)

希望这会有所帮助,这确实消除了编译错误,我能够继续。

来源

  • 我设法让它工作,而无需修改我的 tsconfig 文件,只需更改导入:) 感谢您的帮助。 (2认同)

Me *_* Sa 6

我有同样的错误,只有在导入行中更改以下,它才修复。

import {ApiAiClient} from 'api-ai-javascript/es6/ApiAiClient';
Run Code Online (Sandbox Code Playgroud)


Nee*_*nde 4

为了临时解决此问题,我在 tsconfig.json 文件中添加了以下检查

  "compilerOptions": {
    "skipLibCheck": true
  }
Run Code Online (Sandbox Code Playgroud)