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

oneOf

oneOf<Values>(values): OneOfCommandField<Values[number]>

One value of a closed set: a list of strings, oneOf(["red", "teal"]); a string enum, oneOf(DoorState); or a registry a world holds, whose names are read as each value arrives, oneOf(AbilityRegistryTrait). A system reads the value, typed by the set. The room refuses a value outside it, so no code field carries free text. As Yup’s and Zod’s oneOf and enum; enum is a reserved word.

Type Parameter
Values extends readonly [string, string]
Parameter Type
values Values

OneOfCommandField<Values[number]>

oneOf<Value>(values): OneOfCommandField<Value>

One value of a closed set: a list of strings, oneOf(["red", "teal"]); a string enum, oneOf(DoorState); or a registry a world holds, whose names are read as each value arrives, oneOf(AbilityRegistryTrait). A system reads the value, typed by the set. The room refuses a value outside it, so no code field carries free text. As Yup’s and Zod’s oneOf and enum; enum is a reserved word.

Type Parameter
Value extends string
Parameter Type
values readonly Value[]

OneOfCommandField<Value>

oneOf<Enum>(values): OneOfCommandField<Enum[keyof Enum]>

One value of a closed set: a list of strings, oneOf(["red", "teal"]); a string enum, oneOf(DoorState); or a registry a world holds, whose names are read as each value arrives, oneOf(AbilityRegistryTrait). A system reads the value, typed by the set. The room refuses a value outside it, so no code field carries free text. As Yup’s and Zod’s oneOf and enum; enum is a reserved word.

Type Parameter
Enum extends Readonly<Record<string, string>>
Parameter Type
values Enum

OneOfCommandField<Enum[keyof Enum]>

oneOf<Entry>(registry): OneOfCommandField

One value of a closed set: a list of strings, oneOf(["red", "teal"]); a string enum, oneOf(DoorState); or a registry a world holds, whose names are read as each value arrives, oneOf(AbilityRegistryTrait). A system reads the value, typed by the set. The room refuses a value outside it, so no code field carries free text. As Yup’s and Zod’s oneOf and enum; enum is a reserved word.

Type Parameter
Entry
Parameter Type
registry Trait<() => Map<string, Entry>>

OneOfCommandField