API reference / @evolu/common / Type / FiniteNumber

Variable: FiniteNumber

const FiniteNumber: BrandType<
  Type<"Number", number, number, NumberError, number, NumberError>,
  "Finite",
  FiniteError,
  NumberError
>;

Defined in: packages/common/src/Type.ts:1787

Finite number.

This Type ensures that a number is finite.

Why is this important?

JSON.stringify serializes JavaScript numbers into null if they are not finite (e.g., Infinity, -Infinity, or NaN). Using FiniteNumber helps prevent these unexpected behaviors when working with JSON serialization.

Was this page helpful?