【发布时间】:2019-12-30 08:29:05
【问题描述】:
我正在努力改进 DefinitelyTyped 中 @testing-library/cypress 的分型,因为我收到了上一个 PR 的一些反馈。
我已将cypress 添加为依赖项,因为它的类型在DefinitelyTyped 中未定义,但运行dtslint 失败,因为它与typescript@next 一起运行。如果我用typescript@3.5.3 运行dtslint --localTs,则没有错误。
dtslint 导致以下错误:
Error: Errors in typescript@next for external dependencies:
node_modules/cypress/types/jquery/index.d.ts(8155,87): error TS2344: Type '"button" | "view" | "altKey" | "bubbles" | "cancelable" | "changedTouches" | "ctrlKey" | "detail" | "eventPhase" | "metaKey" | "pageX" | "pageY" | "shiftKey" | "char" | "charCode" | ... 13 more ... | "touches"' does not satisfy the constraint '"repeat" | "button" | "code" | "view" | "y" | "altKey" | "bubbles" | "cancelable" | "changedTouches" | "ctrlKey" | "detail" | "eventPhase" | "metaKey" | "pageX" | "pageY" | "shiftKey" | ... 54 more ... | "DOM_KEY_LOCATION_STANDARD"'.
Type '"toElement"' is not assignable to type '"repeat" | "button" | "code" | "view" | "y" | "altKey" | "bubbles" | "cancelable" | "changedTouches" | "ctrlKey" | "detail" | "eventPhase" | "metaKey" | "pageX" | "pageY" | "shiftKey" | ... 54 more ... | "DOM_KEY_LOCATION_STANDARD"'.
关于如何进行此操作的任何建议?我想dtslint 与typescript@next 一起运行是有原因的,但对我来说似乎不稳定。是更新cypress 中的jquery 类型的唯一选择吗?
我正在做的改进可以在here看到。
【问题讨论】:
标签: typescript typescript-typings lint definitelytyped