Closed ccpacillos closed 4 years ago
I think it's a limitation on suggestion feature of VSCode
, I just tested and have exact same issue.
Having Promise<TResult>
as return value when asyncResult
set to true could produce some side effects if your resolver does not return a promise (which can be fix easily by making your function async
), but I can make the type of asyncResult
option to be true | 'asyncOnly'
to ensure backward compatibility.
Thank you for the feedback. :smile:
Fixed by allow asyncResult
to accept always
option.
Under this option, resolve functions will always returns Promise<TResult>
, so basically any resolver function will need async
keyword.
When I set
asyncResult
option totrue
, the return type of the resolvers are set toTResult | Promise<TResult>
as indicated in the docs, but when I useCtrl + Space
to see suggestions in my resolver returns, it does not give me field suggestions for the TResult. However, when I change all of the resolver return types fromTResult | Promise<TResult>
toPromise<TResult>
, I am already able to see field suggestions. Can we add an option to set resolver return types toPromise<TResult>
only? Will it produce undesired side effects?I'm not sure if it's because of my typescript configuration or not, and I'm still new in Typescript. I'm using VS Code as my editor.