Socket
Book a DemoInstallSign in
Socket

tsx-strict

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tsx-strict

Type-safe TSX runner with automatic Type-checking

0.1.4
latest
Source
npmnpm
Version published
Weekly downloads
106
-49.52%
Maintainers
1
Weekly downloads
 
Created
Source

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

OptionDescriptionDefault
-w, --watchEnable watch modefalse
--no-clearDo not clear screenfalse
--compilerCompiler pathtypescript/bin/tsc
--tsc-args <args...>Additional TypeScript compiler arguments[]
--tsx-args <args...>Additional tsx arguments[]
--silentSuppress outputfalse
--no-type-checkSkip 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:

  • TypeScript Compiler (tsc): Performs type checking with --noEmit flag
  • 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

Keywords

tsx

FAQs

Package last updated on 30 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.