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

invoke returning Promise<any> rather than query return type #515

Closed
Swapnull opened this issue Feb 27, 2021 · 1 comment · Fixed by blitz-js/blitz#2044
Closed

invoke returning Promise<any> rather than query return type #515

Swapnull opened this issue Feb 27, 2021 · 1 comment · Fixed by blitz-js/blitz#2044

Comments

@Swapnull
Copy link

What is the problem?

Originally asked: https://discord.com/channels/802917734999523368/814627766694838293/814822759519354892

When doing invoke(someQuery, {}), the type returned should be whatever someQuery returns. It seems to be Promise<any>.

What are detailed steps to reproduce this?

Repo with example: https://github.com/Swapnull/invoke-any-error-blitz

Can also be tested by generating crud using blitz generate crud myModel and then trying to use invoke(getMyModel, {}) somewhere in code.

Run blitz -v and paste the output here:

macOS Big Sur | darwin-x64 | Node: v15.5.1

blitz: 0.30.5 (global)
blitz: 0.30.5 (local)

  Package manager: yarn 
  System:
    OS: macOS 11.2.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 58.35 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 15.5.1 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.3.0 - /usr/local/bin/npm
    Watchman: Not Found
  npmPackages:
    @prisma/client: ~2.17 => 2.17.0 
    blitz: 0.30.5 => 0.30.5 
    prisma: ~2.17 => 2.17.0 
    react: 0.0.0-experimental-3310209d0 => 0.0.0-experimental-3310209d0 
    react-dom: 0.0.0-experimental-3310209d0 => 0.0.0-experimental-3310209d0 
    typescript: 4.2.2 => 4.2.2 ```


@flybayer
Copy link
Member

Probably we need to use our Await utility type to extract the true return type here

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

Successfully merging a pull request may close this issue.

3 participants