import { IRandomGenerator, IValidation, Resolved, StandardSchemaV1, } from "@typia/interface"; import { TypeGuardError } from "./TypeGuardError"; import { NoTransformConfigurationError } from "./transformers/NoTransformConfigurationError"; /* ----------------------------------------------------------- BASIC VALIDATORS ----------------------------------------------------------- */ /** * Asserts type `T`. * * Performs runtime type checking against compile-time type `T`. Stops at first * mismatch and throws {@link TypeGuardError} containing: * * - `path`: Property path where error occurred (e.g., `"input.user.age"`) * - `expected`: Expected type string (e.g., `"number & ExclusiveMinimum<19>"`) * - `value`: Actual value that failed validation * * Related functions: * * - {@link is} — Returns `boolean` instead of throwing * - {@link validate} — Collects all errors instead of stopping at first * - {@link assertGuard} — Type guard with no return value (narrows type only) * - {@link assertEquals} — Also rejects properties not defined in `T` * * @template T Target type to validate against * * @param input Value to assert * @param errorFactory Custom error factory receiving * {@link TypeGuardError.IProps} * * @returns The input value typed as `T` * * @throws {TypeGuardError} When input doesn't conform to type `T` */ export function assert( input: T, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ): T; /** * Asserts type `T`. * * Performs runtime type checking against compile-time type `T`. Stops at first * mismatch and throws {@link TypeGuardError} containing: * * - `path`: Property path where error occurred (e.g., `"input.user.age"`) * - `expected`: Expected type string (e.g., `"number & ExclusiveMinimum<19>"`) * - `value`: Actual value that failed validation * * Related functions: * * - {@link is} — Returns `boolean` instead of throwing * - {@link validate} — Collects all errors instead of stopping at first * - {@link assertGuard} — Type guard with no return value (narrows type only) * - {@link assertEquals} — Also rejects properties not defined in `T` * * @template T Target type to validate against * * @param input Value to assert * @param errorFactory Custom error factory receiving * {@link TypeGuardError.IProps} * * @returns The input value typed as `T` * * @throws {TypeGuardError} When input doesn't conform to type `T` */ export function assert( input: unknown, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ): T; /** @internal */ export function assert(): never { NoTransformConfigurationError("assert"); } /** * Asserts type `T` as assertion guard. * * Unlike {@link assert}, returns nothing (`asserts input is T`). After this * call, TypeScript narrows `input` to type `T` in subsequent code. Useful when * you need type narrowing with runtime validation but don't need the return * value. * * Throws {@link TypeGuardError} on first mismatch with `path`, `expected`, and * `value`. * * Related functions: * * - {@link assert} — Same validation but returns the input value * - {@link is} — Returns `boolean` instead of throwing * - {@link validate} — Collects all errors instead of throwing * - {@link assertGuardEquals} — Also rejects properties not defined in `T` * * @template T Target type to validate against * * @param input Value to assert (narrowed to `T` after call) * @param errorFactory Custom error factory receiving * {@link TypeGuardError.IProps} * * @throws {TypeGuardError} When input doesn't conform to type `T` */ export function assertGuard( input: T, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ): asserts input is T; /** * Asserts type `T` as assertion guard. * * Unlike {@link assert}, returns nothing (`asserts input is T`). After this * call, TypeScript narrows `input` to type `T` in subsequent code. Useful when * you need type narrowing with runtime validation but don't need the return * value. * * Throws {@link TypeGuardError} on first mismatch with `path`, `expected`, and * `value`. * * Related functions: * * - {@link assert} — Same validation but returns the input value * - {@link is} — Returns `boolean` instead of throwing * - {@link validate} — Collects all errors instead of throwing * - {@link assertGuardEquals} — Also rejects properties not defined in `T` * * @template T Target type to validate against * * @param input Value to assert (narrowed to `T` after call) * @param errorFactory Custom error factory receiving * {@link TypeGuardError.IProps} * * @throws {TypeGuardError} When input doesn't conform to type `T` */ export function assertGuard( input: unknown, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ): asserts input is T; /** @internal */ export function assertGuard(): never { NoTransformConfigurationError("assertGuard"); } /** * Tests type `T`. * * Performs runtime type checking without throwing exceptions. Acts as * TypeScript type guard, narrowing the input type in conditional branches when * result is `true`. * * Related functions: * * - {@link assert} — Throws {@link TypeGuardError} with detailed error info on * mismatch * - {@link validate} — Returns all errors without throwing * - {@link equals} — Also rejects properties not defined in `T` * * @template T Target type to check * * @param input Value to test * * @returns `true` if valid, `false` otherwise (type predicate `input is T`) */ export function is(input: T): input is T; /** * Tests type `T`. * * Performs runtime type checking without throwing exceptions. Acts as * TypeScript type guard, narrowing the input type in conditional branches when * result is `true`. * * Related functions: * * - {@link assert} — Throws {@link TypeGuardError} with detailed error info on * mismatch * - {@link validate} — Returns all errors without throwing * - {@link equals} — Also rejects properties not defined in `T` * * @template T Target type to check * * @param input Value to test * * @returns `true` if valid, `false` otherwise (type predicate `input is T`) */ export function is(input: unknown): input is T; /** @internal */ export function is(): never { NoTransformConfigurationError("is"); } /** * Tests type `T` up to a limited depth. * * Like {@link is}, but only descends into nested objects, arrays, and tuples * until the depth budget `_N` is exhausted; beyond that point a value is * accepted as long as it is an `object` (or `null` where the type permits). * Useful for **discrimination** rather than full validation — when you only * need to know which branch of a union an input belongs to, paying for a deep * structural check of every leaf is wasteful. * * Because the check is shallow past depth `_N`, a `true` result is **not** a * guarantee that the whole value conforms to `T`. The name `shallow` reflects * this: only the discriminating, near-surface part of the type is verified. For * a full guarantee, use {@link is}. * * Related functions: * * - {@link is} — Full-depth check, returns a sound type guard * - {@link assert} — Throws {@link TypeGuardError} with detailed error info on * mismatch * - {@link validate} — Returns all errors without throwing * * @template T Target type to check * @template _N Maximum depth to descend before accepting a value structurally. * Must be a non-negative integer literal. Defaults to `2`. * * @param input Value to test * * @returns `true` if valid up to depth `_N`, `false` otherwise (type predicate * `input is T`) */ export function shallow(input: T): input is T; /** * Tests type `T` up to a limited depth. * * Like {@link is}, but only descends into nested objects, arrays, and tuples * until the depth budget `_N` is exhausted; beyond that point a value is * accepted as long as it is an `object` (or `null` where the type permits). * Useful for **discrimination** rather than full validation — when you only * need to know which branch of a union an input belongs to, paying for a deep * structural check of every leaf is wasteful. * * Because the check is shallow past depth `_N`, a `true` result is **not** a * guarantee that the whole value conforms to `T`. The name `shallow` reflects * this: only the discriminating, near-surface part of the type is verified. For * a full guarantee, use {@link is}. * * Related functions: * * - {@link is} — Full-depth check, returns a sound type guard * - {@link assert} — Throws {@link TypeGuardError} with detailed error info on * mismatch * - {@link validate} — Returns all errors without throwing * * @template T Target type to check * @template _N Maximum depth to descend before accepting a value structurally. * Must be a non-negative integer literal. Defaults to `2`. * * @param input Value to test * * @returns `true` if valid up to depth `_N`, `false` otherwise (type predicate * `input is T`) */ export function shallow(input: unknown): input is T; /** @internal */ export function shallow(): never { NoTransformConfigurationError("shallow"); } /** * Validates type `T`. * * Unlike {@link assert} which throws on first error, this function continues * checking and collects all type mismatches into {@link IValidation.errors} * array. Never throws. * * Return structure: * * - `success: true` → `data` contains validated input as `T` * - `success: false` → `errors` array of {@link IValidation.IError} with `path`, * `expected`, `value` * * Related functions: * * - {@link assert} — Throws on first error instead of collecting all * - {@link is} — Simple boolean check * - {@link validateEquals} — Also rejects properties not defined in `T` * * @template T Target type to validate against * * @param input Value to validate * * @returns {@link IValidation} containing either `data` or `errors` */ export function validate(input: T): IValidation; /** * Validates type `T`. * * Unlike {@link assert} which throws on first error, this function continues * checking and collects all type mismatches into {@link IValidation.errors} * array. Never throws. * * Return structure: * * - `success: true` → `data` contains validated input as `T` * - `success: false` → `errors` array of {@link IValidation.IError} with `path`, * `expected`, `value` * * Related functions: * * - {@link assert} — Throws on first error instead of collecting all * - {@link is} — Simple boolean check * - {@link validateEquals} — Also rejects properties not defined in `T` * * @template T Target type to validate against * * @param input Value to validate * * @returns {@link IValidation} containing either `data` or `errors` */ export function validate(input: unknown): IValidation; /** @internal */ export function validate(): never { NoTransformConfigurationError("validate"); } /* ----------------------------------------------------------- STRICT VALIDATORS ----------------------------------------------------------- */ /** * Asserts type `T` with strict equality. * * Stricter than {@link assert}: also fails when input contains any property not * defined in type `T`. For extra property errors, `expected` will be * `"undefined"`. * * Related functions: * * - {@link assert} — Allows extra properties * - {@link equals} — Boolean result without throwing * - {@link validateEquals} — Collects all errors without throwing * - {@link assertGuardEquals} — Type guard version with no return value * * @template T Target type for exact match * * @param input Value to validate * @param errorFactory Custom error factory receiving * {@link TypeGuardError.IProps} * * @returns The input value typed as `T` * * @throws {TypeGuardError} When type mismatch or extra property detected */ export function assertEquals( input: T, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ): T; /** * Asserts type `T` with strict equality. * * Stricter than {@link assert}: also fails when input contains any property not * defined in type `T`. For extra property errors, `expected` will be * `"undefined"`. * * Related functions: * * - {@link assert} — Allows extra properties * - {@link equals} — Boolean result without throwing * - {@link validateEquals} — Collects all errors without throwing * - {@link assertGuardEquals} — Type guard version with no return value * * @template T Target type for exact match * * @param input Value to validate * @param errorFactory Custom error factory receiving * {@link TypeGuardError.IProps} * * @returns The input value typed as `T` * * @throws {TypeGuardError} When type mismatch or extra property detected */ export function assertEquals( input: unknown, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ): T; /** @internal */ export function assertEquals(): never { NoTransformConfigurationError("assertEquals"); } /** * Asserts type `T` with strict equality as assertion guard. * * Combines {@link assertGuard} with strict equality checking. Returns nothing * but narrows input to type `T`. Also fails when input contains properties not * in `T`. * * Related functions: * * - {@link assertGuard} — Allows extra properties * - {@link assertEquals} — Returns value instead of type guard * - {@link equals} — Boolean result without throwing * - {@link validateEquals} — Collects all errors without throwing * * @template T Target type for exact match * * @param input Value to assert (narrowed to `T` after call) * @param errorFactory Custom error factory receiving * {@link TypeGuardError.IProps} * * @throws {TypeGuardError} When type mismatch or extra property detected */ export function assertGuardEquals( input: T, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ): asserts input is T; /** * Asserts type `T` with strict equality as assertion guard. * * Combines {@link assertGuard} with strict equality checking. Returns nothing * but narrows input to type `T`. Also fails when input contains properties not * in `T`. * * Related functions: * * - {@link assertGuard} — Allows extra properties * - {@link assertEquals} — Returns value instead of type guard * - {@link equals} — Boolean result without throwing * - {@link validateEquals} — Collects all errors without throwing * * @template T Target type for exact match * * @param input Value to assert (narrowed to `T` after call) * @param errorFactory Custom error factory receiving * {@link TypeGuardError.IProps} * * @throws {TypeGuardError} When type mismatch or extra property detected */ export function assertGuardEquals( input: unknown, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ): asserts input is T; /** @internal */ export function assertGuardEquals(): never { NoTransformConfigurationError("assertGuardEquals"); } /** * Tests type `T` with strict equality. * * Stricter than {@link is}: also returns `false` when input contains any * property not defined in type `T`. Useful for detecting unexpected data or * typos. * * Related functions: * * - {@link is} — Allows extra properties * - {@link assertEquals} — Throws with detailed error info on mismatch * - {@link validateEquals} — Returns all errors without throwing * * @template T Target type for exact match * * @param input Value to test * * @returns `true` if valid, `false` otherwise (type predicate `input is T`) */ export function equals(input: T): input is T; /** * Tests type `T` with strict equality. * * Stricter than {@link is}: also returns `false` when input contains any * property not defined in type `T`. Useful for detecting unexpected data or * typos. * * Related functions: * * - {@link is} — Allows extra properties * - {@link assertEquals} — Throws with detailed error info on mismatch * - {@link validateEquals} — Returns all errors without throwing * * @template T Target type for exact match * * @param input Value to test * * @returns `true` if valid, `false` otherwise (type predicate `input is T`) */ export function equals(input: unknown): input is T; /** @internal */ export function equals(): never { NoTransformConfigurationError("equals"); } /** * Validates type `T` with strict equality. * * Combines {@link validate} with strict equality checking. Collects all errors * including extra property violations into {@link IValidation.errors} array. * * Return structure: * * - `success: true` → `data` contains validated input as `T` * - `success: false` → `errors` array with `path`, `expected`, `value` for each * mismatch * * Related functions: * * - {@link validate} — Allows extra properties * - {@link assertEquals} — Throws on first error * - {@link equals} — Simple boolean check * * @template T Target type for exact match * * @param input Value to validate * * @returns {@link IValidation} containing either `data` or `errors` */ export function validateEquals(input: T): IValidation; /** * Validates type `T` with strict equality. * * Combines {@link validate} with strict equality checking. Collects all errors * including extra property violations into {@link IValidation.errors} array. * * Return structure: * * - `success: true` → `data` contains validated input as `T` * - `success: false` → `errors` array with `path`, `expected`, `value` for each * mismatch * * Related functions: * * - {@link validate} — Allows extra properties * - {@link assertEquals} — Throws on first error * - {@link equals} — Simple boolean check * * @template T Target type for exact match * * @param input Value to validate * * @returns {@link IValidation} containing either `data` or `errors` */ export function validateEquals(input: unknown): IValidation; /** @internal */ export function validateEquals(): never { NoTransformConfigurationError("validateEquals"); } /* ----------------------------------------------------------- RANDOM ----------------------------------------------------------- */ /** * Generates random data of type `T`. * * Creates random instance conforming to compile-time type `T`. Generates only * primitive data; methods in `T` are ignored. If `T` has `toJSON()` method, * generates its return type instead. * * @template T Type of data to generate * * @param generator Custom random generator implementing {@link IRandomGenerator} * * @returns Randomly generated data as `Resolved` * * @danger You must configure the generic argument `T` */ export function random(generator?: Partial): never; /** * Generates random data of type `T`. * * Creates random instance conforming to compile-time type `T`. Generates only * primitive data; methods in `T` are ignored. If `T` has `toJSON()` method, * generates its return type instead. * * @template T Type of data to generate * * @param generator Custom random generator implementing {@link IRandomGenerator} * * @returns Randomly generated data as `Resolved` */ export function random(generator?: Partial): Resolved; /** @internal */ export function random(): never { NoTransformConfigurationError("random"); } /* ----------------------------------------------------------- FACTORY FUNCTIONS ----------------------------------------------------------- */ /** * Creates reusable {@link assert} function. * * Returns a function that can be called multiple times without recompilation. * Useful when the same type validation is needed repeatedly. * * @template T Target type to validate against * * @param errorFactory Custom error factory receiving * {@link TypeGuardError.IProps} * * @returns Reusable assert function `(input: unknown, errorFactory?) => T` * * @danger You must configure the generic argument `T` */ export function createAssert( errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ): never; /** * Creates reusable {@link assert} function. * * Returns a function that can be called multiple times without recompilation. * Useful when the same type validation is needed repeatedly. * * @template T Target type to validate against * * @param errorFactory Custom error factory receiving * {@link TypeGuardError.IProps} * * @returns Reusable assert function `(input: unknown, errorFactory?) => T`, * whose own `errorFactory` overrides this one for that single call */ export function createAssert( errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ): ( input: unknown, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ) => T; /** @internal */ export function createAssert(): ( input: unknown, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ) => T { NoTransformConfigurationError("createAssert"); } /** * Creates reusable {@link assertGuard} function. * * Returns a reusable type guard assertion function. * * TypeScript requirement: You must declare the variable type explicitly. `const * fn: AssertionGuard = createAssertGuard()` — otherwise compile error. * That annotation is one parameter wide, so it also hides the call-time * `errorFactory`; annotate with `(input: unknown, errorFactory?: (props: * TypeGuardError.IProps) => Error) => asserts input is T` when you need it. * * @template T Target type to validate against * * @param errorFactory Custom error factory receiving * {@link TypeGuardError.IProps} * * @returns Reusable assertion guard function * * @danger You must configure the generic argument `T` */ export function createAssertGuard( errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ): never; /** * Creates reusable {@link assertGuard} function. * * Returns a reusable type guard assertion function. * * TypeScript requirement: You must declare the variable type explicitly. `const * fn: AssertionGuard = createAssertGuard()` — otherwise compile error. * That annotation is one parameter wide, so it also hides the call-time * `errorFactory`; annotate with `(input: unknown, errorFactory?: (props: * TypeGuardError.IProps) => Error) => asserts input is T` when you need it. * * @template T Target type to validate against * * @param errorFactory Custom error factory receiving * {@link TypeGuardError.IProps} * * @returns Reusable assertion guard function, whose own `errorFactory` * overrides this one for that single call */ export function createAssertGuard( errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ): ( input: unknown, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ) => asserts input is T; /** @internal */ export function createAssertGuard(): ( input: unknown, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ) => asserts input is T { NoTransformConfigurationError("createAssertGuard"); } /** * Creates reusable {@link is} function. * * Returns a type guard function that can be called multiple times without * recompilation. * * @template T Target type to check * * @returns Reusable type guard function `(input: unknown) => input is T` * * @danger You must configure the generic argument `T` */ export function createIs(): never; /** * Creates reusable {@link is} function. * * Returns a type guard function that can be called multiple times without * recompilation. * * @template T Target type to check * * @returns Reusable type guard function `(input: unknown) => input is T` */ export function createIs(): (input: unknown) => input is T; /** @internal */ export function createIs(): (input: unknown) => input is T { NoTransformConfigurationError("createIs"); } /** * Creates reusable {@link shallow} function. * * Returns a depth-limited type guard function that can be called multiple times * without recompilation. * * @template T Target type to check * @template _N Maximum depth to descend before accepting a value structurally. * Must be a non-negative integer literal. Defaults to `2`. * * @returns Reusable type guard function `(input: unknown) => input is T` * * @danger You must configure the generic argument `T` */ export function createShallow(): never; /** * Creates reusable {@link shallow} function. * * Returns a depth-limited type guard function that can be called multiple times * without recompilation. * * @template T Target type to check * @template _N Maximum depth to descend before accepting a value structurally. * Must be a non-negative integer literal. Defaults to `2`. * * @returns Reusable type guard function `(input: unknown) => input is T` */ export function createShallow(): ( input: unknown, ) => input is T; /** @internal */ export function createShallow(): (input: unknown) => input is T { NoTransformConfigurationError("createShallow"); } /** * Creates reusable {@link validate} function. * * Returns a validation function that can be called multiple times without * recompilation. Also implements {@link StandardSchemaV1} interface for * interoperability. * * @template T Target type to validate against * * @returns Reusable validate function `(input: unknown) => IValidation` * * @danger You must configure the generic argument `T` */ export function createValidate(): never; /** * Creates reusable {@link validate} function. * * Returns a validation function that can be called multiple times without * recompilation. Also implements {@link StandardSchemaV1} interface for * interoperability. * * @template T Target type to validate against * * @returns Reusable validate function `(input: unknown) => IValidation` */ export function createValidate(): ((input: unknown) => IValidation) & StandardSchemaV1; /** @internal */ export function createValidate(): ((input: unknown) => IValidation) & StandardSchemaV1 { NoTransformConfigurationError("createValidate"); } /** * Creates reusable {@link assertEquals} function. * * Returns a strict assertion function that rejects superfluous properties. Can * be called multiple times without recompilation. * * @template T Target type for exact match * * @param errorFactory Custom error factory receiving * {@link TypeGuardError.IProps} * * @returns Reusable assertEquals function `(input: unknown, errorFactory?) => * T` * * @danger You must configure the generic argument `T` */ export function createAssertEquals( errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ): never; /** * Creates reusable {@link assertEquals} function. * * Returns a strict assertion function that rejects superfluous properties. Can * be called multiple times without recompilation. * * @template T Target type for exact match * * @param errorFactory Custom error factory receiving * {@link TypeGuardError.IProps} * * @returns Reusable assertEquals function `(input: unknown, errorFactory?) => * T`, whose own `errorFactory` overrides this one for that single call */ export function createAssertEquals( errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ): ( input: unknown, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ) => T; /** @internal */ export function createAssertEquals(): ( input: unknown, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ) => T { NoTransformConfigurationError("createAssertEquals"); } /** * Creates reusable {@link assertGuardEquals} function. * * Returns a strict assertion guard that rejects superfluous properties. * * TypeScript requirement: You must declare the variable type explicitly. `const * fn: AssertionGuard = createAssertGuardEquals()` — otherwise compile * error. That annotation is one parameter wide, so it also hides the call-time * `errorFactory`; annotate with `(input: unknown, errorFactory?: (props: * TypeGuardError.IProps) => Error) => asserts input is T` when you need it. * * @template T Target type for exact match * * @param errorFactory Custom error factory receiving * {@link TypeGuardError.IProps} * * @returns Reusable assertion guard function * * @danger You must configure the generic argument `T` */ export function createAssertGuardEquals( errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ): never; /** * Creates reusable {@link assertGuardEquals} function. * * Returns a strict assertion guard that rejects superfluous properties. * * TypeScript requirement: You must declare the variable type explicitly. `const * fn: AssertionGuard = createAssertGuardEquals()` — otherwise compile * error. That annotation is one parameter wide, so it also hides the call-time * `errorFactory`; annotate with `(input: unknown, errorFactory?: (props: * TypeGuardError.IProps) => Error) => asserts input is T` when you need it. * * @template T Target type for exact match * * @param errorFactory Custom error factory receiving * {@link TypeGuardError.IProps} * * @returns Reusable assertion guard function, whose own `errorFactory` * overrides this one for that single call */ export function createAssertGuardEquals( errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ): ( input: unknown, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ) => asserts input is T; /** @internal */ export function createAssertGuardEquals(): ( input: unknown, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error), ) => asserts input is T { NoTransformConfigurationError("createAssertGuardEquals"); } /** * Creates reusable {@link equals} function. * * Returns a strict type guard that rejects superfluous properties. Can be * called multiple times without recompilation. * * @template T Target type for exact match * * @returns Reusable type guard function `(input: unknown) => input is T` * * @danger You must configure the generic argument `T` */ export function createEquals(): never; /** * Creates reusable {@link equals} function. * * Returns a strict type guard that rejects superfluous properties. Can be * called multiple times without recompilation. * * @template T Target type for exact match * * @returns Reusable type guard function `(input: unknown) => input is T` */ export function createEquals(): (input: unknown) => input is T; /** @internal */ export function createEquals(): (input: unknown) => input is T { NoTransformConfigurationError("createEquals"); } /** * Creates reusable {@link validateEquals} function. * * Returns a strict validation function that rejects superfluous properties. * Also implements {@link StandardSchemaV1} interface for interoperability. * * @template T Target type for exact match * * @returns Reusable validateEquals function `(input: unknown) => * IValidation` * * @danger You must configure the generic argument `T` */ export function createValidateEquals(): never; /** * Creates reusable {@link validateEquals} function. * * Returns a strict validation function that rejects superfluous properties. * Also implements {@link StandardSchemaV1} interface for interoperability. * * @template T Target type for exact match * * @returns Reusable validateEquals function `(input: unknown) => * IValidation` */ export function createValidateEquals(): (( input: unknown, ) => IValidation) & StandardSchemaV1; /** @internal */ export function createValidateEquals(): ((input: unknown) => IValidation) & StandardSchemaV1 { NoTransformConfigurationError("createValidateEquals"); } /** * Creates reusable {@link random} function. * * Returns a random data generator that can be called multiple times without * recompilation. * * @template T Type of data to generate * * @param generator Custom random generator implementing {@link IRandomGenerator} * * @returns Reusable random function `() => Resolved` * * @danger You must configure the generic argument `T` */ export function createRandom(generator?: Partial): never; /** * Creates reusable {@link random} function. * * Returns a random data generator that can be called multiple times without * recompilation. * * @template T Type of data to generate * * @param generator Custom random generator implementing {@link IRandomGenerator} * * @returns Reusable random function `() => Resolved` */ export function createRandom( generator?: Partial, ): () => Resolved; /** @internal */ export function createRandom(): never { NoTransformConfigurationError("createRandom"); }