Float overview

Added in v1.0.0


Table of contents


Number

Float

Floating point branded newtype. Parameters: min, max are inclusive.

Represents floating point numbers:

 { f | f ∈ ℝ, f >= -Number.MAX_VALUE, f <= Number.MAX_VALUE }

Signature

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

Added in v1.0.0

Transformations

FloatSchema (class)

The FloatSchema transformer class, use instead S.Float function to create a FloatSchema

Signature

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

Added in v2.2.0

brand (property)

Brands this FloatSchema with a certain brand

Signature

readonly brand: <Brand>() => Schema<Opaque<Opaque<number, FloatBrand<Min extends undefined ? -1.7976931348623157e+308 : Min, Max extends undefined ? 1.7976931348623157e+308 : Max>>, Brand>, Opaque<Opaque<number, FloatBrand<Min extends undefined ? -1.7976931348623157e+308 : Min, Max extends undefined ? 1.7976931348623157e+308 : Max>>, Brand>>

Added in v2.2.0

min (property)

Sets the minimum value of the FloatSchema

Signature

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

Added in v2.2.0

max (property)

Sets the maximum value of the FloatSchema

Signature

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

Added in v2.2.0

errorName (property)

Overrides the ‘expected’ field in TranscodeError > TypeMismatch

Signature

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

Added in v2.2.0