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
Hello, I am currently implementing enhanced form actions like so in a +page.server.ts file:
exportconstenhancedFormAction=(next: Action)=>{returnasyncfunction(context){// logic that eventually wants to pass some data throughreturnawaitnext({ ...context, formData })}}exportconstactions: Actions={new: enhancedFormAction((async({ request, fetch, formData })=>{// form action content that wants to use data from enhance function})}
Currently there is no type safety for this; the formData throws a ts error. Is there any way to do this with type safety? Is this poor design?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I am currently implementing enhanced form actions like so in a
+page.server.ts
file:Currently there is no type safety for this; the
formData
throws a ts error. Is there any way to do this with type safety? Is this poor design?Beta Was this translation helpful? Give feedback.
All reactions