@metreeca/blue - v0.9.1
    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 }

      A shape with model typed as M

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

      Parameters

      Returns NumberShape

      A shape with model typed as number

      If constraints is not a valid NumberConstraints

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