Options
All
  • Public
  • Public/Protected
  • All
Menu

ow

Index

Type Aliases

AssertingValidator<T>: T extends ReusableValidator<infer R> ? ((value: unknown, label?: string) => asserts value is R) : T extends BasePredicate<infer R> ? ((value: unknown, label?: string) => asserts value is R) : never

Turn a ReusableValidator into one with a type assertion.

example
const checkUsername = ow.create(ow.string.minLength(3));
const checkUsername_: AssertingValidator<typeof checkUsername> = checkUsername;
example
const predicate = ow.string.minLength(3);
const checkUsername: AssertingValidator<typeof predicate> = ow.create(predicate);

Type Parameters

  • T

Infer<P>: P extends BasePredicate<infer T> ? T : never

Retrieve the type from the given predicate.

example
import ow, {Infer} from 'ow';

const userPredicate = ow.object.exactShape({
name: ow.string
});

type User = Infer<typeof userPredicate>;

Type Parameters

  • P

Variables

default: Ow = ...