Rebasely Beta: data may be purged

justintypescript-ultra-strict Public

Text · 19 lines · 623 B · at 8b87e58

import { type Option, type Result } from "@tsus/runtime";export type Profile = { name: string; email: Option<string>; phone: Option<string> };/** * `None` means keep. For email and phone, `Some(None)` means clear and * `Some(Some(value))` means set. For name, `Some(value)` means set. */export type ProfilePatch = {  name: Option<string>;  email: Option<Option<string>>;  phone: Option<Option<string>>;};export type ProfileError = { kind: "invalid_name" | "invalid_email" | "invalid_phone" };export const applyPatch = (profile: Profile, patch: ProfilePatch): Result<Profile, ProfileError> => {  // TODO};