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

    Function number

    Creates a number shape.

    • Creates a number shape.

      Contradictory constraints are rejected as the shape is built, so a shape that exists admits at least one value.

      Type Parameters

      Parameters

      Returns NumberShape<{ inferred from <C> }>

      An immutable shape admitting the numbers the constraints bound, narrowed to the values they enumerate

      TraceError Where the stated constraints contradict one another

    • Creates a number shape admitting an enumerated set of values.

      Reads bare numbers as the enumeration closing the domain to them, so that a set of admitted values is stated as number(1, 2, 3) rather than as number({ in: [1, 2, 3] }).

      Type Parameters

      • const V extends readonly number[]

        The values the shape admits

      Parameters

      • ...values: V

        The admitted values

      Returns NumberShape<V[number]>

      An immutable shape admitting values alone