-
Notifications
You must be signed in to change notification settings - Fork 3.4k
chore: Remove pkg/driver //@ts-nocheck part 3 #19837
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
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 = {}) { | ||||||||||||||||||||||||
|
options = _.defaults({}, userOptions, { | |
$el: subject, | |
log: true, | |
verify: true, | |
force: false, | |
delay: config('keystrokeDelay') || $Keyboard.getConfig().keystrokeDelay, | |
release: true, | |
parseSpecialCharSequences: true, | |
waitForAnimations: config('waitForAnimations'), | |
animationDistanceThreshold: config('animationDistanceThreshold'), | |
}) |
And TypeScript treats it as a type error. That's why it's commented.
By the way, I tried to rename user-given options
and internal options as opts
in #6459. But it was rejected and refactored in the current style. Maybe we need to find a way to name our internal option objects to solve this problem.
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 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 comment
The 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 // @ts-nocheck
comments. (I believe the part 4 will be the final.)
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 estimated when removing TODO
s will be done. And it might take 1-2 months in current speed. So, I decided to add a note above.
I guess we need this somewhere in our code.
sainthkh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
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 = {}) => { | ||||
|
return getAndClear() |
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