vtils

Home > types > Integer

Integer type

A number that is an integer. You can’t pass a bigint as they are already guaranteed to be integers.

Use-case: Validating and documenting parameters.

Signature:

export declare type Integer<T extends number> = `${T}` extends `${bigint}` ? T : never;

Example

``` import {Integer} from ‘type-fest’;

declare function setYear<T extends number>(length: Integer): void; \`\`\`