Type Alias IValidation<T>

Union type representing the result of type validation

This is the return type of typia.validate functions, returning IValidation.ISuccess on validation success and IValidation.IFailure on validation failure. When validation fails, it provides detailed, granular error information that precisely describes what went wrong, where it went wrong, and what was expected.

This comprehensive error reporting makes IValidation particularly valuable for AI function calling scenarios, where Large Language Models (LLMs) need specific feedback to correct their parameter generation. The detailed error information is used by ILlmFunction.validate() to provide validation feedback to AI agents, enabling iterative correction and improvement of function calling accuracy.

This type uses the Discriminated Union pattern, allowing type specification through the success property:

const result = typia.validate<string>(input);
if (result.success) {
// IValidation.ISuccess<string> type
console.log(result.data); // validated data accessible
} else {
// IValidation.IFailure type
console.log(result.errors); // detailed error information accessible
}

Type Parameters

  • T = unknown

    The type to validate

Jeongho Nam - https://github.com/samchon