unts

raw JSON →
0.0.0-pre verified Fri May 01 auth: no javascript deprecated

A zero-config tool to run TypeScript files directly without a separate transpilation step. The package is currently at version 0.0.0-pre (unstable, likely pre-release). It differentiates from alternatives like ts-node or tsx by being minimal and dependency-light, with no configuration files or complex setups. Release cadence is unknown due to early stage. Use with caution in production.

error Error: Cannot find package 'unts' from ...
cause Package not installed or import path incorrect.
fix
Run 'npm install unts' and ensure the import statement matches the package name.
error TypeError: unts.run is not a function
cause Using default import when named export is expected, or vice versa.
fix
Use 'import unts from "unts"' then 'unts.run()', or 'import { run } from "unts"'.
breaking Package is version 0.0.0-pre – no stable API; expect breaking changes in any update.
fix Pin to exact version and test thoroughly before upgrading.
gotcha CommonJS require() will throw ERR_REQUIRE_ESM – package is ESM-only.
fix Use import syntax or switch to dynamic import() inside CJS.
gotcha TypeScript types are not bundled; users must install @types/node separately.
fix Run npm install --save-dev @types/node to get Node.js type definitions.
npm install unts
yarn add unts
pnpm add unts

Demonstrates using run() from unts to execute a TypeScript file with options and capture exit code.

import { run } from 'unts';

async function main() {
  const result = await run('script.ts', {
    cwd: process.cwd(),
    stdio: 'inherit'
  });
  console.log('Exit code:', result.exitCode);
}

main().catch(console.error);