dtslint因DefinitelyTyped中的依赖性而失败

时间:2019-08-26 06:45:29

标签: typescript typescript-typings lint definitelytyped

在我上次PR反馈后,我正在努力改善@testing-library/cypressDefinitelyTyped的打字方式。

我添加了cypress作为依赖项,因为在DefinitelyTyped中未定义其类型,但是运行dtslint失败,因为它与typescript@next一起运行。如果我用dtslint --localTs运行typescript@3.5.3,则没有错误。

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"'.

关于如何进行此操作的任何建议?我想dtslinttypescript@next一起运行是有原因的,但对我来说似乎不稳定。是更新jquery中的cypress类型的唯一选择吗?

可以看到我正在努力的改进here

2 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。

您可以在index.d.ts顶部指定带有以下注释的打字稿版本:

// TypeScript Version: 3.5

答案 1 :(得分:0)

似乎需要在赛普拉斯的捆绑打字中修复它。 Cypress issue #5065