Search code examples
typescripttypescript-typingslintdefinitelytyped

dtslint fails because of dependency in DefinitelyTyped


I'm working on improving typings for @testing-library/cypress in DefinitelyTyped after some feedback from my last PR.

I've added cypress as a dependency as its typings is not defined in DefinitelyTyped, but running dtslint fails because it runs with typescript@next. If I run dtslint --localTs with [email protected] there is no error.

dtslint results in the following error:

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

Any suggestions on how to proceed with this? I guess there is a reason dtslint runs with typescript@next, but it seems unstable to me. Is the only option to update the jquery typings in cypress?

The improvements I am working on can be seen here.


Solution

  • Seems like it needs to be fixed in the bundled typings in Cypress. Cypress issue #5065