|
| 1 | +// reference code is written like below to avoid the clash in mocha types. |
| 2 | +// in most of the cases, simple <reference types="cypress" /> will do. |
| 3 | +/// <reference path="../../../node_modules/cypress/types/cy-blob-util.d.ts" /> |
| 4 | +/// <reference path="../../../node_modules/cypress/types/cy-bluebird.d.ts" /> |
| 5 | +/// <reference path="../../../node_modules/cypress/types/cy-moment.d.ts" /> |
| 6 | +/// <reference path="../../../node_modules/cypress/types/cy-minimatch.d.ts" /> |
| 7 | +/// <reference path="../../../node_modules/cypress/types/lodash/index.d.ts" /> |
| 8 | +/// <reference path="../../../node_modules/cypress/types/sinon/index.d.ts" /> |
| 9 | +/// <reference path="../../../node_modules/cypress/types/jquery/index.d.ts" /> |
| 10 | +/// <reference path="../../../node_modules/cypress/types/cypress.d.ts" /> |
| 11 | +/// <reference path="../../../node_modules/cypress/types/cypress-type-helpers.d.ts" /> |
| 12 | +/// <reference path="../../../node_modules/cypress/types/cypress-global-vars.d.ts" /> |
| 13 | + |
| 14 | +declare namespace Cypress { |
| 15 | + // add custom Cypress command to the interface Chainable<Subject> |
| 16 | + interface Chainable<Subject=any> { |
| 17 | + // let TS know we have a custom command cy.clickLink(...) |
| 18 | + clickLink(label: string | number | RegExp): void |
| 19 | + } |
| 20 | + |
| 21 | + // add properties the application adds to its "window" object |
| 22 | + // by adding them to the interface ApplicationWindow |
| 23 | + interface ApplicationWindow { |
| 24 | + // let TS know the application's code will add |
| 25 | + // method window.add with the following signature |
| 26 | + add(a: number, b: number): number |
| 27 | + } |
| 28 | +} |
0 commit comments