Skip to main content

CreateErrorResultGuard

Convenience method for creating an ErrorResultGuard. Takes a predicate function which tests whether the input is considered successful (true) or an error result (false).

Note that the resulting variable must still be type annotated in order for the TypeScript type inference to work as expected:

Example

Ts
Signature

Parameters

testFn

parameter(input: T) => boolean
Was this chapter helpful?
Report Issue
Edited Feb 25, 2026ยทEdit this page