Skip to content
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

.its command with compound properties failing TypeScript check #6431

Open
bahmutov opened this issue Feb 12, 2020 · 1 comment
Open

.its command with compound properties failing TypeScript check #6431

bahmutov opened this issue Feb 12, 2020 · 1 comment

Comments

@bahmutov
Copy link
Contributor

@bahmutov bahmutov commented Feb 12, 2020

Cypress v3, v4

Our typescript definition for cy.its command "understands" the properties of the subject, thus it can do

cy.wrap({ foo: 1 }).its('foo') // yup, subject has property "foo"

but it does not understand nested (compound) properties that Lodash _.get can do and we use under the hood

cy.wrap({
  foo: {
    bar: 1
  }
}).its('foo.bar') // oops, TypeScript freaks out, "foo.bar" is invalid

Maybe someone can look at Lodash and its TypeScript definition for _.get to see if they have solved this problem and bring the solution?

@bahmutov

This comment has been minimized.

Copy link
Contributor Author

@bahmutov bahmutov commented Feb 12, 2020

Work-around

Add // @ts-ignore above the its('foo.bar') command to ignore just this line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.