Enum generics

The Enum base class has 3 type arguments.

Type argumentDescriptionDefault
VThe variant type.REQUIRED
KCurrent variant key.unknown
NVNarrowed variant value.V[K] or V[keyof K]
export class Enum<
  V,
  K extends EnumNarrowSelector<V> = unknown,
  NV extends V[keyof V] = K extends keyof V ? V[K] : V[keyof V]
> {
  #variant: K;
  #value: NV;

  // ...
}