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

Hmm, Promise<never> when using an arrow function? #76

Open
bahmutov opened this issue Mar 1, 2022 · 12 comments
Open

Hmm, Promise<never> when using an arrow function? #76

bahmutov opened this issue Mar 1, 2022 · 12 comments

Comments

@bahmutov
Copy link
Owner

bahmutov commented Mar 1, 2022

recurse(
   () => cy.get('#output').invoke('text'),
   (text) => text === 'Surprise!',

TypeScript check complains about Promise<never>?

Screen Shot 2022-03-01 at 14 08 40

Making a full function seems to solve a problem, but why...

function getText() {
  return cy.get('#output').invoke('text')
}

recurse(getText, (text) => text === 'Surprise!')

Screen Shot 2022-03-01 at 14 10 33

cc @Stumblinbear

@Stumblinbear
Copy link
Contributor

Ahh, I see what happened. I was having issues getting JSDoc to be happy by not using TS overloading, but that seems to be causing issues. Let me quick fix that.

@Stumblinbear
Copy link
Contributor

Fixed by #78

@github-actions
Copy link

github-actions bot commented Mar 1, 2022

🎉 This issue has been resolved in version 1.14.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@bahmutov
Copy link
Owner Author

bahmutov commented Mar 7, 2022

Need to reopen, since still shows the same problem

Screen Shot 2022-03-07 at 08 01 55

@bahmutov bahmutov reopened this Mar 7, 2022
@bahmutov
Copy link
Owner Author

bahmutov commented Mar 7, 2022

@Stumblinbear ^^^

@Stumblinbear
Copy link
Contributor

Got a code sample to reproduce?

@bahmutov
Copy link
Owner Author

bahmutov commented Mar 7, 2022 via email

@Stumblinbear
Copy link
Contributor

I'm not getting any errors, even without the ts-ignores

@bahmutov
Copy link
Owner Author

bahmutov commented Mar 7, 2022

Re-installed, tried, the same thing :(

Screen Shot 2022-03-07 at 11 11 54

@Stumblinbear
Copy link
Contributor

Stumblinbear commented Mar 7, 2022

Try pulling my repo and see if you get the same thing. What's the return type of whatever value is in the recursive commandsFn lambda?

@bahmutov
Copy link
Owner Author

same, thing, for some reason it thinks cy.task('randomNumber') is Promise<never>

Screen Shot 2022-03-11 at 08 43 11

@Stumblinbear
Copy link
Contributor

Oh, it's through a task. That seems more like an issue with task than the types here. Is there a definition for defining the return type of 'randomNumber'?

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

No branches or pull requests

2 participants