Skip to content

Commit

Permalink
Add ApplicationWindow type for user-defined properties in Window object
Browse files Browse the repository at this point in the history
  • Loading branch information
sainthkh committed Jun 25, 2020
1 parent ed80066 commit daca22a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion cli/types/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ declare namespace Cypress {
fromAutWindow: WindowPosition & { x: number, y: number }
}

/**
* The interface for user-defined properties in Window object.
*/
interface ApplicationWindow {} // tslint:disable-line

/**
* Several libraries are bundled with Cypress by default.
*
Expand Down Expand Up @@ -2001,7 +2006,7 @@ declare namespace Cypress {
})
```
*/
window(options?: Partial<Loggable & Timeoutable>): Chainable<Window & typeof globalThis>
window(options?: Partial<Loggable & Timeoutable>): Chainable<Window & typeof globalThis & ApplicationWindow>

/**
* Scopes all subsequent cy commands to within this element.
Expand Down
2 changes: 1 addition & 1 deletion cli/types/tests/kitchen-sink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ namespace BlobTests {
}

cy.window().then(window => {
window // $ExpectType Window & typeof globalThis
window // $ExpectType Window & typeof globalThis & ApplicationWindow

window.eval('1')
})

0 comments on commit daca22a

Please sign in to comment.