defineDeposit
defineDeposit<
Name,Schema>(name,options):DepositKind<Name,Schema>
Declares a kind of deposit at module scope: its name, kebab-case and
one per game, and the schema its payload is checked against where it
is sent and where it is received. Register the kinds once, so each
receive hook is typed by its kind:
declare module "@spawnite/engine" { interface Register { deposits: typeof donation | typeof tribute } }.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
Name extends string |
Schema extends SaveSchema |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name |
Name |
options |
{ schema: Schema; } |
options.schema |
Schema |
Returns
Section titled “Returns”DepositKind<Name, Schema>
Example
Section titled “Example”export const donation = defineDeposit("donation", { schema: z.object({ coins: z.number() }), });