#How to disable access to "prototype" property when targeting classes?

2 messages · Page 1 of 1 (latest)

wispy wedge
#
export class ManagementDTO {
  static SessionDTO = z.object({
    idUser: PositiveIntegerSchema,
    token: NonEmptyStringSchema,
    lastActivity: NonEmptyStringSchema.date(),
    deviceAddress: NonEmptyStringSchema,
    userAgent: NonEmptyStringSchema,
    isValid: z.boolean(),
  });
}

type WithoutPrototype<T> = {
  [K in keyof T as K extends "prototype" ? never : K]: T[K];
};

export type IManagementDTO<Attr extends keyof typeof ManagementDTO> =
  WithoutPrototype<typeof ManagementDTO[Attr]> extends z.ZodType<infer T> ? T : never;


  const d: IManagementDTO<""> = {

  }
weak pawn
#

just Exclude it