@types/dialogflow 包说 "dialogflow provides its own type definitions" 但似乎不是
@types/dialogflow package says "dialogflow provides its own type definitions" but it seems not
我正在使用 dialogflow npm package, which is different from actions-on-google or googleapis 包。
dialogflow 包没有自己的类型定义。因此,我一直在使用@types/dialogflow包一起。
最近从v0.11.0 to v4.0.4更新了类型定义包(@types/dialogflow),现在是最新版本,包里说
This is a stub types definition. dialogflow provides its own type
definitions, so you do not need this installed.
但是dialogflow npm包好像没有给出类型定义。 TS 编译器一直说
Could not find a declaration file for module 'dialogflow'. '....js'
implicitly has an 'any' type. Try npm install @types/dialogflow
if
it exists or add a new declaration (.d.ts) file containing declare module 'dialogflow';
ts(7016)
这个类型定义包有什么问题?
不确定,但这会有所帮助,但如果我使用的包没有类型定义,我总是使用这样的 es5 导入语法
const dialogflow = require('dialogflow');
如果您有任何问题,请告诉我
干杯。
据我所知,dialogflow 尚未发布其类型。没问题,它们甚至没有列在 this ticket that tracks google APIs type definitions. (referenced from here)
弃用 @types/dialogflow
的 This PR 没有添加任何相关 link 以表明它们是原生包含的。
同时我会在你的包裹json上添加@types/dialogflow
的固定版本
npm install @types/dialogflow@0.11.0
该版本似乎是弃用前的最后一个版本
更新
另一种选择according to this PR 是尝试以这种方式导入
import * as dialogflow from "dialogflow/protos/protos"
并验证 dialogflow
上的类型 - 也许您可能需要做一些返工
我正在使用 dialogflow npm package, which is different from actions-on-google or googleapis 包。
dialogflow 包没有自己的类型定义。因此,我一直在使用@types/dialogflow包一起。
最近从v0.11.0 to v4.0.4更新了类型定义包(@types/dialogflow),现在是最新版本,包里说
This is a stub types definition. dialogflow provides its own type definitions, so you do not need this installed.
但是dialogflow npm包好像没有给出类型定义。 TS 编译器一直说
Could not find a declaration file for module 'dialogflow'. '....js' implicitly has an 'any' type. Try
npm install @types/dialogflow
if it exists or add a new declaration (.d.ts) file containingdeclare module 'dialogflow';
ts(7016)
这个类型定义包有什么问题?
不确定,但这会有所帮助,但如果我使用的包没有类型定义,我总是使用这样的 es5 导入语法
const dialogflow = require('dialogflow');
如果您有任何问题,请告诉我
干杯。
据我所知,dialogflow 尚未发布其类型。没问题,它们甚至没有列在 this ticket that tracks google APIs type definitions. (referenced from here)
弃用@types/dialogflow
的 This PR 没有添加任何相关 link 以表明它们是原生包含的。
同时我会在你的包裹json上添加@types/dialogflow
的固定版本
npm install @types/dialogflow@0.11.0
该版本似乎是弃用前的最后一个版本
更新
另一种选择according to this PR 是尝试以这种方式导入
import * as dialogflow from "dialogflow/protos/protos"
并验证 dialogflow
上的类型 - 也许您可能需要做一些返工