EnumU32
On this page

EnumU32

Interface in Values

A typed u32 enum: a name-to-value map whose members are Node<'u32'> literals, plus the raw value map.

import type { EnumU32 } from 'typeshade'

The signature, the description and the examples come from the compiler's own source at commit 26de7be8.

Syntax

interface EnumU32<M extends Record<string, number>> {
readonly members: { readonly [K in keyof M]: Node<'u32'> };
readonly values: M;
}

Description

Pair it with matchEnum for exhaustive integer dispatch: the arms object must cover every member, and a missing or unknown key is a tsc error, so a forgotten case is caught at compile time instead of falling through the switch default.

Instance properties

membersread only { readonly [K in keyof M]: Node<'u32'> }

Typed member literals: Kind.members.Fill is a Node<'u32'> holding that member’s value.

valuesread only M

The raw name-to-value map, the integer case labels matchEnum dispatches on.

See also

Source

src/core/ir/node.ts, line 2337, at commit 26de7be8

Edit this page Report a problem