enumU32
On this page

enumU32()

Function in Values

Declare a u32 enum from a name-to-value map: const Kind = enumU32.

import { enumU32 } from 'typeshade/core/ir'

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

Syntax

function enumU32<const M extends Record<string, number>>(values: M): EnumU32<M>

Parameters

values M extends Record<string, number>

Return value

EnumU32<M>

Description

The const type parameter preserves the literal keys, so matchEnum can require one arm per member. The values are the integer case labels emitted in the switch.

See also

Source

src/core/ir/node.ts, line 2077, at commit af54ddad5

Edit this page Report a problem