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

Suggestion: TypeScript: remove fallback for should to increase type safety #5573

Closed
OliverJAsh opened this issue Nov 1, 2019 · 3 comments · Fixed by #8068
Closed

Suggestion: TypeScript: remove fallback for should to increase type safety #5573

OliverJAsh opened this issue Nov 1, 2019 · 3 comments · Fixed by #8068
Labels
type: typings Issue related to Cypress types (for TypeScript)

Comments

@OliverJAsh
Copy link
Contributor

OliverJAsh commented Nov 1, 2019

Current behavior:

cy.get('foo').should('whatevergoeshere'); // no error :-(

cy.get('foo').should('exis'); // oops, typo—but no error :-(
cy.get('foo').should('exist'); // ✅

Desired behavior:

cy.get('foo').should('whatevergoeshere'); // type error, `whatevergoeshere` is not a valid assertion

cy.get('foo').should('exis'); // type error, `exis` is not a valid assertion
cy.get('foo').should('exist'); // ✅
@OliverJAsh OliverJAsh changed the title TypeScript: remove fallback for should to increase type safety Suggestion: TypeScript: remove fallback for should to increase type safety Nov 1, 2019
samijaber added a commit to samijaber/cypress that referenced this issue Nov 1, 2019
@cypress-bot cypress-bot bot added the stage: proposal 💡 No work has been done of this issue label Nov 1, 2019
@cypress-bot cypress-bot bot added stage: work in progress stage: needs review The PR code is done & tested, needs review and removed stage: proposal 💡 No work has been done of this issue stage: work in progress labels Nov 4, 2019
@cypress-bot cypress-bot bot added stage: work in progress and removed stage: needs review The PR code is done & tested, needs review labels Dec 20, 2019
@cypress-bot cypress-bot bot added stage: ready for work The issue is reproducible and in scope and removed stage: work in progress labels Feb 26, 2020
@jennifer-shehane jennifer-shehane added type: typings Issue related to Cypress types (for TypeScript) and removed topic: typescript labels Mar 3, 2020
@cypress-bot cypress-bot bot added stage: work in progress and removed stage: ready for work The issue is reproducible and in scope labels Jul 23, 2020
@sainthkh
Copy link
Contributor

I tried to remove this, but I think that's impossible with current chai.js. There are too many valid combinations and we cannot cover everything. And we might block some valid assertions.

And this type of error is not hard to find. It can be easily found by running tests once.

So, I decided to add more types and leave the fallback.

@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review and removed stage: work in progress labels Jul 28, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jul 28, 2020

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

@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Jul 28, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 3, 2020

Released in 4.12.0.

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

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Aug 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: typings Issue related to Cypress types (for TypeScript)
Projects
None yet
3 participants