TypeScript Runtime
TypeScript runtime requirements, setup, and gotchas for poly-bench
This guide walks through using TypeScript with poly-bench, from init through run. It covers what gets created, how dependencies work, and common gotchas.
You need Node.js installed and available on your PATH. The table below summarizes the requirements.
| Requirement | Details |
|---|---|
| Binary | node on PATH |
| Version | Node.js 18+ |
| Verify | node --version |
Install from nodejs.org. If Node.js is missing when you run init, poly-bench can offer to install it interactively during poly-bench init.
When you run poly-bench init --languages ts (or select TypeScript in the interactive flow), poly-bench creates a Node project under .polybench/runtime-env/ts/:
1.polybench/runtime-env/ts/2├── package.json3├── tsconfig.json4└── src/5 └── main.tsTypeScript is the only runtime that runs npm install during init. All other runtimes defer the install step to poly-bench build or poly-bench install, so your TypeScript project will have dependencies ready immediately after init.
To add TypeScript or JavaScript dependencies, use the add command with the --ts flag:
$poly-bench add --ts lodash@4.17.21The spec format is package@version — for example, lodash@4.17.21. Dependencies are stored in the poly-bench manifest and written to package.json. The typescript-language-server is added automatically as a dev dependency for LSP support in editors.
Running poly-bench install (or poly-bench build) runs npm install in .polybench/runtime-env/ts/. Because npm install already runs at init, subsequent installs mainly update dependencies when you add new packages.
When you run poly-bench run, poly-bench generates TypeScript code and executes it with Node.js. There is no separate compilation step; Node runs the generated .ts files directly (or transpiled output depending on configuration).
The tsconfig uses moduleResolution: "bundler". There is no actual bundler — execution is direct Node. This setting is chosen for compatibility with modern tooling and type resolution.
npm install during init. Other runtimes defer to build or install.moduleResolution: "bundler"; there is no actual bundler — execution is direct Node."type": "module" for ES module support.