UNPKG

typia

Version:

Superfast runtime validators with only one line

1 lines 33.4 kB
{"version":3,"file":"module.mjs","names":[],"sources":["../src/module.ts"],"sourcesContent":["import { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport {\n AssertionGuard,\n IRandomGenerator,\n IValidation,\n Resolved,\n} from \"@typia/interface\";\n\nimport { TypeGuardError } from \"./TypeGuardError\";\nimport { NoTransformConfigurationError } from \"./transformers/NoTransformConfigurationError\";\n\nexport * as compare from \"./compare\";\nexport * as functional from \"./functional\";\nexport * as http from \"./http\";\nexport * as llm from \"./llm\";\nexport * as json from \"./json\";\nexport * as plain from \"./plain\";\nexport * as notations from \"./notations\";\nexport * as protobuf from \"./protobuf\";\nexport * as reflect from \"./reflect\";\n\nexport * from \"./TypeGuardError\";\n\nexport * from \"./re-exports\";\n\n/* -----------------------------------------------------------\n BASIC VALIDATORS\n----------------------------------------------------------- */\n/**\n * Asserts type `T`.\n *\n * Performs runtime type checking against compile-time type `T`. Stops at first\n * mismatch and throws {@link TypeGuardError} containing:\n *\n * - `path`: Property path where error occurred (e.g., `\"input.user.age\"`)\n * - `expected`: Expected type string (e.g., `\"number & ExclusiveMinimum<19>\"`)\n * - `value`: Actual value that failed validation\n *\n * Related functions:\n *\n * - {@link is} — Returns `boolean` instead of throwing\n * - {@link validate} — Collects all errors instead of stopping at first\n * - {@link assertGuard} — Type guard with no return value (narrows type only)\n * - {@link assertEquals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to validate against\n * @param input Value to assert\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns The input value typed as `T`\n * @throws {TypeGuardError} When input doesn't conform to type `T`\n */\nexport function assert<T>(\n input: T,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): T;\n\n/**\n * Asserts type `T`.\n *\n * Performs runtime type checking against compile-time type `T`. Stops at first\n * mismatch and throws {@link TypeGuardError} containing:\n *\n * - `path`: Property path where error occurred (e.g., `\"input.user.age\"`)\n * - `expected`: Expected type string (e.g., `\"number & ExclusiveMinimum<19>\"`)\n * - `value`: Actual value that failed validation\n *\n * Related functions:\n *\n * - {@link is} — Returns `boolean` instead of throwing\n * - {@link validate} — Collects all errors instead of stopping at first\n * - {@link assertGuard} — Type guard with no return value (narrows type only)\n * - {@link assertEquals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to validate against\n * @param input Value to assert\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns The input value typed as `T`\n * @throws {TypeGuardError} When input doesn't conform to type `T`\n */\nexport function assert<T>(\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): T;\n\n/** @internal */\nexport function assert(): never {\n NoTransformConfigurationError(\"assert\");\n}\n\n/**\n * Asserts type `T` as assertion guard.\n *\n * Unlike {@link assert}, returns nothing (`asserts input is T`). After this\n * call, TypeScript narrows `input` to type `T` in subsequent code. Useful when\n * you need type narrowing with runtime validation but don't need the return\n * value.\n *\n * Throws {@link TypeGuardError} on first mismatch with `path`, `expected`, and\n * `value`.\n *\n * Related functions:\n *\n * - {@link assert} — Same validation but returns the input value\n * - {@link is} — Returns `boolean` instead of throwing\n * - {@link validate} — Collects all errors instead of throwing\n * - {@link assertGuardEquals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to validate against\n * @param input Value to assert (narrowed to `T` after call)\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @throws {TypeGuardError} When input doesn't conform to type `T`\n */\nexport function assertGuard<T>(\n input: T,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): asserts input is T;\n\n/**\n * Asserts type `T` as assertion guard.\n *\n * Unlike {@link assert}, returns nothing (`asserts input is T`). After this\n * call, TypeScript narrows `input` to type `T` in subsequent code. Useful when\n * you need type narrowing with runtime validation but don't need the return\n * value.\n *\n * Throws {@link TypeGuardError} on first mismatch with `path`, `expected`, and\n * `value`.\n *\n * Related functions:\n *\n * - {@link assert} — Same validation but returns the input value\n * - {@link is} — Returns `boolean` instead of throwing\n * - {@link validate} — Collects all errors instead of throwing\n * - {@link assertGuardEquals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to validate against\n * @param input Value to assert (narrowed to `T` after call)\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @throws {TypeGuardError} When input doesn't conform to type `T`\n */\nexport function assertGuard<T>(\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): asserts input is T;\n\n/** @internal */\nexport function assertGuard(): never {\n NoTransformConfigurationError(\"assertGuard\");\n}\n\n/**\n * Tests type `T`.\n *\n * Performs runtime type checking without throwing exceptions. Acts as\n * TypeScript type guard, narrowing the input type in conditional branches when\n * result is `true`.\n *\n * Related functions:\n *\n * - {@link assert} — Throws {@link TypeGuardError} with detailed error info on\n * mismatch\n * - {@link validate} — Returns all errors without throwing\n * - {@link equals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to check\n * @param input Value to test\n * @returns `true` if valid, `false` otherwise (type predicate `input is T`)\n */\nexport function is<T>(input: T): input is T;\n\n/**\n * Tests type `T`.\n *\n * Performs runtime type checking without throwing exceptions. Acts as\n * TypeScript type guard, narrowing the input type in conditional branches when\n * result is `true`.\n *\n * Related functions:\n *\n * - {@link assert} — Throws {@link TypeGuardError} with detailed error info on\n * mismatch\n * - {@link validate} — Returns all errors without throwing\n * - {@link equals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to check\n * @param input Value to test\n * @returns `true` if valid, `false` otherwise (type predicate `input is T`)\n */\nexport function is<T>(input: unknown): input is T;\n\n/** @internal */\nexport function is(): never {\n NoTransformConfigurationError(\"is\");\n}\n\n/**\n * Tests type `T` up to a limited depth.\n *\n * Like {@link is}, but only descends into nested objects, arrays, and tuples\n * until the depth budget `N` is exhausted; beyond that point a value is\n * accepted as long as it is an `object` (or `null` where the type permits).\n * Useful for **discrimination** rather than full validation — when you only\n * need to know which branch of a union an input belongs to, paying for a deep\n * structural check of every leaf is wasteful.\n *\n * Because the check is shallow past depth `N`, a `true` result is **not** a\n * guarantee that the whole value conforms to `T`. The name `shallow` reflects\n * this: only the discriminating, near-surface part of the type is verified. For\n * a full guarantee, use {@link is}.\n *\n * Related functions:\n *\n * - {@link is} — Full-depth check, returns a sound type guard\n * - {@link assert} — Throws {@link TypeGuardError} with detailed error info on\n * mismatch\n * - {@link validate} — Returns all errors without throwing\n *\n * @template T Target type to check\n * @template N Maximum depth to descend before accepting a value structurally.\n * Must be a non-negative integer literal. Defaults to `2`.\n * @param input Value to test\n * @returns `true` if valid up to depth `N`, `false` otherwise (type predicate\n * `input is T`)\n */\nexport function shallow<T, N extends number = 2>(input: T): input is T;\n\n/**\n * Tests type `T` up to a limited depth.\n *\n * Like {@link is}, but only descends into nested objects, arrays, and tuples\n * until the depth budget `N` is exhausted; beyond that point a value is\n * accepted as long as it is an `object` (or `null` where the type permits).\n * Useful for **discrimination** rather than full validation — when you only\n * need to know which branch of a union an input belongs to, paying for a deep\n * structural check of every leaf is wasteful.\n *\n * Because the check is shallow past depth `N`, a `true` result is **not** a\n * guarantee that the whole value conforms to `T`. The name `shallow` reflects\n * this: only the discriminating, near-surface part of the type is verified. For\n * a full guarantee, use {@link is}.\n *\n * Related functions:\n *\n * - {@link is} — Full-depth check, returns a sound type guard\n * - {@link assert} — Throws {@link TypeGuardError} with detailed error info on\n * mismatch\n * - {@link validate} — Returns all errors without throwing\n *\n * @template T Target type to check\n * @template N Maximum depth to descend before accepting a value structurally.\n * Must be a non-negative integer literal. Defaults to `2`.\n * @param input Value to test\n * @returns `true` if valid up to depth `N`, `false` otherwise (type predicate\n * `input is T`)\n */\nexport function shallow<T, N extends number = 2>(input: unknown): input is T;\n\n/** @internal */\nexport function shallow(): never {\n NoTransformConfigurationError(\"shallow\");\n}\n\n/**\n * Validates type `T`.\n *\n * Unlike {@link assert} which throws on first error, this function continues\n * checking and collects all type mismatches into {@link IValidation.errors}\n * array. Never throws.\n *\n * Return structure:\n *\n * - `success: true` → `data` contains validated input as `T`\n * - `success: false` → `errors` array of {@link IValidation.IError} with `path`,\n * `expected`, `value`\n *\n * Related functions:\n *\n * - {@link assert} — Throws on first error instead of collecting all\n * - {@link is} — Simple boolean check\n * - {@link validateEquals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to validate against\n * @param input Value to validate\n * @returns {@link IValidation} <T> containing either `data` or `errors`\n */\nexport function validate<T>(input: T): IValidation<T>;\n\n/**\n * Validates type `T`.\n *\n * Unlike {@link assert} which throws on first error, this function continues\n * checking and collects all type mismatches into {@link IValidation.errors}\n * array. Never throws.\n *\n * Return structure:\n *\n * - `success: true` → `data` contains validated input as `T`\n * - `success: false` → `errors` array of {@link IValidation.IError} with `path`,\n * `expected`, `value`\n *\n * Related functions:\n *\n * - {@link assert} — Throws on first error instead of collecting all\n * - {@link is} — Simple boolean check\n * - {@link validateEquals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to validate against\n * @param input Value to validate\n * @returns {@link IValidation} <T> containing either `data` or `errors`\n */\nexport function validate<T>(input: unknown): IValidation<T>;\n\n/** @internal */\nexport function validate(): never {\n NoTransformConfigurationError(\"validate\");\n}\n\n/* -----------------------------------------------------------\n STRICT VALIDATORS\n----------------------------------------------------------- */\n/**\n * Asserts type `T` with strict equality.\n *\n * Stricter than {@link assert}: also fails when input contains any property not\n * defined in type `T`. For extra property errors, `expected` will be\n * `\"undefined\"`.\n *\n * Related functions:\n *\n * - {@link assert} — Allows extra properties\n * - {@link equals} — Boolean result without throwing\n * - {@link validateEquals} — Collects all errors without throwing\n * - {@link assertGuardEquals} — Type guard version with no return value\n *\n * @template T Target type for exact match\n * @param input Value to validate\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns The input value typed as `T`\n * @throws {TypeGuardError} When type mismatch or extra property detected\n */\nexport function assertEquals<T>(\n input: T,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): T;\n\n/**\n * Asserts type `T` with strict equality.\n *\n * Stricter than {@link assert}: also fails when input contains any property not\n * defined in type `T`. For extra property errors, `expected` will be\n * `\"undefined\"`.\n *\n * Related functions:\n *\n * - {@link assert} — Allows extra properties\n * - {@link equals} — Boolean result without throwing\n * - {@link validateEquals} — Collects all errors without throwing\n * - {@link assertGuardEquals} — Type guard version with no return value\n *\n * @template T Target type for exact match\n * @param input Value to validate\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns The input value typed as `T`\n * @throws {TypeGuardError} When type mismatch or extra property detected\n */\nexport function assertEquals<T>(\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): T;\n\n/** @internal */\nexport function assertEquals(): never {\n NoTransformConfigurationError(\"assertEquals\");\n}\n\n/**\n * Asserts type `T` with strict equality as assertion guard.\n *\n * Combines {@link assertGuard} with strict equality checking. Returns nothing\n * but narrows input to type `T`. Also fails when input contains properties not\n * in `T`.\n *\n * Related functions:\n *\n * - {@link assertGuard} — Allows extra properties\n * - {@link assertEquals} — Returns value instead of type guard\n * - {@link equals} — Boolean result without throwing\n * - {@link validateEquals} — Collects all errors without throwing\n *\n * @template T Target type for exact match\n * @param input Value to assert (narrowed to `T` after call)\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @throws {TypeGuardError} When type mismatch or extra property detected\n */\nexport function assertGuardEquals<T>(\n input: T,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): asserts input is T;\n\n/**\n * Asserts type `T` with strict equality as assertion guard.\n *\n * Combines {@link assertGuard} with strict equality checking. Returns nothing\n * but narrows input to type `T`. Also fails when input contains properties not\n * in `T`.\n *\n * Related functions:\n *\n * - {@link assertGuard} — Allows extra properties\n * - {@link assertEquals} — Returns value instead of type guard\n * - {@link equals} — Boolean result without throwing\n * - {@link validateEquals} — Collects all errors without throwing\n *\n * @template T Target type for exact match\n * @param input Value to assert (narrowed to `T` after call)\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @throws {TypeGuardError} When type mismatch or extra property detected\n */\nexport function assertGuardEquals<T>(\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): asserts input is T;\n\n/** @internal */\nexport function assertGuardEquals(): never {\n NoTransformConfigurationError(\"assertGuardEquals\");\n}\n\n/**\n * Tests type `T` with strict equality.\n *\n * Stricter than {@link is}: also returns `false` when input contains any\n * property not defined in type `T`. Useful for detecting unexpected data or\n * typos.\n *\n * Related functions:\n *\n * - {@link is} — Allows extra properties\n * - {@link assertEquals} — Throws with detailed error info on mismatch\n * - {@link validateEquals} — Returns all errors without throwing\n *\n * @template T Target type for exact match\n * @param input Value to test\n * @returns `true` if valid, `false` otherwise (type predicate `input is T`)\n */\nexport function equals<T>(input: T): input is T;\n\n/**\n * Tests type `T` with strict equality.\n *\n * Stricter than {@link is}: also returns `false` when input contains any\n * property not defined in type `T`. Useful for detecting unexpected data or\n * typos.\n *\n * Related functions:\n *\n * - {@link is} — Allows extra properties\n * - {@link assertEquals} — Throws with detailed error info on mismatch\n * - {@link validateEquals} — Returns all errors without throwing\n *\n * @template T Target type for exact match\n * @param input Value to test\n * @returns `true` if valid, `false` otherwise (type predicate `input is T`)\n */\nexport function equals<T>(input: unknown): input is T;\n\n/** @internal */\nexport function equals(): never {\n NoTransformConfigurationError(\"equals\");\n}\n\n/**\n * Validates type `T` with strict equality.\n *\n * Combines {@link validate} with strict equality checking. Collects all errors\n * including extra property violations into {@link IValidation.errors} array.\n *\n * Return structure:\n *\n * - `success: true` → `data` contains validated input as `T`\n * - `success: false` → `errors` array with `path`, `expected`, `value` for each\n * mismatch\n *\n * Related functions:\n *\n * - {@link validate} — Allows extra properties\n * - {@link assertEquals} — Throws on first error\n * - {@link equals} — Simple boolean check\n *\n * @template T Target type for exact match\n * @param input Value to validate\n * @returns {@link IValidation} <T> containing either `data` or `errors`\n */\nexport function validateEquals<T>(input: T): IValidation<T>;\n\n/**\n * Validates type `T` with strict equality.\n *\n * Combines {@link validate} with strict equality checking. Collects all errors\n * including extra property violations into {@link IValidation.errors} array.\n *\n * Return structure:\n *\n * - `success: true` → `data` contains validated input as `T`\n * - `success: false` → `errors` array with `path`, `expected`, `value` for each\n * mismatch\n *\n * Related functions:\n *\n * - {@link validate} — Allows extra properties\n * - {@link assertEquals} — Throws on first error\n * - {@link equals} — Simple boolean check\n *\n * @template T Target type for exact match\n * @param input Value to validate\n * @returns {@link IValidation} <T> containing either `data` or `errors`\n */\nexport function validateEquals<T>(input: unknown): IValidation<T>;\n\n/** @internal */\nexport function validateEquals(): never {\n NoTransformConfigurationError(\"validateEquals\");\n}\n\n/* -----------------------------------------------------------\n RANDOM\n----------------------------------------------------------- */\n/**\n * Generates random data of type `T`.\n *\n * Creates random instance conforming to compile-time type `T`. Generates only\n * primitive data; methods in `T` are ignored. If `T` has `toJSON()` method,\n * generates its return type instead.\n *\n * @template T Type of data to generate\n * @param generator Custom random generator implementing {@link IRandomGenerator}\n * @returns Randomly generated data as `Resolved<T>`\n * @danger You must configure the generic argument `T`\n */\nexport function random(generator?: Partial<IRandomGenerator>): never;\n\n/**\n * Generates random data of type `T`.\n *\n * Creates random instance conforming to compile-time type `T`. Generates only\n * primitive data; methods in `T` are ignored. If `T` has `toJSON()` method,\n * generates its return type instead.\n *\n * @template T Type of data to generate\n * @param generator Custom random generator implementing {@link IRandomGenerator}\n * @returns Randomly generated data as `Resolved<T>`\n */\nexport function random<T>(generator?: Partial<IRandomGenerator>): Resolved<T>;\n\n/** @internal */\nexport function random(): never {\n NoTransformConfigurationError(\"random\");\n}\n\n/* -----------------------------------------------------------\n FACTORY FUNCTIONS\n----------------------------------------------------------- */\n/**\n * Creates reusable {@link assert} function.\n *\n * Returns a function that can be called multiple times without recompilation.\n * Useful when the same type validation is needed repeatedly.\n *\n * @template T Target type to validate against\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assert function `(input: unknown) => T`\n * @danger You must configure the generic argument `T`\n */\nexport function createAssert(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): never;\n\n/**\n * Creates reusable {@link assert} function.\n *\n * Returns a function that can be called multiple times without recompilation.\n * Useful when the same type validation is needed repeatedly.\n *\n * @template T Target type to validate against\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assert function `(input: unknown) => T`\n */\nexport function createAssert<T>(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): (input: unknown) => T;\n\n/** @internal */\nexport function createAssert<T>(): (input: unknown) => T {\n NoTransformConfigurationError(\"createAssert\");\n}\n\n/**\n * Creates reusable {@link assertGuard} function.\n *\n * Returns a reusable type guard assertion function.\n *\n * TypeScript requirement: You must declare the variable type explicitly. `const\n * fn: AssertionGuard<T> = createAssertGuard<T>()` — otherwise compile error.\n *\n * @template T Target type to validate against\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assertion guard function\n * @danger You must configure the generic argument `T`\n */\nexport function createAssertGuard(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): never;\n\n/**\n * Creates reusable {@link assertGuard} function.\n *\n * Returns a reusable type guard assertion function.\n *\n * TypeScript requirement: You must declare the variable type explicitly. `const\n * fn: AssertionGuard<T> = createAssertGuard<T>()` — otherwise compile error.\n *\n * @template T Target type to validate against\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assertion guard function\n */\nexport function createAssertGuard<T>(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): AssertionGuard<T>;\n\n/** @internal */\nexport function createAssertGuard<T>(): AssertionGuard<T> {\n NoTransformConfigurationError(\"createAssertGuard\");\n}\n\n/**\n * Creates reusable {@link is} function.\n *\n * Returns a type guard function that can be called multiple times without\n * recompilation.\n *\n * @template T Target type to check\n * @returns Reusable type guard function `(input: unknown) => input is T`\n * @danger You must configure the generic argument `T`\n */\nexport function createIs(): never;\n\n/**\n * Creates reusable {@link is} function.\n *\n * Returns a type guard function that can be called multiple times without\n * recompilation.\n *\n * @template T Target type to check\n * @returns Reusable type guard function `(input: unknown) => input is T`\n */\nexport function createIs<T>(): (input: unknown) => input is T;\n\n/** @internal */\nexport function createIs<T>(): (input: unknown) => input is T {\n NoTransformConfigurationError(\"createIs\");\n}\n\n/**\n * Creates reusable {@link shallow} function.\n *\n * Returns a depth-limited type guard function that can be called multiple times\n * without recompilation.\n *\n * @template T Target type to check\n * @template N Maximum depth to descend before accepting a value structurally.\n * Must be a non-negative integer literal. Defaults to `2`.\n * @returns Reusable type guard function `(input: unknown) => input is T`\n * @danger You must configure the generic argument `T`\n */\nexport function createShallow(): never;\n\n/**\n * Creates reusable {@link shallow} function.\n *\n * Returns a depth-limited type guard function that can be called multiple times\n * without recompilation.\n *\n * @template T Target type to check\n * @template N Maximum depth to descend before accepting a value structurally.\n * Must be a non-negative integer literal. Defaults to `2`.\n * @returns Reusable type guard function `(input: unknown) => input is T`\n */\nexport function createShallow<T, N extends number = 2>(): (\n input: unknown,\n) => input is T;\n\n/** @internal */\nexport function createShallow<T>(): (input: unknown) => input is T {\n NoTransformConfigurationError(\"createShallow\");\n}\n\n/**\n * Creates reusable {@link validate} function.\n *\n * Returns a validation function that can be called multiple times without\n * recompilation. Also implements {@link StandardSchemaV1} interface for\n * interoperability.\n *\n * @template T Target type to validate against\n * @returns Reusable validate function `(input: unknown) => IValidation<T>`\n * @danger You must configure the generic argument `T`\n */\nexport function createValidate(): never;\n\n/**\n * Creates reusable {@link validate} function.\n *\n * Returns a validation function that can be called multiple times without\n * recompilation. Also implements {@link StandardSchemaV1} interface for\n * interoperability.\n *\n * @template T Target type to validate against\n * @returns Reusable validate function `(input: unknown) => IValidation<T>`\n */\nexport function createValidate<T>(): ((input: unknown) => IValidation<T>) &\n StandardSchemaV1<T, T>;\n\n/** @internal */\nexport function createValidate(): ((input: unknown) => IValidation) &\n StandardSchemaV1<unknown, unknown> {\n NoTransformConfigurationError(\"createValidate\");\n}\n\n/**\n * Creates reusable {@link assertEquals} function.\n *\n * Returns a strict assertion function that rejects superfluous properties. Can\n * be called multiple times without recompilation.\n *\n * @template T Target type for exact match\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assertEquals function `(input: unknown) => T`\n * @danger You must configure the generic argument `T`\n */\nexport function createAssertEquals(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): never;\n\n/**\n * Creates reusable {@link assertEquals} function.\n *\n * Returns a strict assertion function that rejects superfluous properties. Can\n * be called multiple times without recompilation.\n *\n * @template T Target type for exact match\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assertEquals function `(input: unknown) => T`\n */\nexport function createAssertEquals<T>(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): (input: unknown) => T;\n\n/** @internal */\nexport function createAssertEquals<T>(): (input: unknown) => T {\n NoTransformConfigurationError(\"createAssertEquals\");\n}\n\n/**\n * Creates reusable {@link assertGuardEquals} function.\n *\n * Returns a strict assertion guard that rejects superfluous properties.\n *\n * TypeScript requirement: You must declare the variable type explicitly. `const\n * fn: AssertionGuard<T> = createAssertGuardEquals<T>()` — otherwise compile\n * error.\n *\n * @template T Target type for exact match\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assertion guard function\n * @danger You must configure the generic argument `T`\n */\nexport function createAssertGuardEquals(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): never;\n\n/**\n * Creates reusable {@link assertGuardEquals} function.\n *\n * Returns a strict assertion guard that rejects superfluous properties.\n *\n * TypeScript requirement: You must declare the variable type explicitly. `const\n * fn: AssertionGuard<T> = createAssertGuardEquals<T>()` — otherwise compile\n * error.\n *\n * @template T Target type for exact match\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assertion guard function\n */\nexport function createAssertGuardEquals<T>(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): AssertionGuard<T>;\n\n/** @internal */\nexport function createAssertGuardEquals<T>(): AssertionGuard<T> {\n NoTransformConfigurationError(\"createAssertGuardEquals\");\n}\n\n/**\n * Creates reusable {@link equals} function.\n *\n * Returns a strict type guard that rejects superfluous properties. Can be\n * called multiple times without recompilation.\n *\n * @template T Target type for exact match\n * @returns Reusable type guard function `(input: unknown) => input is T`\n * @danger You must configure the generic argument `T`\n */\nexport function createEquals(): never;\n\n/**\n * Creates reusable {@link equals} function.\n *\n * Returns a strict type guard that rejects superfluous properties. Can be\n * called multiple times without recompilation.\n *\n * @template T Target type for exact match\n * @returns Reusable type guard function `(input: unknown) => input is T`\n */\nexport function createEquals<T>(): (input: unknown) => input is T;\n\n/** @internal */\nexport function createEquals<T>(): (input: unknown) => input is T {\n NoTransformConfigurationError(\"createEquals\");\n}\n\n/**\n * Creates reusable {@link validateEquals} function.\n *\n * Returns a strict validation function that rejects superfluous properties.\n * Also implements {@link StandardSchemaV1} interface for interoperability.\n *\n * @template T Target type for exact match\n * @returns Reusable validateEquals function `(input: unknown) =>\n * IValidation<T>`\n * @danger You must configure the generic argument `T`\n */\nexport function createValidateEquals(): never;\n\n/**\n * Creates reusable {@link validateEquals} function.\n *\n * Returns a strict validation function that rejects superfluous properties.\n * Also implements {@link StandardSchemaV1} interface for interoperability.\n *\n * @template T Target type for exact match\n * @returns Reusable validateEquals function `(input: unknown) =>\n * IValidation<T>`\n */\nexport function createValidateEquals<T>(): ((\n input: unknown,\n) => IValidation<T>) &\n StandardSchemaV1<T, T>;\n\n/** @internal */\nexport function createValidateEquals(): ((input: unknown) => IValidation) &\n StandardSchemaV1<unknown, unknown> {\n NoTransformConfigurationError(\"createValidateEquals\");\n}\n\n/**\n * Creates reusable {@link random} function.\n *\n * Returns a random data generator that can be called multiple times without\n * recompilation.\n *\n * @template T Type of data to generate\n * @param generator Custom random generator implementing {@link IRandomGenerator}\n * @returns Reusable random function `() => Resolved<T>`\n * @danger You must configure the generic argument `T`\n */\nexport function createRandom(generator?: Partial<IRandomGenerator>): never;\n\n/**\n * Creates reusable {@link random} function.\n *\n * Returns a random data generator that can be called multiple times without\n * recompilation.\n *\n * @template T Type of data to generate\n * @param generator Custom random generator implementing {@link IRandomGenerator}\n * @returns Reusable random function `() => Resolved<T>`\n */\nexport function createRandom<T>(\n generator?: Partial<IRandomGenerator>,\n): () => Resolved<T>;\n\n/** @internal */\nexport function createRandom(): never {\n NoTransformConfigurationError(\"createRandom\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuFA,SAAgB,SAAgB;CAC9B,8BAA8B,QAAQ;AACxC;;AA6DA,SAAgB,cAAqB;CACnC,8BAA8B,aAAa;AAC7C;;AA2CA,SAAgB,KAAY;CAC1B,8BAA8B,IAAI;AACpC;;AAiEA,SAAgB,UAAiB;CAC/B,8BAA8B,SAAS;AACzC;;AAqDA,SAAgB,WAAkB;CAChC,8BAA8B,UAAU;AAC1C;;AA0DA,SAAgB,eAAsB;CACpC,8BAA8B,cAAc;AAC9C;;AAqDA,SAAgB,oBAA2B;CACzC,8BAA8B,mBAAmB;AACnD;;AAyCA,SAAgB,SAAgB;CAC9B,8BAA8B,QAAQ;AACxC;;AAmDA,SAAgB,iBAAwB;CACtC,8BAA8B,gBAAgB;AAChD;;AAiCA,SAAgB,SAAgB;CAC9B,8BAA8B,QAAQ;AACxC;;AAqCA,SAAgB,eAAyC;CACvD,8BAA8B,cAAc;AAC9C;;AAsCA,SAAgB,oBAA0C;CACxD,8BAA8B,mBAAmB;AACnD;;AA0BA,SAAgB,WAA8C;CAC5D,8BAA8B,UAAU;AAC1C;;AAgCA,SAAgB,gBAAmD;CACjE,8BAA8B,eAAe;AAC/C;;AA6BA,SAAgB,iBACqB;CACnC,8BAA8B,gBAAgB;AAChD;;AAkCA,SAAgB,qBAA+C;CAC7D,8BAA8B,oBAAoB;AACpD;;AAwCA,SAAgB,0BAAgD;CAC9D,8BAA8B,yBAAyB;AACzD;;AA0BA,SAAgB,eAAkD;CAChE,8BAA8B,cAAc;AAC9C;;AA+BA,SAAgB,uBACqB;CACnC,8BAA8B,sBAAsB;AACtD;;AA8BA,SAAgB,eAAsB;CACpC,8BAA8B,cAAc;AAC9C"}