.ts or .tsx file and it executes immediately — no tsc, no build step, no configuration file required. Type annotations, interfaces, generics, and type aliases are stripped at load time using Ant’s built-in OXC type-stripper, leaving only the JavaScript for the engine to execute.
Running a TypeScript file
.ts extension, strips the types, and runs the result. You can use any TypeScript syntax that OXC supports for type stripping.
Type annotations and interfaces
greet.ts and run it with ant greet.ts. The User interface and all type annotations are stripped before execution — none of them reach the engine.
Generics and type aliases
Real-world example: Hono HTTP server
The following file is taken from the Hono example in Ant’s own examples directory. It is a.ts file that Ant runs directly, with no compilation step.
Hono app causes Ant to start an HTTP server automatically on port 3000.
FFI with TypeScript
TypeScript also works with Ant’s native FFI bindings. This example fromexamples/ffi/basic/printf.ts uses an interface to type a native C library:
ant printf.ts. The generic dlopen<libC>() call and the interface libC block are stripped at load time; only the runtime JavaScript reaches the engine.
How type stripping works
Ant uses the OXC type-stripper to remove TypeScript-specific syntax before execution. You can confirm this at runtime:"transform" indicates that Ant strips types rather than performing a full TypeScript compilation.
Ant does not perform type checking. Type errors are silently ignored at runtime — only JavaScript logic errors will surface. Use
tsc --noEmit separately if you want to type-check your code before running it.tsconfig.json
Ant looks for atsconfig.json in the project directory if one is present, but does not require it. If no tsconfig.json exists, Ant applies reasonable defaults. Path aliases defined in tsconfig.json paths are not resolved by Ant’s type-stripper — use a bundler or explicit import paths instead.