You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an async fuction that I use in my use directive, but LSP gives me a type error although the code works as intended.
I use async in my handler because I use dynamic imports in my action.
I was informed on the discord by MotionlessTrain that the actions are supposed to sync, but instead suggested to use promises. On another site I also found example of using an async function inside the action handler, and assigning it to an event. Sorry for the inconvenience, I will close the issue.
Perhaps, the documentation could be updated to make this requirement stated for other users?
Describe the bug
I have an async fuction that I use in my use directive, but LSP gives me a type error although the code works as intended.
I use async in my handler because I use dynamic imports in my action.
Argument of type 'Promise<ActionReturn<undefined, Record<never, any>>> is not assignable to parameter of type '__sveltets_2_SvelteActionReturnType'.
If I use:
The type error disappears from the parent component, but I get a "you must use Promise.." in my handler.
Reproduction
The type for Action is here:
https://github.com/sveltejs/svelte/blob/83b92372c22da2f8a0f8350fa856087a7170275b/packages/svelte/types/index.d.ts#L434
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: