Int overview

Added in v1.0.0


Table of contents


Number

Int

Integer branded newtype. Parameters: min, max are inclusive.

Represents integers:

 { z | z ∈ ℤ, z >= -2 ** 53 + 1, z <= 2 ** 53 - 1 }

Signature

export declare const Int: <Min extends number | undefined = undefined, Max extends number | undefined = undefined>(
  params?: NumberParams<Min, Max> | undefined
) => IntSchema<Min, Max>

Added in v1.0.0

Transformations

IntSchema (class)

The IntSchema transformer class, use instead S.Int function to create an IntSchema

Signature

export declare class IntSchema<Min, Max> {
  constructor(private readonly params?: NumberParams<Min, Max>)
}

Added in v2.2.0

brand (property)

Brands this Int schema with a certain brand

Signature

readonly brand: <Brand>() => Schema<Opaque<Opaque<number, IntBrand<Min extends undefined ? -9007199254740991 : Min, Max extends undefined ? 9007199254740991 : Max>>, Brand>, Opaque<Opaque<number, IntBrand<Min extends undefined ? -9007199254740991 : Min, Max extends undefined ? 9007199254740991 : Max>>, Brand>>

Added in v2.2.0

min (property)

Sets the minimum value of the IntSchema

Signature

readonly min: <NewMin extends number>(minLength: NewMin) => IntSchema<NewMin, Max>

Added in v2.2.0

max (property)

Sets the maximum value of the IntSchema

Signature

readonly max: <NewMax extends number>(maxLength: NewMax) => IntSchema<Min, NewMax>

Added in v2.2.0

errorName (property)

Overrides the ‘expected’ field in TranscodeError > TypeMismatch

Signature

readonly errorName: (errorName: string) => IntSchema<Min, Max>

Added in v2.2.0