---
title: "intLit(): function in Emit, TypeShade API reference"
description: "intLit, a function in Emit. Spell v as the body of an i32 or u32 literal (no suffix), in the form WGSL and GLSL share."
url: https://typeshade.dev/api/intlit/
language: en
---

# `intLit()`

Function in Emit

Spell v as the body of an `i32` or `u32` literal (no suffix), in the form WGSL and GLSL share.

`import { intLit } from 'typeshade'`

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

## Syntax

```ts
function intLit(v: number, scalar: 'i32' | 'u32'): string
```

## Parameters

**`v` `number`**

**`scalar` `'i32' | 'u32'`**

## Return value

`string`

## Exceptions

**[`SD0017`](https://typeshade.dev/reference/errors/sd0017/)**

[`SD0017`](https://typeshade.dev/reference/errors/sd0017/) if `v` is not an integer or lies outside the 32-bit range of `scalar`. WGSL rejects `2147483648` as an `i32` literal, and a fractional or out-of-range value printed verbatim is a compile error on both targets.

## Source

[`src/core/backends/wgsl/spelling.ts`, line 99](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/backends/wgsl/spelling.ts#L99), at commit af54ddad5
