File tree Expand file tree Collapse file tree 4 files changed +39
-0
lines changed
src/routes/(v2)/v2/component-sf-type Expand file tree Collapse file tree 4 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ import { superValidate } from '$lib/index.js' ;
2+ import { zod } from '$lib/adapters/zod.js' ;
3+ import { three } from './schema.js' ;
4+
5+ export const load = async ( ) => {
6+ const form = await superValidate ( zod ( three ) ) ;
7+ return { form } ;
8+ } ;
Original file line number Diff line number Diff line change 1+ <script lang =" ts" >
2+ import { superForm } from ' $lib/index.js' ;
3+ import Form from ' ./Form.svelte' ;
4+
5+ export let data;
6+
7+ const superform = superForm (data .form );
8+ </script >
9+
10+ <h4 >Component with different types</h4 >
11+
12+ <Form {superform } />
Original file line number Diff line number Diff line change 1+ <script lang =" ts" >
2+ import { type SuperForm } from ' $lib/index.js' ;
3+ // Remove "c: string" to show a complicated type error
4+ export let superform: SuperForm <{ a: string ; b: string ; c: string }>;
5+ </script >
6+
7+ <form method ="POST" use:superform .enhance {...$$restProps }></form >
Original file line number Diff line number Diff line change 1+ import { z } from 'zod' ;
2+
3+ export const three = z . object ( {
4+ a : z . string ( ) ,
5+ b : z . string ( ) ,
6+ c : z . string ( )
7+ } ) ;
8+
9+ export const two = z . object ( {
10+ a : z . string ( ) ,
11+ b : z . string ( )
12+ } ) ;
You can’t perform that action at this time.
0 commit comments