Rebasely Beta: data may be purged

justintypescript-ultra-strict Public

Text · 19 lines · 555 B · at 9c48a39

import { type Result } from "@tsus/runtime";export type Account = { balanceCents: number; frozen: boolean };export type TransferError =  | { kind: "invalid_amount" }  | { kind: "same_account" }  | { kind: "unknown_account"; id: string }  | { kind: "frozen"; id: string }  | { kind: "insufficient_funds"; id: string; balanceCents: number; amountCents: number };export const transfer = (  accounts: Record<string, Account>,  from: string,  to: string,  amountCents: number,): Result<Record<string, Account>, TransferError> => {  // TODO};