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

Closed
bahmutov opened this issue Feb 12, 2020 · 7 comments · Fixed by #6667
Closed

.its command with compound properties failing TypeScript check #6431

bahmutov opened this issue Feb 12, 2020 · 7 comments · Fixed by #6667
Labels
good first issue stage: ready for work type: typings

Comments

@bahmutov
Copy link
Contributor

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
Copy link
Contributor Author

bahmutov commented Feb 12, 2020

Work-around

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

@cypress-bot cypress-bot bot added the stage: ready for work label Feb 13, 2020
@jennifer-shehane jennifer-shehane added the good first issue label Feb 13, 2020
@arshmakker
Copy link

arshmakker commented Feb 26, 2020

can i work on this one?

@jennifer-shehane
Copy link
Member

jennifer-shehane commented Feb 26, 2020

@arshmakker yes we would love an open PR. Check out our contributing doc and ask us if you get stuck.

@arshmakker
Copy link

arshmakker commented Mar 3, 2020

Hi @jennifer-shehane

I am trying to write the test case:

cy.wrap({
   foo: {
    bar: 1
  }
}).its('foo.bar')

in the tests in 'CypressItsTests' namespace, I had two questions:

  1. is 'CypressItsTests' the right place for this?
  2. How to run exclusively the tests for 'CypressItsTests'

@jennifer-shehane jennifer-shehane added type: typings and removed topic: typescript labels Mar 3, 2020
@jennifer-shehane
Copy link
Member

jennifer-shehane commented Mar 3, 2020

  1. This seems correct.
  2. There is a Contributing Guide that covers how to contribute and get Cypress running locally in generally here: https://github.com/cypress-io/cypress/blob/develop/.github/CONTRIBUTING.md

Instructions for running the cli tests can be found here: https://github.com/cypress-io/cypress/blob/develop/cli/README.md

Please feel free to open a WIP PR where we can address questions about the specific code you're writing.

arshmakker added a commit to arshmakker/cypress that referenced this issue Mar 3, 2020
@cypress-bot cypress-bot bot added stage: work in progress stage: needs review and removed stage: ready for work stage: work in progress stage: needs review labels Mar 6, 2020
@cypress-bot cypress-bot bot added stage: needs review and removed stage: work in progress labels Mar 10, 2020
@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review labels Mar 11, 2020
@cypress-bot
Copy link

cypress-bot bot commented Mar 11, 2020

The code for this is done in cypress-io/cypress#6667, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link

cypress-bot bot commented Mar 16, 2020

Released in 4.2.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v4.2.0, please open a new issue.

@cypress-bot cypress-bot bot removed the stage: pending release label Mar 16, 2020
@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Mar 16, 2020
@cypress-bot cypress-bot bot added the stage: ready for work label Apr 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue stage: ready for work type: typings
Projects
None yet
3 participants