File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed
src/routes/(v1)/tests/reset-component-2 Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 11<script lang =" ts" >
22 import { registerSchema } from ' ./schema.js' ;
33
4- import SuperForm from ' ./Form.svelte' ;
4+ import Form from ' ./Form.svelte' ;
55 import TextField from ' ./TextField.svelte' ;
66 import { zod } from ' $lib/adapters/zod.js' ;
7+ import type { Infer , SuperForm } from ' $lib/index.js' ;
78
89 let visible = $state (true );
910 let { data } = $props ();
1617
1718<button onclick ={() => (visible = ! visible )}>Toggle</button >
1819
19- {#snippet msg (message )}
20+ {#snippet msg (message : { status: number ; text : string } )}
2021 {#if message }
2122 <div
2223 class =" status"
2829 {/if }
2930{/ snippet }
3031
31- {#snippet fields (form )}
32+ {#snippet fields (form : SuperForm < Infer < typeof registerSchema >> )}
3233 <TextField type ="text" {form } field =" name" label =" Name" />
3334 <TextField type ="text" {form } field =" email" label =" E-Mail" />
3435 <p >
3839
3940{#if visible }
4041 <!-- SuperForm with dataType 'form' -->
41- <SuperForm
42+ <Form
4243 action =" ?/register"
4344 schema ={zod (registerSchema )}
4445 data ={data .regForm }
4546 invalidateAll ={false }
4647 {msg }
4748 {fields }
48- ></SuperForm >
49+ ></Form >
4950{/if }
5051
5152<style >
Original file line number Diff line number Diff line change 1- <script lang =" ts" >
2- import { formFieldProxy } from ' $lib/client/index.js' ;
1+ <script lang =" ts" context =" module" >
2+ type T = Record <string , unknown >;
3+ </script >
4+
5+ <script lang =" ts" generics =" T extends Record<string, unknown>" >
6+ import { formFieldProxy , type FormPathLeaves , type SuperForm } from ' $lib/client/index.js' ;
37
48 let _class = ' ' ;
59
610 export { _class as class };
711 export let label: string | undefined = undefined ;
8- export let field: string ;
9- export let form;
12+ export let field: FormPathLeaves < T > ;
13+ export let form: SuperForm < T > ;
1014
1115 const { value, errors } = formFieldProxy (form , field );
1216 </script >
You can’t perform that action at this time.
0 commit comments