API reference@evolu/commonType › nonNegativeDecimalString

const nonNegativeDecimalString: BrandFactory<
  "NonNegativeDecimalString",
  DecimalString,
  NonNegativeDecimalStringError
>;

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

DecimalString Brand requiring a value greater than or equal to zero.

Example

import {
  assertOk,
  DecimalString,
  nonNegativeDecimalString,
} from "@evolu/common";

const NonNegative = nonNegativeDecimalString(DecimalString);

assertOk(NonNegative.fromUnknown("0.5"), "0.5");