-
I'm not sure if I'm using it as intended because it's only referenced in the documentation.
I only get <!-- +page.svelte -->
<script lang="ts">
import type { Errors } from './$types'
export let errors: Errors // undefined
</script> // +page.server.ts
import type { Action } from './$types'
export const POST: Action = async ({ request, setHeaders }) => {
if (!condition) {
return {
errors: { message: '💩' }
}
}
} Despite the proper inference. // $types.d.ts
// type Errors = { message: string } 👍️
export type Errors = Kit.AwaitedErrors<typeof import('./proxy+page.server.js').POST> |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I hope this might be solved in #6469 with the transition to actions and also throwing rather than returning errors. However my experience is the same for the errors object being undefined and I have been able to properly build the types for the errors object using the following steps:
These steps seem to be required on both TS and JSDoc typed projects. |
Beta Was this translation helpful? Give feedback.
-
SvelteKit introduced form actions replacing |
Beta Was this translation helpful? Give feedback.
SvelteKit introduced form actions replacing
errors
withform
that had the same problem but is now resolved after #6748.