NonEmptyStringType-level representation of NonEmptyString.
stringNonEmptyString
Source effect/Schema.ts:846412 lines
export interface NonEmptyString extends String {
readonly "Rebuild": NonEmptyString
}
/**
* Schema for non-empty strings. Validates that a string has at least one
* character.
*
* @category string
* @since 3.10.0
*/
export const const NonEmptyString: NonEmptyStringconst NonEmptyString: {
Rebuild: NonEmptyString;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Annotations.Bottom<string, readonly []>) => NonEmptyString;
annotateKey: (annotations: Annotations.Key<string>) => NonEmptyString;
check: (checks_0: SchemaAST.Check<string>, ...checks: Array<SchemaAST.Check<string>>) => NonEmptyString;
rebuild: (ast: SchemaAST.String) => NonEmptyString;
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
NonEmptyString
.
Schema for non-empty strings. Validates that a string has at least one
character.
NonEmptyString: NonEmptyString = 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 isNonEmpty(
annotations?: Annotations.Filter
): SchemaAST.Filter<{
readonly length: number
}>
Validates that a value has at least one element. Works with strings and arrays.
This is equivalent to isMinLength(1).
Details
JSON Schema:
This check corresponds to the minLength: 1 constraint for strings or the
minItems: 1 constraint for arrays in JSON Schema.
Arbitrary:
When generating test data with fast-check, this applies a minLength: 1
constraint to ensure generated strings or arrays are non-empty.
isNonEmpty())Referenced by 1 symbols