Skip to content

@pcvl/schema / FailureResult

Type Alias: FailureResult ​

ts
type FailureResult = Omit<StandardSchemaV1.FailureResult, "issues"> & object;

Defined in: result.ts:23

The failing branch of a Result: an issues array describing every reason the value was rejected. Narrowed to this library's Issue, so code is readable alongside the spec's message and path.

Type Declaration ​

issues ​

ts
readonly issues: ReadonlyArray<Issue>;

Example ​

ts
import { pvl, type FailureResult } from '@pcvl/schema';

const result = pvl.string().validate(42);
if (result.issues) {
  const failure: FailureResult = result;
  console.log(failure.issues[0]?.code); // 'INVALID_TYPE'
}