Perry compiles a practical subset of TypeScript. This page documents what's not supported or works differently from Node.js/tsc.
Types are erased at compile time. There is no runtime type system — Perry doesn't generate type guards or runtime type metadata.
{{#include ../../examples/language/limitations.ts:erased-types}}Use explicit typeof checks where runtime type discrimination is needed.
Perry compiles to native code ahead of time. Dynamic code execution is not possible:
// Not supported
eval("console.log('hi')");
new Function("return 42");
TypeScript decorators are not currently supported:
// Not supported
@Component
class MyClass {}
There is no Reflect API or runtime type metadata:
// Not supported
Reflect.getMetadata("design:type", target, key);
Only static imports are supported:
// Supported
import { foo } from "./module";
// Not supported
const mod = require("./module");
const mod = await import("./module");
Perry compiles classes to fixed structures. Dynamic prototype modification is not supported:
// Not supported
MyClass.prototype.newMethod = function() {};
Object.setPrototypeOf(obj, proto);
The Symbol primitive type is not currently supported:
// Not supported
const sym = Symbol("description");
Weak references are not implemented:
// Not supported
const wm = new WeakMap();
const wr = new WeakRef(obj);
The Proxy object is not supported:
// Not supported
const proxy = new Proxy(target, handler);
Error and basic throw/catch work, but custom error subclasses have limited support:
{{#include ../../examples/language/limitations.ts:error-subclass}}Perry supports real multi-threading via parallelMap and spawn from perry/thread. See Multi-Threading.
Threads do not share mutable state — closures passed to thread primitives cannot capture mutable variables (enforced at compile time). Values are deep-copied across thread boundaries. There is no SharedArrayBuffer or Atomics.
Dynamic property keys in object literals are limited:
// Supported
const key = "name";
obj[key] = "value";
// Not supported
const obj = { [key]: "value" };
Not all npm packages work with Perry:
- Natively supported: ~50 popular packages (fastify, mysql2, redis, etc.) — these are compiled natively. See Standard Library.
compilePackages: Pure TS/JS packages can be compiled natively via configuration.- Not supported: Packages requiring native addons (
.nodefiles),eval(), dynamicrequire(), or Node.js internals.
For cases where you need dynamic behavior, use the JavaScript runtime fallback:
import { jsEval } from "perry/jsruntime";
// Routes specific code through QuickJS for dynamic evaluation
Since there's no runtime type checking, use explicit checks:
{{#include ../../examples/language/limitations.ts:type-narrowing}}- Supported Features — What does work
- Type System — How types are handled