Rebasely Beta: data may be purged

justintypescript-ultra-strict Public

TypeScript · 22 lines · 695 B · at f30ac63

export type Signup = {  email: string;  password: string;  birthDate: string;  referralCode?: string;};export type SignupField = "email" | "password" | "confirmPassword" | "birthDate" | "referralCode";export type SignupCode = "required" | "format" | "too_short" | "no_digit" | "mismatch" | "too_young";export type FieldError = { field: SignupField; code: SignupCode };export class SignupError extends Error {  readonly kind = "invalid" as const;  constructor(public readonly errors: FieldError[]) {    super("invalid");  }}/** Throws SignupError listing every invalid field. */export function validateSignup(form: Record<string, unknown>, today: string): Signup {  // TODO}