Skip to content

Commit

Permalink
fixed the typeScript annotation error
Browse files Browse the repository at this point in the history
  • Loading branch information
KaleemNeslit committed Jan 13, 2025
1 parent 5c62f88 commit efb5f2d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libs/schemas/src/entities/user.schemas.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Roles, WalletId } from '@hicommonwealth/shared';
import { z } from 'zod';
import { ZodType, z } from 'zod';
import { PG_INT } from '../utils';
import { Tags } from './tag.schemas';

Expand Down Expand Up @@ -65,6 +65,10 @@ export const User = z.object({
created_at: z.coerce.date().optional(),
updated_at: z.coerce.date().optional(),
});
// Type annotation is needed to avoid:
// The inferred type of this node exceeds the maximum length the compiler will serialize.
// An explicit type annotation is needed.ts(7056)
type User = z.infer<typeof User>;

export const Address = z.object({
id: PG_INT.optional(),
Expand All @@ -84,7 +88,7 @@ export const Address = z.object({
is_banned: z.boolean().default(false),
hex: z.string().max(64).nullish(),

User: User.optional(),
User: User.optional() as ZodType<User>,

created_at: z.coerce.date().optional(),
updated_at: z.coerce.date().optional(),
Expand Down

0 comments on commit efb5f2d

Please sign in to comment.