Skip to content

Commit 911d399

Browse files
committed
svelte-check fixes
1 parent f9d3e1d commit 911d399

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

src/routes/(v1)/tests/reset-component-2/+page.svelte

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
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();
@@ -16,7 +17,7 @@
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"
@@ -28,7 +29,7 @@
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>
@@ -38,14 +39,14 @@
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>

src/routes/(v1)/tests/reset-component-2/TextField.svelte

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
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>

0 commit comments

Comments
 (0)