oneOf
Call Signature
Section titled “Call Signature”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 Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
Values extends readonly [string, string] |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
values |
Values |
Returns
Section titled “Returns”OneOfCommandField<Values[number]>
Call Signature
Section titled “Call Signature”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 Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
Value extends string |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
values |
readonly Value[] |
Returns
Section titled “Returns”OneOfCommandField<Value>
Call Signature
Section titled “Call Signature”oneOf<
Enum>(values):OneOfCommandField<Enum[keyofEnum]>
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 Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
Enum extends Readonly<Record<string, string>> |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
values |
Enum |
Returns
Section titled “Returns”OneOfCommandField<Enum[keyof Enum]>
Call Signature
Section titled “Call Signature”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 Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
Entry |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
registry |
Trait<() => Map<string, Entry>> |