Skip to content

Types mismatch between docs and code #5518

Open
@403-html

Description

@403-html

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

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

image

  1. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    E2EtriagedIssue has been routed to backlog. This is not a commitment to have it prioritized by the team.type: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions