CharType-level representation of Char.
export interface Char extends String {
readonly "Rebuild": Char
}
/**
* Schema for strings whose JavaScript `length` is exactly `1`.
*
* **When to use**
*
* Use to validate string values that must have `length === 1`.
*
* **Gotchas**
*
* This schema uses JavaScript `String.length`, so visible characters made from
* multiple UTF-16 code units do not satisfy `length === 1`.
*
* @see {@link String} for unconstrained string values
* @see {@link NonEmptyString} for strings with length greater than zero
* @see {@link isLengthBetween} for the underlying length check
*
* @category string
* @since 3.10.0
*/
export const const Char: Charconst Char: {
Rebuild: Char;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<string, readonly []>) => Char;
annotateKey: (annotations: Annotations.Key<string>) => Char;
check: (checks_0: SchemaAST.Check<string>, ...checks: Array<SchemaAST.Check<string>>) => Char;
rebuild: (ast: SchemaAST.String) => Char;
make: (input: string, options?: MakeOptions) => string;
makeOption: (input: string, options?: MakeOptions) => Option_.Option<string>;
makeEffect: (input: string, options?: MakeOptions) => Effect.Effect<string, SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Type-level representation of
Char
.
Schema for strings whose JavaScript length is exactly 1.
When to use
Use to validate string values that must have length === 1.
Gotchas
This schema uses JavaScript String.length, so visible characters made from
multiple UTF-16 code units do not satisfy length === 1.
Char: Char = const String: Stringconst String: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<string, readonly []>) => String;
annotateKey: (annotations: Annotations.Key<string>) => String;
check: (checks_0: SchemaAST.Check<string>, ...checks: Array<SchemaAST.Check<string>>) => String;
rebuild: (ast: SchemaAST.String) => String;
make: (input: string, options?: MakeOptions) => string;
makeOption: (input: string, options?: MakeOptions) => Option_.Option<string>;
makeEffect: (input: string, options?: MakeOptions) => Effect.Effect<string, SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Type-level representation of
String
.
Schema for string values. Validates that the input is typeof "string".
String.Bottom<string, string, never, never, String, String, string, string, readonly [], string, "readonly", "required", "no-default", "readonly", "required">.check(checks_0: SchemaAST.Check<string>, ...checks: SchemaAST.Check<string>[]): Stringcheck(function isLengthBetween(
minimum: number,
maximum: number,
annotations?: Annotations.Filter
): SchemaAST.Filter<{
readonly length: number
}>
Validates that a value's length is within the specified range. Works with
strings and arrays.
Details
JSON Schema:
This check corresponds to minLength/maxLength constraints for strings
or minItems/maxItems constraints for arrays in JSON Schema.
Arbitrary:
When generating test data with fast-check, this applies minLength and
maxLength constraints to ensure generated strings or arrays have a length
within the specified range.
isLengthBetween(1, 1))