---
title: "enumU32(): IR builder function in typeshade/core/ir"
description: "enumU32, an IR builder function in typeshade/core/ir. Declare a u32 enum from a name-to-value map: const Kind = enumU32."
url: https://typeshade.dev/api/enumu32/
language: en
---

# `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

```ts
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`](https://typeshade.dev/api/matchenum/) can require one arm per member. The values are the integer case labels emitted in the switch.

## See also

- [`matchEnum`](https://typeshade.dev/api/matchenum/)
- [`matchExpr`](https://typeshade.dev/api/matchexpr/)

## Source

[`src/core/ir/node.ts`, line 2077](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/ir/node.ts#L2077), at commit af54ddad5
