npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

tsx-strict

v0.2.0

Published

Type-safe TSX runner with automatic Type-checking

Readme

Tsx-Strict

Type-safe TSX runner with automatic type-checking

tsx-strict is a CLI tool that runs TypeScript files with TSX while providing real-time type checking. It combines the speed of tsx with the safety of TypeScript's compiler, ensuring your code is both executable and type-safe.

Features

  • Real-time type checking: Runs TypeScript compiler alongside tsx for immediate feedback
  • Watch mode: Automatically restarts on file changes
  • Intelligent process management: Kills previous processes when recompilation starts
  • Customizable compiler: Support for different TypeScript compiler versions
  • Silent mode: Suppress output when needed
  • Memory management: Configure Node.js memory limits

Installation

pnpm install -g tsx-strict

Or use with npx:

npx tsx-strict your-file.ts

Usage

Basic Usage

tsx-strict app.ts

Watch Mode

tsx-strict --watch app.ts

Skip Type Checking

tsx-strict --no-type-check app.ts

CLI Options

| Option | Description | Default | | ---------------------- | ---------------------------------------- | -------------------- | | -w, --watch | Enable watch mode | false | | --no-clear | Do not clear screen | false | | --compiler | Compiler path | typescript/bin/tsc | | --tsc-args <args...> | Additional TypeScript compiler arguments | [] | | --tsx-args <args...> | Additional tsx arguments | [] | | --silent | Suppress output | false | | --no-type-check | Skip type checking (run tsx directly) | false |

Examples

Basic TypeScript File

tsx-strict src/index.ts

Watch Mode with Custom TSC Arguments

tsx-strict --watch --tsc-args "--strict --exactOptionalPropertyTypes" src/app.ts

Silent Mode

tsx-strict --silent --no-clear src/worker.ts

Skip Type Checking for Quick Execution

tsx-strict --no-type-check src/script.ts

How It Works

tsx-strict runs two processes simultaneously:

  1. TypeScript Compiler (tsc): Performs type checking with --noEmit flag
  2. tsx Runner: Executes the TypeScript file when compilation succeeds

The tool intelligently manages these processes, restarting tsx only when type checking passes and killing previous instances to prevent resource conflicts.

Requirements

  • Node.js >= 20.0.0
  • tsx ^4.20.5 (peer dependency)

API

You can also use tsx-strict programmatically:

import { runTsxStrict } from "tsx-strict";

await runTsxStrict("src/app.ts", {
    watch: true,
    silent: false,
    noClear: false,
    compiler: "typescript/bin/tsc",
    tscArgs: ["--strict"],
    tsxArgs: [],
    noTypeCheck: false,
});

Error Handling

tsx-strict provides clear error messages and exits gracefully on compilation errors. Type errors are displayed in real-time, and the tsx process only runs when compilation is successful.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT

Repository

https://github.com/uanela/tsx-strict

Issues

Report issues at: https://github.com/uanela/tsx-strict/issues