Conversation
Previously this would type error:
```ts
cy.window().then(window => window.eval('1'));
```
|
Thanks for the contribution! Below are some guidelines Cypress uses when doing PR reviews.
PR Review ChecklistIf any of the following requirements can't be met, leave a comment in the review selecting 'Request changes', otherwise 'Approve'. User Experience
Functionality
Maintainability
Quality
Internal
|
jennifer-shehane
left a comment
There was a problem hiding this comment.
@OliverJAsh There's an error in the TS Lint, additionally, can you add a test for this? In the appropriate file under cli/types/tests
Error: /root/cypress/cli/types/index.d.ts:1967:82
ERROR: 1967:82 expect Compile error in typescript@3.3 but not in typescript@3.4.
Fix with a comment '// TypeScript Version: 3.4' just under the header.
Cannot find name 'globalThis'.
at /root/cypress/node_modules/dtslint/bin/index.js:190:19
at Generator.next (<anonymous>)
at fulfilled (/root/cypress/node_modules/dtslint/bin/index.js:5:58)
|
@OliverJAsh Regarding the issue we talked about — here's a suggestion for how we can really get the right If my suggestion falls outside the scope of this pull request, please let me know — I can open a separate issue or a pull request instead. Problem When you run a test with Cypress, there are two
These are different Solution Allow users to define global variables separately. In interface ApplicationWindow {}Change the definition for window(options?: Partial<Loggable & Timeoutable>): Chainable<Window & typeof globalThis & ApplicationWindow>Usage The users can now define properties that exist on the yielded declare global {
namespace Cypress {
interface ApplicationWindow {
__FOO__?: string;
}
}
} |
| // Robbert van Markus <https://github.com/rvanmarkus> | ||
| // Nicholas Boll <https://github.com/nicholasboll> | ||
| // TypeScript Version: 2.9 | ||
| // TypeScript Version: 3.4 |
There was a problem hiding this comment.
This seems like a spooky/major change? Are we sure this isn't going to impact folks downstream maybe using earlier TS?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
We've run into this before, so this is not the first time this has been suggested. #4950 (review)
There was a problem hiding this comment.
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)?
There was a problem hiding this comment.
3.4 is the minimum version if we want to use globalThis
Dismissing my previous reviews to allow for others to review actual code changes.
|
@OliverJAsh Can you fix the conflicts? We just made some TS changes that we merged in. |
|
@jennifer-shehane Done |
sainthkh
left a comment
There was a problem hiding this comment.
According to the TypeScript breaking changes list, some vendor-specific types are removed in TypeScript 3.1.
I think it's a better idea to apply this PR to Cypress 5.0. It can potentially break users' types.
|
We're looking to release 5.0, with breaking changes. Is it possible to reevaluate this PR? |
|
@jennifer-shehane I will. |
|
Close in favor of #7806 |

Previously this would type error:
(
windowshould have typeWindow & typeof globalThis.)You may want to fix other instances of
Chainable<Window>as well.User facing changelog
Additional details
How has the user experience changed?
PR Tasks
cypress-documentation?type definitions?cypress.schema.json?