Define your Go types.
package welcome
type Props struct {
Message string `json:"message"`
Error string `json:"error"`
}Note
All json tags are optional.
package welcome
type Props struct {
Message string `json:"message"`
Error string `json:"error"`
}package main
import (
"main/lib/core/types"
"main/lib/routes/todos"
)
func main() {
_ = types.Generate[todos.Props]()
}frizzante generate type # or go run ./types
export type Props = welcome.Props
export declare namespace welcome {
export type Props = {
message: string
error: string
}
}<script lang="ts">
import type { Props } from "$lib/types/server/main/lib/routes/welcome/props"
let { message, error }:Props = $props()
</script>