encore.dev/types

Classes

Decimal

A decimal type that can hold values with arbitrary precision. Unlike JavaScript's native number type, this can accurately represent decimal values without floating-point precision errors.

Constructors

Constructor

new Decimal(value): Decimal

Parameters
value

ToDecimal

Returns

Decimal

Accessors

value
Get Signature

get value(): string

Returns

string

Methods

[toPrimitive]()

toPrimitive: string | number

Parameters
hint

string

Returns

string | number

add()

add(d): Decimal

Adds this decimal to another decimal value.

Parameters
d

Decimal | ToDecimal

Returns

Decimal

div()

div(d): Decimal

Divides this decimal by another decimal value.

Parameters
d

Decimal | ToDecimal

Returns

Decimal

mul()

mul(d): Decimal

Multiplies this decimal by another decimal value.

Parameters
d

Decimal | ToDecimal

Returns

Decimal

sub()

sub(d): Decimal

Subtracts another decimal value from this decimal.

Parameters
d

Decimal | ToDecimal

Returns

Decimal

toJSON()

toJSON(): string

Returns

string

toString()

toString(): string

Returns

string

Type Aliases

DurationString

type DurationString = | durationComponent | `${durationComponent}${durationComponent}` | `${durationComponent} ${durationComponent}`;

A duration is a string representing a length of time.

Examples: "10s", "500ms", "5m", "1h30m", "1h 30m".


ToDecimal

type ToDecimal = string | number | bigint