Creates a string shape.
Contradictory constraints are rejected as the shape is built, so a shape that exists admits at least one value.
The stated constraints
The stated datatype, undefined where the constraints have no datatype to state
Optionalconstraints: C & { datatype?: D }
Optional shape constraints
An immutable shape admitting the strings the constraints bound, narrowed to the values they enumerate and typed with the datatype they state. A shape stating no datatype also qualifies as the content of a dictionary, which holds localised text to the same rules as a plain value
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"] }).
The values the shape admits
The admitted values
An immutable shape admitting values alone, stating no datatype
Creates a string shape.