felvin-search / instant-apps

Your search box is now an app store! 🎉
https://felvin.com
Other
95 stars 47 forks source link

`TS2322`: Type `'undefined'` is not assignable to type `'Promise<any>'` #219

Closed FirePing32 closed 2 years ago

FirePing32 commented 3 years ago

After creating a fresh instant-app from yarn create-app, changing the data variable inside the queryToData() function to anything(string, object) breaks the app with the following error -

TS2322: Type '({ query }: { query: any; }) => { name: string; } | undefined' is 
not assignable to type 'queryToData'.
  Type '{ name: string; } | undefined' is not assignable to type 'Promise<any>'.
    Type 'undefined' is not assignable to type 'Promise<any>'.

The exact issue for this breakdown is not known. A temporary fix would be to make queryToData() async, even if the function does not perform any GET/POST requests.

FirePing32 commented 3 years ago

@sahil-shubham Please add bug label.

hargup commented 2 years ago

I think this was fixed. @FirePing32 please feel free to reopen if the issue persists. Thanks for reporting the bug 😄