Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

defineProducts

defineProducts<Schemas>(products): Readonly<typeof products>

A game’s products by key, checked and returned as they are, each key typed. A price is whole Spawnites from 10 to 10,000, a consumable needs a grant and a durable product has none, stock and perPlayerLimit are whole numbers from 1, and a game declares at most 200. Throws, naming the first product it refuses and what it breaks, for any other. A consumable’s context types what its grant receives. Register the keys once with declare module "@spawnite/engine" { interface Register { products: typeof products } }.

Type Parameter
Schemas extends Record<string, unknown>
Parameter Type
products { [Key in string | number | symbol]: ProductDeclaration<SchemaOrNone<Schemas[Key]>> }

Readonly<typeof products>