-
Notifications
You must be signed in to change notification settings - Fork 274
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 error for async resolvers that can return null #55
Comments
Nope, it's related to #50, pushing a fix shortly |
Released in 0.9.15 |
Hey @tgriesser, thank you for the very fast response! Unfortunately, I am still getting the TypeScript error in my project with the latest version. When I constructed the failing example, I just picked a number because it seemed to break it. I will dig a bit deeper and see what type I use that makes it fail. |
Hmm, maybe I am missing something or I misunderstood how backing types are meant to work. Here is a failing example:
The And here is the error:
|
Ah thanks for the example - I don't think you're misunderstanding how the backing types should work, I believe the issue is #50, need to clean up/add better typings for Just pushed a quick fix in 0.9.17 to see if that fixes the issue you're having currently, otherwise will look to address this more thoroughly soon. |
* develop: Add a field-level authorize property (#32) v0.9.17 More for #55, type error on Promise/null resolve v0.9.16 Update changelog Fix #52, incorrect Symbol type for arg definition (#57) Add extendInputType (#54) Update examples v0.9.15 Update changelog Fix #55 (#56) fix missing comma in code example (#49) Fix docs for shouldGenerateArtifacts default (#47)
Thank you a lot! This works very well for us now. |
@tgriesser I'm still seeing this issue using the latest version when using async functions + nullable + backing type. I tried adding |
We are also seeing the error again on the latest version. We are still running v0.11.2 without issues. |
Ok - going to work on a better testing strategy for these sorts of things using https://github.com/Microsoft/dtslint will keep you posted |
This issue seems to be occurring in
|
The issue seems to be a persistent issue, we are using v0.11.6
|
Related issue: #470 |
Should be resolved by #475 |
I am getting a TypeScript error when using
async
resolvers that can also returnnull
. In the following example I could just remove theasync
but I would like to useawait
inside the resolver. Is there anything I am missing?The error is:
However, returning promises by themselves inside the resolver without an
async
does work:The
async
keyword changes the return type fromPromise<null> | Promise<number>
toPromise<null | number>
which seems to be the problem?Is this related to #28? The author also used a nullable
async
function and was wondering why he has to set the return type of the resolver toPromise<any>
(which does the trick by ignoring the problem).The text was updated successfully, but these errors were encountered: