diff --git a/.gitignore b/.gitignore index 1dc3a23..6a5b8dc 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,6 @@ coverage .yarn .vscode lib -.env \ No newline at end of file +.env + +src/playground.tsx \ No newline at end of file diff --git a/src/__tests__/createFieldSchema.test.ts b/src/__tests__/createFieldSchema.test.tsx similarity index 68% rename from src/__tests__/createFieldSchema.test.ts rename to src/__tests__/createFieldSchema.test.tsx index 996f0c5..2f805a4 100644 --- a/src/__tests__/createFieldSchema.test.ts +++ b/src/__tests__/createFieldSchema.test.tsx @@ -1,3 +1,4 @@ +import React from "react"; import { z } from "zod"; import { addHiddenProperties, @@ -30,6 +31,38 @@ describe("createFieldSchema", () => { createTsForm(mapping); }).not.toThrowError(); }); + it("should correctly type the form with multiple unique field schemas.", () => { + const A = createUniqueFieldSchema(z.string(), "one"); + const B = createUniqueFieldSchema(z.string(), "two"); + function In1(_: { req: string }) { + return
; + } + function In2(_: { req2: string }) { + return ; + } + const mapping = [ + [A, In1], + [B, In2], + ] as const; + + const Form = createTsForm(mapping); + +