-
For example: // /product/[slug]/+page.server.ts
export const load: PageServerLoad = (event) => {
// slug is not undefined
const product = productsBySlug[event.params.slug];
}
export const actions: Actions = {
default: (event) => {
// typescript complains because slug is possibly undefined
const product = productsBySlug[event.params.slug];
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
geodask
Apr 13, 2025
Replies: 1 comment 5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make sure you are importing
Actions
like this:and not
In this way you will get the route specific types.