由于对 DefinitelyTyped 的依赖,dtslint 失败

dtslint fails because of dependency in DefinitelyTyped

根据上次 PR 的一些反馈,我正在努力改进 DefinitelyTyped@testing-library/cypress 的打字。

我添加了 cypress 作为依赖项,因为它的类型没有在 DefinitelyTyped 中定义,但是 运行ning dtslint 失败了,因为它 运行s 与 typescript@next。如果我 运行 dtslint --localTstypescript@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"'.

关于如何进行此操作的任何建议?我想 dtslint 运行s 和 typescript@next 是有原因的,但对我来说似乎不稳定。是更新 cypressjquery 类型的唯一选项吗?

可以看到我正在做的改进here

我遇到了同样的问题。

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

// TypeScript Version: 3.5

似乎需要在 Cypress 的捆绑类型中修复它。 Cypress issue #5065