Skip to content
EliteChart

TimestampMs

Documentation


Documentation / @elitechart/elitechart / TimestampMs

code
type TimestampMs = number & {
  __brand: "TimestampMs";
};

Defined in: core/dist/index.d.ts:21

UTC milliseconds since Unix epoch. Non-negative, finite.

Branded so a raw number can never be passed where a TimestampMs is required — eliminates the "I sent seconds when the API wanted ms" class of bug at compile time.

Type Declaration

__brand

code
readonly __brand: "TimestampMs";

Example

code
import { asTimestampMs } from '@elitechart/core';
const t: TimestampMs = asTimestampMs(Date.now());