在我上次PR反馈后,我正在努力改善@testing-library/cypress
中DefinitelyTyped
的打字方式。
我添加了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"'.
关于如何进行此操作的任何建议?我想dtslint
与typescript@next
一起运行是有原因的,但对我来说似乎不稳定。是更新jquery
中的cypress
类型的唯一选择吗?
可以看到我正在努力的改进here。
答案 0 :(得分:0)
我遇到了同样的问题。
您可以在index.d.ts
顶部指定带有以下注释的打字稿版本:
// TypeScript Version: 3.5
答案 1 :(得分:0)
似乎需要在赛普拉斯的捆绑打字中修复它。 Cypress issue #5065