The bundle produced by defineType for a closed set of named values (an "enum-like"). Callers destructure the pieces they need.

interface DefinedType<KMap extends Record<string, unknown>> {
    isValue: (v: unknown) => v is KMap[keyof KMap];
    kind: KMap;
    labels: Record<string, string>;
    Type: KMap[keyof KMap];
    values: KMap[keyof KMap][];
}

Type Parameters

  • KMap extends Record<string, unknown>

    The literal key → value map the type is built from.

Properties

isValue: (v: unknown) => v is KMap[keyof KMap]

Type guard: narrows an unknown to one of kind's values.

kind: KMap

The original key → value map, preserved verbatim (the "enum object").

labels: Record<string, string>

Localization keys per entry: each key mapped to `${prefix}.${key}`.

Type: KMap[keyof KMap]

Phantom value (always null at runtime) whose type is the value union. Use typeof X.Type to name the union in type positions — never read it at runtime.

values: KMap[keyof KMap][]

Every value in kind, as an array (handy for iteration/choices).