no-ambiguous-error-type
Disallows non-specific types in the error position of Result, ResultAsync, and ResultMaybeAsync.
Rule Details
When the error type of a Result is vague, callers cannot tell the different failure cases apart and cannot handle them exhaustively.
Use a concrete, domain-specific error type instead, as described in Custom Error.
The following types are reported in the error position:
unknownandany- Primitive types:
string,number,boolean,bigint,symbol,null, andundefined objectand{}- The base
Errorclass
The rule checks explicit type annotations such as Result.Result<T, E>. Types inferred by TypeScript are not checked.
Incorrect
Correct
Options
This rule has no options.
