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

    Function string

    Creates a string shape.

    • Creates a string shape.

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

      Type Parameters

      Parameters

      Returns StringShape<{ inferred from <C> }>

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

      TraceError Where the stated constraints contradict one another

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

      Reads bare strings as the enumeration closing the domain to them, so that a set of admitted values is stated as string("open", "closed") rather than as string({ in: ["open", "closed"] }).

      Type Parameters

      • const V extends readonly string[]

        The values the shape admits

      Parameters

      • ...values: V

        The admitted values

      Returns StringShape<V[number]>

      An immutable shape admitting values alone