import { isly } from "isly" import { Status } from "./Status" export interface Change { type: T amount: number status: Status result?: number } export namespace Change { export const operand = ["add", "subtract"] as const export type Operand = (typeof operand)[number] export const type = isly.object({ type: isly.string(["add", "subtract"]), amount: isly.number(), status: Status.type, result: isly.number().optional(), }) export namespace Add { export const type = Change.type.extend>({ type: isly.string("add"), }) } export namespace Subtract { export const type = Change.type.extend>({ type: isly.string("subtract"), }) } }