相关疑难解决方法(0)

如何在 typescript-eslint/no-namespace 下声明 Cypress 自定义命令的类型?

Cypress 文档显示了如何声明自定义命令类型

declare global {
  namespace Cypress {
    interface Chainable {
      /**
       * Custom command to select DOM element by data-cy attribute.
       * @example cy.dataCy('greeting')
       */
      dataCy(value: string): Chainable<Element>
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

但 Typescript ESLint 对此并不满意,因为“ES2015 模块语法优于自定义 TypeScript 模块和命名空间 @typescript-eslint/no-namespace”。是否可以将其重写为导入/导出,如果可以,如何重写?或者我应该禁用这种情况的规则?

typescript cypress typescript-eslint

17
推荐指数
1
解决办法
4549
查看次数

标签 统计

cypress ×1

typescript ×1

typescript-eslint ×1