I’m having the following issues with some schemas on Zod, when I try to use a schema as a field of other schema I got the following error
Implicitly has type ‘any’ because it does not have a type annotation and is referenced directly or indirectly in its own initializer.ts(7022)
There are my two schemas
import { z } from 'zod';
import { CurrencySchema, ManagerPaymentSchema } from '.';
export const PayPalManagerSchema = z.object({
id: z.number().int(),
name: z.string(),
currency: CurrencySchema,
paypal_link: z.string(),
payments: z.array(ManagerPaymentSchema)
});
import { z } from 'zod';
import { PayPalManagerSchema } from '.';
export const CurrencySchema = z.object({
idCurrency: z.number().int(),
nameCurrency: z.string(),
symbolCurrency: z.string(),
codeCurrency: z.string().default('GBP'),
paypalManagers: z.array(PayPalManagerSchema)
});
I tried making recursive types and union but it doesn’t work
New contributor
Gerardo Gonzalo Nuez Bello is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.