Skip to content

Commit 8b1e4b4

Browse files
committed
Added recursive schema test for FormPathLeaves.
1 parent 7097f74 commit 8b1e4b4

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/paths.test-d.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import type {
33
StringPath,
44
FormPathType,
55
FormPathArrays,
6-
StringPathLeaves
6+
StringPathLeaves,
7+
FormPathLeaves
78
} from '$lib/stringPath';
89
import { test } from 'vitest';
10+
import { z } from 'zod';
911

1012
type Obj = {
1113
name: string;
@@ -173,3 +175,14 @@ test('Objects with sets', () => {
173175
// @ts-expect-error incorrect path
174176
const b3: SetTest = 'numbers.set.size';
175177
});
178+
179+
// Recursive schema test
180+
const baseExampleSchema = z.object({
181+
name: z.string()
182+
});
183+
184+
const exampleSchema = baseExampleSchema.extend({
185+
children: z.lazy(() => baseExampleSchema.array().optional())
186+
});
187+
188+
type ExampleFormPathLeaves = FormPathLeaves<z.infer<typeof exampleSchema>>;

0 commit comments

Comments
 (0)