diff --git a/packages/zod/src/__tests__/contract.test-d.ts b/packages/zod/src/__tests__/contract.test-d.ts index 5f9ace12..c9d3b854 100644 --- a/packages/zod/src/__tests__/contract.test-d.ts +++ b/packages/zod/src/__tests__/contract.test-d.ts @@ -61,14 +61,14 @@ describe('zodContract', () => { test('branded type', () => { const BrandedContainer = zod.object({ - branded: zod.string().brand<'Branded'>() - }) - const brandedContract = zodContract(BrandedContainer) + branded: zod.string().brand<'Branded'>(), + }); + const brandedContract = zodContract(BrandedContainer); const smth: unknown = { branded: 'branded' }; if (brandedContract.isData(smth)) { expectTypeOf(smth).toEqualTypeOf>(); } - }) + }); }); diff --git a/packages/zod/src/zod_contract.ts b/packages/zod/src/zod_contract.ts index c5378a6e..03c5e064 100644 --- a/packages/zod/src/zod_contract.ts +++ b/packages/zod/src/zod_contract.ts @@ -1,4 +1,4 @@ -import { type ZodType } from 'zod'; +import { type ZodType, type TypeOf } from 'zod'; import { type Contract } from '@farfetched/core'; /** @@ -8,7 +8,7 @@ import { type Contract } from '@farfetched/core'; * @param {ZodType} data Zod Contract for valid data */ function zodContract>(data: T): Contract> { - function isData(prepared: unknown): prepared is D { + function isData(prepared: unknown): prepared is T { return data.safeParse(prepared).success; }