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

[🐞] onResolved cannot return a Promise #7086

Open
maiieul opened this issue Nov 22, 2024 · 2 comments
Open

[🐞] onResolved cannot return a Promise #7086

maiieul opened this issue Nov 22, 2024 · 2 comments
Labels
COMP: DX Developer Experience related issue COMP: typescript TYPE: bug Something isn't working

Comments

@maiieul
Copy link
Contributor

maiieul commented Nov 22, 2024

Which component is affected?

Qwik Runtime

Describe the bug

Trying to await a function inside onResolved in a I get

Type '(appointments: MyCustomType) => Promise' is not assignable to type '(value: MyCustomType) => JSXOutput'.
Type 'Promise' is not assignable to type 'JSXOutput'.ts(2322)
core.d.ts(2280, 5): The expected type comes from property 'onResolved' which is declared here on type 'IntrinsicAttributes & ResourceProps'

But even though typescript complains, the code works on my end. So I guess it's just an easy fix on the ts side.

Reproduction

https://stackblitz.com/edit/github-b7kqvv?file=src%2Froutes%2Findex.tsx

Steps to reproduce

Open stackblitz repro, maybe edit the index.tsx file (add a space anywhere to get the ts highlighter).

System Info

🙅‍♂️

Additional Information

No response

@maiieul maiieul added TYPE: bug Something isn't working STATUS-1: needs triage New issue which needs to be triaged COMP: DX Developer Experience related issue COMP: typescript and removed STATUS-1: needs triage New issue which needs to be triaged labels Nov 22, 2024
@Varixo
Copy link
Member

Varixo commented Nov 23, 2024

This is probably fixed in v2 :D

@maiieul
Copy link
Contributor Author

maiieul commented Nov 26, 2024

Although the type fix is probably an easy fix in v1 too no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
COMP: DX Developer Experience related issue COMP: typescript TYPE: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants