Enums
A KERN enum compiles to a native TypeScript enum and a plain Python namespace class with identical member values — including TypeScript's auto-increment semantics.
Numeric enums
Use values with a pipe-separated member list:
enum name=Status values="Pending|Active|Done"Compiles to:
// TypeScript
export enum Status { Pending, Active, Done }
# Python — plain namespace class, no import enum
class Status:
Pending = 0
Active = 1
Done = 2String enums
Add member children with explicit values for string (or custom-valued) enums:
enum name=Direction
member name=Up value="UP"
member name=Down value="DOWN"Const and export control
Add const=true to prepend const, or export=false to keep the enum internal.
enum name=Flag values="On|Off" const=true
enum name=Hidden values="A|B" export=falseFail-closed: rejected operations
Operations the two targets cannot represent identically are rejected at compile time on both TypeScript and Python, so neither side can silently diverge:
Status[0]— reverse indexing (ruleenum-reverse-index).Object.keys(Status),Object.values(Status),Object.entries(Status)— enum iteration (ruleenum-iteration).
Reading a member by name, such as Status.Pending, is always allowed.