tooling TypeScript maintained library

ts-import

Import TypeScript files into plain Node.js at runtime, with no compile step.

The problem

Node can’t natively execute TypeScript. That’s fine for apps — you compile. It’s not fine for scripts, repls, hot reloads, one-off tools, or any scenario where you want to load a .ts file on demand from inside a Node process that is already running.

The library

ts-import does exactly that: give it a path to a .ts file, get back its module exports. It compiles transparently, caches results, supports ESM and CJS, and stays out of your way. No bundler, no dev server, no --loader flag gymnastics.

Use it in CLIs that want to load user-supplied config written in TypeScript, in build scripts, or anywhere you’d reach for require() if the file weren’t TypeScript.

Install

npm install ts-import