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

KeyedCost

KeyedCost<Cost> = [PlainNames<Cost>] extends [never] ? Cost : `“${Extract<PlainNames<Cost>, string | number>}” is no ResourceKey: key the cost by what defineResource returns, { [mana]: 25 }`

Cost where every key is one defineResource returned, and otherwise the line that names the fix, so a call refuses a name as text wherever the cost is written: in place, or held in a variable, where a returned key reads back as text and passes. A record widened to text keys, Record<string, number>, passes, since no type tells it from a keyed cost held in a variable.

Type Parameter
Cost