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'

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

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.

In the guide

See also

Source

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

Edit this page Report a problem