A function that stops throwing can be cheaper to call. A function that promises to stay that way is easier to maintain. scriptc’s new NoThrow contract connects those two ideas. It lets a TypeScript author ask the native compiler to reject a function whose exceptions can escape. The interesting feature is a checked boundary that survives code changes—not a new JavaScript runtime behavior. [1] [2]
Historical edition: October 12, 2026. Evidence cutoff: 11:59:59 p.m. Mountain Time. The seed was posted at 11:25 a.m. Mountain. Technical sources are pinned to repository snapshot e5ed067, recorded at 11:40 p.m. Mountain. Retrieved 2026-10-16; later documentation changes and replies are excluded.
The useful part of the “faster than Rust” post
Malte Ubl frames the feature as part of an effort to make TypeScript compiled with scriptc outperform Rust. His post also makes a narrower point: the compiler already analyzes whether calls can throw, so an author can turn that analysis into a checked promise. The quoted announcement by Chris Tate highlights catching newly introduced unhandled exceptions when code or dependencies change. Neither post establishes a general performance result against Rust. Read Ubl’s original post. [3] [1]
scriptc is an experimental compiler from TypeScript and JavaScript to native executables and WebAssembly. Its README describes compiling imported npm code too, while explicitly limiting support to a subset of the language and Node APIs. A compiler feature inside that supported subset is different from making an arbitrary Node application faster by adding one annotation. [4]
Same TypeScript value, additional compiler obligation
The type declaration is deliberately simple: NoThrow aliases T. An ordinary TypeScript checker still sees the underlying return value type. The import is type-only, so it does not load a runtime module after erasure. scriptc adds the obligation: establish that an exception cannot escape this function, or reject the build. That division lets the annotation be valid TypeScript without claiming TypeScript itself has gained checked exceptions. [2]
import type { NoThrow } from "@scriptc/types";
function isAsciiDigit(code: number): NoThrow<boolean> {
return code >= 48 && code <= 57;
}
console.log(isAsciiDigit(55), isAsciiDigit(65));
This example adapts the predicate pattern in the project’s scanner test. For these inputs it prints true false. The upstream fixture also marks scanner methods and combines the promise with an integer contract. The useful design is a small, inspectable helper whose behavior is easy to preserve while callers rely on it. This article checked the adapted example with TypeScript and Node; it does not claim a fresh scriptc compilation or benchmark. [5]
A number return type does not rule out an exception
A function can return a number on success and still throw on another path. scriptc’s diagnostic fixture includes an annotated function calling a parser which throws, recursion, and a callback which may throw. Its retained diagnostic snapshot reports the call path, rather than treating the return type as proof. Changes behind a helper or dependency boundary are exactly where this distinction becomes useful. [6]
import type { NoThrow } from "@scriptc/types";
function requirePositive(value: number): number {
if (value <= 0) throw new RangeError("positive value required");
return value;
}
function positive(value: number): NoThrow<number> {
return requirePositive(value);
}
The second snippet illustrates a contract violation: positive still reaches a throw through requirePositive. The alias alone does not make an ordinary TypeScript check reject it. The analogous upstream case is rejected by scriptc with SC7001. Removing the annotation would remove the obligation, not remove the exception. Returning a safe value or handling the failure changes the actual behavior. [6] [2]
Catching an error can satisfy the boundary
The boundary is about what escapes, not whether execution ever enters a throw. The project’s handler fixture calls a throwing digit parser inside try and returns a fallback from catch. It separately exercises rethrows, cleanup, nested handlers and exceptions caused by ordinary property access. A handler must actually cover the path; merely adding finally does not mean the pending exception disappears. [7]
| Simple numeric predicate | No throwing path in the upstream pattern | Good candidate for an explicit contract |
|---|---|---|
| Calls a throwing parser | Exception can escape through the call | Return type alone does not protect the caller |
| Parser wrapped in try/catch | Fallback returned by the handler | Can satisfy the contract when handlers do not throw |
| Cleanup-only finally | Pending exception may still propagate | Cleanup is not recovery |
| Recursive function | Stack guard can throw | Recursion blocks this promise in the documented model |
No matching rows.
The documented limits matter. Recursive functions are excluded because the stack guard may throw on entry; async functions and generators cannot use this contract. Worker-thread programs have an additional caveat: a termination request can unwind through a catch, so try/catch does not discharge the promise there. Use the model the compiler documents, rather than assuming a catch is universally sufficient. [8]
The maintenance guard may matter more than the annotation
The performance mechanism is concrete: when scriptc proves a call cannot throw, the caller does not need its normal post-call exception check. But the compiler already performs that inference. Writing the contract is not evidence of an extra speedup over the same unannotated code when it already infers the same result. The new value is making that property explicit and enforceable as the implementation changes. [8] [3]
For a parser, scanner or other repeatedly called helper, that is a useful review question: should this boundary remain free of escaping exceptions? If yes, the contract can make a later throwing path a build issue. If no, preserve the error model and handle it at the appropriate layer. Adding broad catches just to obtain a promise would be a poor trade if callers lose errors they need to see. That last point is an engineering judgment, not an upstream performance claim.
Start with a narrow program and check the compiler’s compatibility diagnostics. The pinned limitations describe differences from Node and unsupported operations; even a program accepted by its own TypeScript setup can need additional work. Benchmark the actual workload, verify equivalent outputs and error behavior, and retain the compiler version. There is no measured Rust comparison in this edition. [9]
The compelling idea is a promise the compiler can challenge. TypeScript keeps the familiar source format; scriptc checks an additional execution property. Whether the resulting program wins a performance comparison remains a separate experiment.
References & Works Cited
9 SOURCES-
Chris Tate (2026-10-12). Chris Tate announces NoThrow<T> support.
https://x.com/ctatedev/status/2109691018085818790 -
Vercel Labs scriptc contributors (n.d.). scriptc contract type declarations. Version e5ed067.
https://github.com/vercel-labs/scriptc/blob/e5ed06771fd8db2ae1a799740716eb3f43a16f0f/packages/types/index.d.ts -
Malte Ubl (2026-10-12). Malte Ubl on scriptc and compiler-checked exception contracts.
https://x.com/cramforce/status/2109696873133179058 -
Vercel Labs scriptc contributors (n.d.). scriptc README at the October 12 historical snapshot. Version e5ed067.
https://github.com/vercel-labs/scriptc/blob/e5ed06771fd8db2ae1a799740716eb3f43a16f0f/README.md -
Vercel Labs scriptc contributors (n.d.). scriptc NoThrow scanner test. Version e5ed067.
https://github.com/vercel-labs/scriptc/blob/e5ed06771fd8db2ae1a799740716eb3f43a16f0f/tests/corpus/4631-contract-nothrow.ts -
Vercel Labs scriptc contributors (n.d.). scriptc NoThrow rejection fixtures and call paths. Version e5ed067.
https://github.com/vercel-labs/scriptc/blob/e5ed06771fd8db2ae1a799740716eb3f43a16f0f/tests/diagnostics/contract-nothrow.ts -
Vercel Labs scriptc contributors (n.d.). scriptc try/catch and finally contract fixtures. Version e5ed067.
https://github.com/vercel-labs/scriptc/blob/e5ed06771fd8db2ae1a799740716eb3f43a16f0f/tests/corpus/4641-nothrow-try-catch.ts -
Vercel Labs scriptc contributors (n.d.). scriptc contract types documentation. Version e5ed067.
https://github.com/vercel-labs/scriptc/blob/e5ed06771fd8db2ae1a799740716eb3f43a16f0f/docs/content/docs/contracts.mdx -
Vercel Labs scriptc contributors (n.d.). scriptc limitations at the October 12 historical snapshot. Version e5ed067.
https://github.com/vercel-labs/scriptc/blob/e5ed06771fd8db2ae1a799740716eb3f43a16f0f/docs/content/docs/limitations.mdx
