﻿<head><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4357510538660394"
     crossorigin="anonymous"></script></head># safeInteger

> This document is the Markdown version of [valibot.dev/api/safeInteger/](https://valibot.dev/api/safeInteger/). For the complete documentation index, see [llms.txt](https://valibot.dev/llms.txt).

Creates a safe integer validation action.

```ts
const Action = v.safeInteger<TInput, TMessage>(message);
```

## Generics

- `TInput` `extends number`
- `TMessage` `extends ErrorMessage<SafeIntegerIssue<TInput>> | undefined`

## Parameters

- `message` `TMessage`

### Explanation

With `safeInteger` you can validate the value of a number. If the input is not a safe integer, you can use `message` to customize the error message.

## Returns

- `Action` `SafeIntegerAction<TInput, TMessage>`

## Examples

The following examples show how `safeInteger` can be used.

### Safe integer schema

Schema to validate an safe integer.

```ts
const SafeIntegerSchema = v.pipe(
  v.number(),
  v.safeInteger('The number must be a safe integer.')
);
```

## Related

The following APIs can be combined with `safeInteger`.

### Schemas

[`any`](/api/any.md), [`custom`](/api/custom.md), 