Rebasely Beta: data may be purged

justintypescript-ultra-strict Public

TypeScript · 15 lines · 472 B · at 83c2f03

export type AmountFailure = { kind: "invalid_amount"; input: string } | { kind: "too_large" };export class AmountError extends Error {  declare readonly kind: AmountFailure["kind"];  declare readonly input?: string;  constructor(failure: AmountFailure) {    super(failure.kind);    Object.assign(this, failure);  }}/** Returns integer cents. Throws AmountError on malformed or oversized input. */export function parseAmount(text: string): number {  // TODO}