Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct window type #6624

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions cli/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Mike Woudenberg <https://github.com/mikewoudenberg>
// Robbert van Markus <https://github.com/rvanmarkus>
// Nicholas Boll <https://github.com/nicholasboll>
// TypeScript Version: 2.9
// TypeScript Version: 3.4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a spooky/major change? Are we sure this isn't going to impact folks downstream maybe using earlier TS?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's needed to support globalThis. It may well affect your users, so you might want to put this PR on hold until more of your users are on 3.4 or above.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've run into this before, so this is not the first time this has been suggested. #4950 (review)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we just accepted a pull to move to 3.0, I'm guessing that's going to be a conflict -- curious if these changes work at that level (3.0)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3.4 is the minimum version if we want to use globalThis

// Updated by the Cypress team: https://www.cypress.io/about/

/// <reference path="./cy-blob-util.d.ts" />
Expand Down Expand Up @@ -1964,7 +1964,7 @@ declare namespace Cypress {
})
```
*/
window(options?: Partial<Loggable & Timeoutable>): Chainable<Window>
window(options?: Partial<Loggable & Timeoutable>): Chainable<Window & typeof globalThis>

/**
* Scopes all subsequent cy commands to within this element.
Expand Down
2 changes: 2 additions & 0 deletions cli/types/tests/kitchen-sink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,5 @@ const obj = {
foo: () => { }
}
cy.spy(obj, 'foo').as('my-spy')

cy.window().then(window => window.eval('1'))
OliverJAsh marked this conversation as resolved.
Show resolved Hide resolved