Last active
April 30, 2024 11:40
-
-
Save alfredlucero/4d1201c9f43dcf71931f8f3b8dc7d514 to your computer and use it in GitHub Desktop.
Cypress Tips/Tricks - Typing Task Plugin Functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Can import types from other files using TypeScript's typed imports functionality | |
type BlocksDto = import("../plugins/Suppressions/setup").BlocksDto; | |
// Or you can define the types here as well in this type definition file | |
type ApiHost = "https://staging.api.com" | "https://testing.api.com" | string; | |
declare namespace Cypress { | |
interface Cypress { | |
// ...environment variables | |
} | |
interface Chainable<Subject> { | |
// ...custom commands | |
task( | |
event: 'teardownUnverifiedDomains', | |
arg: { | |
username: string; | |
token: string; | |
}, | |
options?: Partial<Loggable & Timeoutable> | |
): Chainable<boolean>; | |
task( | |
event: 'getBlocks', | |
arg: { token: string; apiHost: ApiHost; limit: number }, | |
options?: Partial<Loggable & Timeoutable> | |
): Chainable<BlocksDto>; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment