-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
TS: separate Window type for application under test #7806
Conversation
Thanks for taking the time to open a PR!
|
cli/types/index.d.ts
Outdated
// Mike Woudenberg <https://github.com/mikewoudenberg> | ||
// Robbert van Markus <https://github.com/rvanmarkus> | ||
// Nicholas Boll <https://github.com/nicholasboll> | ||
// TypeScript Version: 3.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did the entire file change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I'll check if there's a change like line-ending.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line ending was changed at d719f66. Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add an e2e test where we have a typescript fixture with ApplicationWindow
interface with user property? To confirm the TS passes. Alternatively, and maybe even better is to add a recipe to cypress-example-recipes to show users how to add a property to window
and have the types work out of the box.
cli/types/index.d.ts
Outdated
// Mike Woudenberg <https://github.com/mikewoudenberg> | ||
// Robbert van Markus <https://github.com/rvanmarkus> | ||
// Nicholas Boll <https://github.com/nicholasboll> | ||
// TypeScript Version: 3.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can a PR to cypress-documentation for page https://on.cypress.io/typescript show the ApplicationWindow
example AND minimum TypeScript version needed (3.4) in this case?
cli/types/cypress.d.ts
Outdated
@@ -2001,7 +2006,7 @@ declare namespace Cypress { | |||
}) | |||
``` | |||
*/ | |||
window(options?: Partial<Loggable & Timeoutable>): Chainable<Window> | |||
window(options?: Partial<Loggable & Timeoutable>): Chainable<Window & typeof globalThis & ApplicationWindow> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there other instances of Chainable<Window>
that should also be updated?
Can we open an issue documenting this fix and why it's necessary. Also per @bahmutov's comments, it seems like there's a bit more work to do on this PR yeah? |
I had a clear description in my original PR, but sadly that was closed: #6624 |
It's recommended to create an issue before submitting a PR in the contributing guide.
Sometimes, ignoring guides can cause unwanted results. (And I also know that it's really tedious to read every contributing guide before contributing.) Anyway, I opened an issue at #7856. |
There are 3 more things to do:
|
@sainthkh proceed ahead - we are trying to release |
@sainthkh
|
I've opened a PR for the docs to update the min required version to 3.4+ cypress-io/cypress-documentation#2945 |
Previously this would type error: ```ts cy.window().then(window => window.eval('1')); ```
`globalThis` was added in 3.4.
It seems that kitchensink needs update after #7782. (CircleCI result link) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good to go, once merged into v5.0-release
we will add testing the recipe cypress-io/cypress-example-recipes#515 PR
User facing changelog
Window
objectWindow
object type in Application Window.Breaking change
Additional details
Why was this change necessary?
TypeScript users cannot use valid typescript types.
What is affected by this change?
N/A
Any implementation details to explain?
N/A
How has the user experience changed?
N/A
PR Tasks
cypress-documentation
? Update typescript doc to specify minimum required TS version cypress-documentation#2945type definitions
?cypress.schema.json
?