cypress-documentation icon indicating copy to clipboard operation
cypress-documentation copied to clipboard

Types mismatch between docs and code

Open 403-html opened this issue 3 years ago • 1 comments

Current behavior

When trying to override the type method in typescript, I got errors from typescript linter. It's 1:1 copy and paste from docs .

I get 3 errors.

  1. for $el; it's only accepting JQuery<HTMLElement>... where element from docs is string type. image

  2. for message; it's only accepting string type, but the text is Partial<Cypress.TypeOptions> type. image

  3. for originalFn; it's accepting 1-2 arguments, but docs says to pass options as 3rd argument image

Desired behavior

Docs tips should match the actual code typing

Test code to reproduce

Cypress.Commands.overwrite('type', (originalFn, element, text, options = {}) => {
  if (options.maskLog) {
    options.log = false;
    Cypress.log({
      $el: element,
      name: 'type',
      message: '*'.repeat(text.length),
    });
  }

  return originalFn(element, text, options);
});

Cypress Version

10.10.0

Node version

v16.13.2

Operating System

MacOS 12.6

Debug Logs

No response

Other

No response

403-html avatar Oct 13 '22 14:10 403-html

Was able to reproduce and created a quick reproduction here. going to route to e2e team and since it should be simple I should have some time to work on it

AtofStryker avatar Oct 13 '22 21:10 AtofStryker