【问题标题】:dtslint fails because of dependency in DefinitelyTypeddtslint 失败,因为 DefinitiveTyped 中的依赖
【发布时间】: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"'.

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

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

【问题讨论】:

    标签: typescript typescript-typings lint definitelytyped


    【解决方案1】:

    我遇到了同样的问题。

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

    // TypeScript Version: 3.5
    

    【讨论】:

    • 我已经在 index.d.ts 中指定了 3.0 版本,但它仍然使用 typescript@next 运行。
    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 2011-04-08
      • 2023-01-04
      • 2020-10-15
      • 2018-06-21
      • 2018-07-17
      • 1970-01-01
      • 2021-05-07
      • 1970-01-01
      • 2019-06-16
      相关资源
      最近更新 更多