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

fix: prevObject types #21106

Merged
merged 6 commits into from Apr 21, 2022
Merged

Conversation

atarek12
Copy link
Contributor

@atarek12 atarek12 commented Apr 15, 2022

User facing changelog

Fix Cypress.Command.add() TypeScript types. Fixes #20376

  • Infer the subject type to be an element while using prevSubject: true option
  • Adding property selector to the subject while using prevSubject: true | "element" option

Additional details

This change fixes typescript errors while using the Cypress.Command.add() with { prevSubject: true } or { prevSubject: "element" }

How has the user experience changed?

No typescript error while trying to access the selector.

Cypress.Commands.add("newCommand", { prevSubject: "element" }, (element) => {
  element.selector // no typescript error
});

PR Tasks

  • Have tests been added/updated?
  • Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • Has a PR for user-facing changes been opened in cypress-documentation?
  • Have API changes been updated in the type definitions?
  • Have new configuration options been added to the cypress.schema.json?

@atarek12 atarek12 requested a review from a team as a code owner April 15, 2022 22:44
@atarek12 atarek12 requested review from jennifer-shehane and removed request for a team April 15, 2022 22:44
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 15, 2022

Thanks for taking the time to open a PR!

@atarek12 atarek12 changed the title fix-prevObject-types fix: prevObject types Apr 15, 2022
@atarek12
Copy link
Contributor Author

atarek12 commented Apr 15, 2022

@flotwig here is the new PR against the latest changes in the develop branch as you requested here

@emilyrohrbough emilyrohrbough self-requested a review April 19, 2022 16:26
@BlueWinds BlueWinds requested a review from flotwig April 19, 2022 19:52
@emilyrohrbough emilyrohrbough merged commit 342bc06 into cypress-io:develop Apr 21, 2022
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 25, 2022

Released in 9.6.0.

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

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Apr 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
5 participants