Skip to main content

@rbxts/expect > EnumValue

EnumValue type

The value of an enum in a LuaEnum.

Signature:

type EnumValue<E> = E[keyof E];

Remarks

Used for type safe identification of enum values.

Example

enum Sport {
Basketball,
Football,
Soccer
};

function PrintEnumValue<R>(enum: R & LuaEnum, value: EnumValue<R>) {
print(enum[value]);
}

PrintEnumValue(Sport, "Soccer");