Is ChadScript for you?
ChadScript is an alpha, not released yet (2.0.0-alpha.1 is in preparation, see the changelog). Every accepted program is tested against Node, but the subset is still growing. Here is an honest fit check.
If you are not sure, run chad check file.ts: it tells you whether the file is in the subset, and why not. A rejected file is still valid TypeScript and runs on Node unchanged.
Good fit today
- CLI tools and scripts that read arguments and files, crunch data, and print results: startup is about a millisecond instead of tens of milliseconds, and the output is one small self-contained binary.
- Startup-sensitive jobs: things invoked thousands of times from shell loops, build steps or hooks.
- Compute in plain TypeScript: numeric loops, classes, maps and sets, closures. Several of the benchmarks run 1.5 to 4 times faster than Node, startup included.
- Code you want checked hard: programs must pass tsc at maximum strictness, and anything the compiler cannot reproduce exactly is refused at compile time rather than approximated.
Not a fit (yet, or ever)
| You need | Status |
|---|---|
| npm packages that ship only JavaScript | Never compiled; such a program should run on Node (CS1226). Packages that ship TypeScript source work. |
eval, new Function, prototype changes, adding or deleting properties, Proxy | Never: they need a JavaScript engine, and the binary has none. |
| DOM or browser APIs | Not a goal: ChadScript targets native command-line programs. |
| HTTP servers, sockets, child processes, environment variables | Not yet. Only node:fs, node:fs/promises and node:path are built in. |
Regular expressions, Date instances | Planned (CS1213, CS1215). |
| Non-ASCII strings | Gated until the Unicode decision (CS1216): strings are UTF-8 and exact for ASCII. |
| Allocation-heavy workloads | Works, but the garbage collector is new and not yet generational; binary_trees is slower than Node today. |
| Windows | Untested: CI runs on Linux and macOS. |
Current limitations
Each of these is rejected at compile time with a specific code, never silently miscompiled:
- Destructured parameters with defaults, and functions with optional parameters used through a function type that omits them (CS1217);
let x;without an initializer (CS1218). - Getters, setters,
static,private,readonly,abstract, and methods written inside object literals (CS1000). toFixedand the other number formatting methods (CS1221).- Iterating a
Mapdirectly,Map.entries(), and tuples of mixed types (CS1222, CS1233). - Generics instantiated with arrays, maps or functions (CS1242).
enum,namespace, decorators,var,==(CS1202, CS1209, CS1208, CS1212, CS1203).Promise.reject,Promise.race, top-levelawait(CS1220, CS1000);.then()on a promise (CS1225), useawait.new Promiseunless its executor is written inline withresolve(andreject) annotated (CS1000); see async / await.- A class that extends
Erroror any other built-in class,.stackon an error, and assigning to an error's fields (CS1000). - Throwing anything but a string, one of the four error classes (
Error,TypeError,RangeError,SyntaxError) or a caught value (CS1247), and&&,||or??on a caught value (CS1248). - Spreading an array into the arguments of a library function (
Math.max(...xs)) (CS1000). new Map(...)from anything but an array literal of pairs (CS1000).- Converting a function, an object with
valueOf, or an object whose owntoString()its declared type does not declare into a string (CS1238). - Regular expressions,
Dateobjects (onlyDate.now()works),any,delete, adding properties to an object after it is created, index signatures (use aMap), labeled statements, and optional chains longer than one?.. - Strings are UTF-8 and exact for ASCII text; operations whose result depends on UTF-16 code units (
charCodeAt,<on strings, ...) are rejected (CS1216).
Other differences in this release:
JSON.parseof malformed text throws aSyntaxErrorlike Node, but the message text is ChadScript's own. A document that does not match the declared type throws anError, where Node would return it unchecked (JSON).- Generic type parameters hold numbers, strings, booleans, null, undefined and objects; arrays, Maps, Sets and functions as type arguments are rejected (CS1242).
- There are no prebuilt compiler binaries: ChadScript runs from a source checkout under bun.
The full list of what is accepted is the subset reference; every rejection is explained in the error reference.
If a program compiles but behaves differently from Node
That is a P0 bug, never a known quirk: the one deliberate exception is JSON.parse shape checking. Please open an issue with the program and both outputs.
Next: Quickstart, or the roadmap.