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

TypeScript: Incorrect subject type from returning a wrapped `undefined` from `.then` #1219

Closed
NicholasBoll opened this Issue Jan 23, 2018 · 1 comment

Comments

3 participants
@NicholasBoll
Contributor

NicholasBoll commented Jan 23, 2018

It is valid to return a wrapped undefined. Example: cy.wrap(undefined) or Promise.resolve(undefined) or even cy.wrap(null).

In this case, the subject is a wrapped undefined instead of an unwrapped undefined.

  • Operating System: N/A
  • Cypress Version: 1.4.1
  • Browser Version: N/A

Is this a Feature or Bug?

Bug

Current behavior:

cy.get('body')
  .then(() => cy.wrap(undefined))
  .then((subject) => {
    subject // Cypress.Chainable<undefined>
  })

Desired behavior:

cy.get('body')
  .then(() => cy.wrap(undefined))
  .then((subject) => {
    subject // undefined
  })

How to reproduce:

See "Current behavior"

Test code:

See "Current behavior"

Additional Info (images, stack traces, etc)

PR is on the way

@brian-mann

This comment has been minimized.

Member

brian-mann commented Feb 5, 2018

Released in 1.4.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment