@metreeca/blue - v0.10.0
    Preparing search index...

    Function number

    Creates a numeric shape.

    • Creates a numeric shape with a typed model value and no other constraints.

      Type Parameters

      • M extends number

        The literal number type for the model

      Parameters

      • model: M

        Prototype value for runtime model assembly

      Returns NumberShape & { model: M }

      An immutable shape with model typed as M

      const count = number(42 as const);
      
    • Creates a numeric shape with optional validation constraints.

      Type Parameters

      Parameters

      Returns NumberShape

      An immutable shape with model typed as number

      If constraints contains contradictory values

      const value = number();
      const score = number({ minInclusive: 0, maxInclusive: 100 });