-
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
chore: Remove pkg/driver @ts-nocheck part 1 #19353
chore: Remove pkg/driver @ts-nocheck part 1 #19353
Conversation
Thanks for taking the time to open a PR!
|
const skipMouseupEvent = mouseDownPhase.events.pointerdown.skipped || mouseDownPhase.events.pointerdown.preventedDefault | ||
const skipMouseupEvent = mouseDownPhase.events.pointerdown.preventedDefault |
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.
By definition, mouseDownPhase.events.pointerdown.skipped
is always undefined
.
packages/driver/src/cy/mouse.ts
Outdated
@@ -720,6 +740,9 @@ const sendEvent = (evtName, el, evtOptions, bubbles = false, cancelable = false, | |||
evt.stopPropagation = function (...args) { | |||
evt._hasStoppedPropagation = true | |||
|
|||
// stopPropagation doesn't have argument. So, we cannot type-safely pass the second argument. |
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.
// stopPropagation doesn't have argument. So, we cannot type-safely pass the second argument. | |
// stopPropagation doesn't have any arguments. So, we cannot type-safely pass the second argument. |
packages/driver/src/cy/assertions.ts
Outdated
@@ -54,12 +52,18 @@ const isDomSubjectAndMatchesValue = (value, subject) => { | |||
return false | |||
} | |||
|
|||
type Parsed = { | |||
subject?: any |
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 these subjects always jQuery objects? if that is true, would the type be something like jQuery<TElement>
? Not sure it really matters here though.
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 handled it as JQuery<any>
. To use JQuery<TElement>
, we need the type info of value
.
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.
awesome!
@@ -77,7 +81,7 @@ export const create = (Cypress, cy) => { | |||
const getUpcomingAssertions = () => { | |||
const index = cy.state('index') + 1 | |||
|
|||
const assertions = [] | |||
const assertions: any[] = [] |
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.
const assertions: any[] = [] | |
const assertions: { attributes: EnqueuedCommand}[] = [] |
I think that is the right type here but I am not sure we have access to it's context in the driver
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.
The specific type of any
is $Command
here. But I made it to any
for now. Because it should be worked with $Cy.queue
and the other $Cy
members.
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.
Do we want to have the types be explicit with the the other cy members or address that in another PR? For now any
seems like it fits the bill 😄 .
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.
Right. Removing // @ts-nocheck
from pkg/driver
is a big work. So, I'm breaking them down to bite-size.
(Actually, there are sometimes so many things to think. So I'm postponing them for the later PRs.)
0e27c09
ffada01
to
0e27c09
Compare
…ert-with-stack * tgriesser/10.0-release/refactor-lifecycle: (50 commits) Remove unused test file update task spec to use correct projectRoot update Fix test Fix test Fix tests update tests fix test correct config path Fix TS resolve conflicts Fixing component & e2e tests build: fix dev process on windows (#19401) fix: `cy.contains()` ignores `<style>` and `<script>` without removing them. (#19424) Fix some tests chore: Fix the broken codeowners automation (#19431) chore: add types for Cypress.session.clearAllSavedSessions (#19412) fix: No unnecessary snapshotting (#19311) chore: Remove pkg/driver @ts-nocheck part 1 (#19353) fix: add CYPRESS_VERIFY_TIMEOUT param and a test for it (#19282) ...
create
into class$Cy
#18715User facing changelog
N/A. It's just removing
// @ts-nocheck
comments and defining types to avoid type errors.Additional details
How has the user experience changed?
N/A
PR Tasks
cypress-documentation
?type definitions
?cypress.schema.json
?