typescript-run

0.1.1 • Public • Published

typescript-run

ts-node but extremely fast ⚡️

Uses esbuild to compile TypeScript to JavaScript.

Run Demo on StackBlitz

Install

Install globally

npm i -g typescript-run

ts-run ./src/index.ts

or

Execute with npx

npx typescript-run ./src/index.ts

Usage

ts-run is an alias to typescript-run. You can use either of them.

typescript-run <file-path> # or `ts-run <file-path>`

Options

Watch Mode

Pass --watch or -w flag to enable watch mode. This will listen to your file changes and re-run the script.

ts-run src/index.ts --watch

By default, watch flag will watch over the files that are going to part of your bundle (.ts .js files imported in entry file). You can also override this behavior by passing path to --watch flag with-

ts-run src/index.ts --watch src

This will watch over all the changes in src folder.

You can also pass multiple directories with --watch src examples. This will watch over src and examples both

When to use?

Use tsc for builds and typescript-run for dev-mode.

Warning:

Why esbuild?

  • Esbuild does not do type-checking which makes the TypeScript to JavaScript compilation super fast!
  • Type-checking is not a blocker for running scripts in dev-mode. IDEs can handle it as well as you can individually run tsc in emit mode.

Thanks! Have fun 🌻

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.1
    25
    • latest

Version History

Package Sidebar

Install

npm i typescript-run

Weekly Downloads

20

Version

0.1.1

License

MIT

Unpacked Size

6.32 kB

Total Files

3

Last publish

Collaborators

  • saurabhdaware