Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

errval is a TypeScript library whose author describes it as a way to return errors explicitly, inspired by Go’s if err != nil convention. Its API puts the error first in a tuple, while the author says its inferred error unions and match helper can make callers handle each possible error case. Those are the author’s claims, not independently verified guarantees.

What problem is errval trying to solve?

Go makes errors visible in a function’s return values. Its official guidance says, “Errors are indicated by returning an error as an additional return value from a function,” and that a nil error means there was no error. Callers commonly check the returned error before proceeding. The Go Project’s Go Wiki: Errors describes this convention.

TypeScript developers often encounter errors through exceptions, result objects, or libraries with their own conventions. errval’s author, Aymane Aallaoui, says he missed Go’s explicit returns when switching back to TypeScript and built errval to bring that style to the language. It is an author-created library, not a TypeScript feature or an official Go port. Aallaoui’s September 20, 2026 article introduces the project and its design.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How does the errval API work?

In the author’s example, a function returns a tuple with the error first and the successful value second. The caller destructures it, checks the error, and only then uses the value:

const [err, user] = await getUser(id);

if (err) {
  // Handle the error
} else {
  // Use user
}

The example’s key idea is that success and failure are represented in the return value rather than relying solely on an exception being thrown. The error-first order is deliberate: Aallaoui says it is intended to make it harder to ignore a failure by extracting only the success value from the tuple. That is the author’s stated design rationale; it does not by itself establish what every possible misuse the library prevents.

What does the author claim about TypeScript types?

Aallaoui says errval infers error unions from calls to fail() and that its match helper requires a handler for each possible error case. If implemented as described, that would provide a compile-time completeness check for the error cases represented by the library’s types.

Rank #2
TypeScript Programming Language - Software Engineer & Coder T-Shirt
  • TypeScript implements a superset of syntax for strictly typed development, facilitating deep static analysis and enhanced development environment integration. The compiler translates source into standard script formats, ensuring parity across any runtime.
  • TypeScript is ideal for front-end developers, full-stack engineers, and software architects who build large-scale web applications. It serves those looking to improve code excellence, reduce bugs through static checking, and maintain complex projects more.
  • Lightweight, Classic fit, Double-needle sleeve and bottom hem

TypeScript’s own control-flow analysis narrows union types when code checks a value. The TypeScript Handbook’s narrowing documentation explains that language feature. It provides context for why an error check can help TypeScript reason about branches, but it does not verify errval’s particular API or implementation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The distinction matters: Go’s convention makes the error an explicit return value, but the cited Go guidance does not say that Go’s compiler forces callers to handle every returned error. The stronger exhaustiveness claim here belongs to errval’s stated TypeScript design. The project’s source code was not available for independent verification, so treat the inference and completeness behavior as claims from its author’s post.

What performance figures did the author report?

Aallaoui reported benchmarks using Node 24.16. In a workload where half of requests fail, the author measured the following per-request times:

Approach Author-reported time per request
neverthrow 198 ns
errval 226 ns
try/catch 2,623 ns
Effect runSync 3,952 ns

In a separate comparison where no request failed, the author reported 195 ns per request for try/catch and 203 ns for errval. The author also reported 1,978 ns to create an Error subclass versus 25 ns for an errval error in a breakdown of error construction.

These are figures from one author’s stated test setup, not an independent benchmark or a general performance guarantee. They show different results across the reported workloads: neverthrow was faster than errval in the half-failing comparison, while try/catch was slightly faster in the no-failure comparison. Aallaoui says errval was designed around inferred error unions rather than speed, so the numbers should not be read as proof that it is the fastest option for a real application.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What else does the author report, and what remains unverified?

The September 20, 2026 article describes errval as version 0.1, reports a minified-and-gzipped size of 1.86 kB, and says it supports Node, Bun, and Deno. Aallaoui also says errval errors are real objects that satisfy instanceof Error. These are dated statements by the package author, not independently confirmed current package facts.

The repository could not be inspected for this article. As a result, the current package version, license, exact API, test coverage, implementation details, and present runtime compatibility are not established here. Check the package and its source directly before relying on a particular version, runtime, or behavior.

Is errval a fit for your TypeScript code?

errval is worth evaluating if you prefer visible error returns to exception-driven control flow and want to explore the author’s claimed typed error matching. Before adopting it, review its current source and test it against your own error cases and runtime targets. If you need proven guarantees about exhaustiveness, compatibility, or performance, verify those directly rather than treating the introductory post as independent validation.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.