-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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 3 #19837
Changes from all commits
7024b42
d6a566b
32473f3
9ba036f
782f4d7
3169800
35ddaa6
0db42d1
eaeee33
f05575e
d20e0ae
b6e2787
642956c
42101c9
f404f16
89a1f91
330913f
8e4291e
61ed8c5
4b9b7aa
b47480f
3ff094b
a7e4e96
d9a91d3
154dca5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,4 +1,3 @@ | ||||||||||||||||||||||||
// @ts-nocheck | ||||||||||||||||||||||||
import _ from 'lodash' | ||||||||||||||||||||||||
import Promise from 'bluebird' | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
|
@@ -15,7 +14,11 @@ const debug = debugFn('cypress:driver:command:type') | |||||||||||||||||||||||
export default function (Commands, Cypress, cy, state, config) { | ||||||||||||||||||||||||
const { keyboard } = cy.devices | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
function type (subject, chars, options = {}) { | ||||||||||||||||||||||||
// Note: These "change type of `any` to X" comments are written instead of changing them directly | ||||||||||||||||||||||||
// because Cypress extends user-given options with Cypress internal options. | ||||||||||||||||||||||||
// These comments will be removed after removing `// @ts-nocheck` comments in `packages/driver`. | ||||||||||||||||||||||||
// TODO: change the type of `any` to `Partial<Cypress.TypeOptions>` | ||||||||||||||||||||||||
function type (subject, chars, options: any = {}) { | ||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is preventing you from making this change now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cypress often extends then user-given cypress/packages/driver/src/cy/commands/actions/type.ts Lines 24 to 34 in bc87d6e
And TypeScript treats it as a type error. That's why it's commented. By the way, I tried to rename user-given There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a small notes summarizing what you explained here? It makes sense to me but might not be obvious to others without doing a deeper drive into the code base on the work required here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem is that this comment exists on almost every command. So it's a bit hard to find the right place. And I'll remove all of them after removing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I estimated when removing I guess we need this somewhere in our code. |
||||||||||||||||||||||||
const userOptions = options | ||||||||||||||||||||||||
let updateTable | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
|
@@ -366,7 +369,7 @@ export default function (Commands, Cypress, cy, state, config) { | |||||||||||||||||||||||
// Firefox sends a click event automatically. | ||||||||||||||||||||||||
if (!Cypress.isBrowser('firefox')) { | ||||||||||||||||||||||||
const ctor = $dom.getDocumentFromElement(el).defaultView?.PointerEvent | ||||||||||||||||||||||||
const event = new ctor('click') | ||||||||||||||||||||||||
const event = new ctor!('click') | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
el.dispatchEvent(event) | ||||||||||||||||||||||||
} | ||||||||||||||||||||||||
|
@@ -510,7 +513,8 @@ export default function (Commands, Cypress, cy, state, config) { | |||||||||||||||||||||||
}) | ||||||||||||||||||||||||
} | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
function clear (subject, options = {}) { | ||||||||||||||||||||||||
// TODO: change the type of `any` to `Partial<ClearOptions>` | ||||||||||||||||||||||||
sainthkh marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||
function clear (subject, options: any = {}) { | ||||||||||||||||||||||||
const userOptions = options | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
options = _.defaults({}, userOptions, { | ||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -1,5 +1,3 @@ | ||||
// @ts-nocheck | ||||
|
||||
import _ from 'lodash' | ||||
import Promise from 'bluebird' | ||||
|
||||
|
@@ -110,7 +108,7 @@ export default function (Commands, Cypress, cy, state, config) { | |||
}) | ||||
} | ||||
|
||||
const getAndClear = (log, timeout, options = {}) => { | ||||
const getAndClear = (log?, timeout?, options = {}) => { | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is log optional here? it's not optional for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because it's called without them at line 164.
|
||||
return automateCookies('get:cookies', options, log, timeout) | ||||
.then((resp) => { | ||||
// bail early if we got no cookies! | ||||
|
@@ -166,7 +164,8 @@ export default function (Commands, Cypress, cy, state, config) { | |||
}) | ||||
|
||||
return Commands.addAll({ | ||||
getCookie (name, options = {}) { | ||||
// TODO: change the type of `any` to `Partial<Cypress.Loggable & Cypress.Timeoutable>` | ||||
getCookie (name, options: any = {}) { | ||||
const userOptions = options | ||||
|
||||
options = _.defaults({}, userOptions, { | ||||
|
@@ -212,7 +211,8 @@ export default function (Commands, Cypress, cy, state, config) { | |||
.catch(handleBackendError('getCookie', 'reading the requested cookie from', onFail)) | ||||
}, | ||||
|
||||
getCookies (options = {}) { | ||||
// TODO: change the type of `any` to `Partial<Cypress.Loggable & Cypress.Timeoutable>` | ||||
getCookies (options: any = {}) { | ||||
const userOptions = options | ||||
|
||||
options = _.defaults({}, userOptions, { | ||||
|
@@ -250,7 +250,8 @@ export default function (Commands, Cypress, cy, state, config) { | |||
.catch(handleBackendError('getCookies', 'reading cookies from', options._log)) | ||||
}, | ||||
|
||||
setCookie (name, value, options = {}) { | ||||
// TODO: change the type of `any` to `Partial<Cypress.SetCookieOptions>` | ||||
setCookie (name, value, options: any = {}) { | ||||
const userOptions = options | ||||
|
||||
options = _.defaults({}, userOptions, { | ||||
|
@@ -331,7 +332,8 @@ export default function (Commands, Cypress, cy, state, config) { | |||
}).catch(handleBackendError('setCookie', 'setting the requested cookie in', onFail)) | ||||
}, | ||||
|
||||
clearCookie (name, options = {}) { | ||||
// TODO: change the type of `any` to `Partial<Cypress.Loggable & Cypress.Timeoutable>` | ||||
clearCookie (name, options: any = {}) { | ||||
const userOptions = options | ||||
|
||||
options = _.defaults({}, userOptions, { | ||||
|
@@ -380,7 +382,8 @@ export default function (Commands, Cypress, cy, state, config) { | |||
.catch(handleBackendError('clearCookie', 'clearing the requested cookie in', onFail)) | ||||
}, | ||||
|
||||
clearCookies (options = {}) { | ||||
// TODO: change the type of `any` to `Partial<Cypress.Loggable & Cypress.Timeoutable>` | ||||
clearCookies (options: any = {}) { | ||||
const userOptions = options | ||||
|
||||
options = _.defaults({}, userOptions, { | ||||
|
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.
Won't this caused typescript errors for individuals using JQuery methods other than find and expr?
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.
nvm. this isn't the types provided via the cli! sorry aboutt that