diff --git a/src/schemas/asset.schema.ts b/src/schemas/asset.schema.ts index 108d214..296c9ac 100644 --- a/src/schemas/asset.schema.ts +++ b/src/schemas/asset.schema.ts @@ -68,7 +68,8 @@ function requirePersonWhenAssigned( copy: AssetSchemaCopy, ) { return schema.superRefine((data, ctx) => { - if (data.status === "ASSIGNED" && !data.personId) { + const value = data as { status?: string; personId?: string | undefined } + if (value.status === "ASSIGNED" && !value.personId) { ctx.addIssue({ code: "custom", path: ["personId"], diff --git a/tests/unit/components/inventory/assets/edit.asset.form.test.ts b/tests/unit/components/inventory/assets/edit.asset.form.test.ts index 634a599..655fce6 100644 --- a/tests/unit/components/inventory/assets/edit.asset.form.test.ts +++ b/tests/unit/components/inventory/assets/edit.asset.form.test.ts @@ -96,7 +96,7 @@ describe("edit asset form", () => { processing: "Processing", success: "Success", }, - }), + } as never), ) expect(html).toContain("Asset Tag") @@ -182,7 +182,7 @@ describe("edit asset form", () => { processing: "Processing", success: "Success", }, - }), + } as never), ) for (const status of [ diff --git a/tests/unit/components/inventory/assets/new.asset.form.test.ts b/tests/unit/components/inventory/assets/new.asset.form.test.ts index c36ff70..3ab1b0f 100644 --- a/tests/unit/components/inventory/assets/new.asset.form.test.ts +++ b/tests/unit/components/inventory/assets/new.asset.form.test.ts @@ -79,7 +79,7 @@ describe("new asset form", () => { processing: "Processing", success: "Success", }, - }), + } as never), ) expect(html).toContain("Asset Tag") @@ -149,7 +149,7 @@ describe("new asset form", () => { processing: "Processing", success: "Success", }, - }), + } as never), ) expect(html).toContain('value="AVAILABLE"')