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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@2bad/tsfix

v1.1.2

Published

[![NPM version](https://img.shields.io/npm/v/@2bad/tsfix)](https://www.npmjs.com/package/@2bad/tsfix) [![License](https://img.shields.io/npm/l/@2bad/tsfix)](https://www.npmjs.com/package/@2bad/tsfix) [![GitHub Build Status](https://img.shields.io/github/a

Readme

TSFIX

NPM version License GitHub Build Status Code coverage Written in TypeScript

A post-compilation tool that fixes TypeScript's critical ESM compatibility failures. Properly adds .js extensions, resolves path aliases, and handles index.js imports where tsc consistently falls short, even in the latest versions.

Complete Solution for All TypeScript Issues

  • Fixes Extension Problems: Adds required .js extensions to imports
  • Handles Directory Imports: Properly resolves to index.js files
  • Transforms Path Aliases: Converts tsconfig aliases to valid relative paths
  • Fixes Declaration Files: Properly handles .d.ts files (unlike TypeScript itself)
  • Zero Configuration: Works out-of-the-box with any TypeScript setup
  • Universal Compatibility: Works with all TypeScript versions and config setups
  • High Performance: Offers both fast regex mode and accurate AST mode

Zero Hassle Setup

npm install --save-dev @2bad/tsfix

Then add postbuild script to your package.json:

{
  "scripts": {
    "build": "tsc",
    "postbuild": "tsfix"
  }
}

That's it. TSFIX finds your TypeScript output and fixes all import issues automatically.

Real World Examples

Converting Regular Imports

// Before TypeScript Compilation
import { helper } from './utils/helper.ts'

// After TypeScript Compilation (BROKEN)
import { helper } from './utils/helper.ts'

// After TSFIX (FIXED)
import { helper } from './utils/helper.js' // Works in ESM!

Fixing Path Alias Imports

// tsconfig.json
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["src/*"]
    }
  }
}

// Before TypeScript Compilation
import { Button } from '@/components/Button'

// After TypeScript Compilation (BROKEN)
import { Button } from '@/components/Button'

// After TSFIX (FIXED)
import { Button } from './src/components/Button.js' // Correctly resolved!

Resolving Directory Imports

// Before TypeScript Compilation
import { config } from './config'

// After TypeScript Compilation (BROKEN)
import { config } from './config'

// After TSFIX (FIXED)
import { config } from './config/index.js' // Properly resolved!

Advanced Usage

# Use AST-based extraction (more accurate but slower)
npx @2bad/tsfix --mode ast

# Custom file matching pattern
npx @2bad/tsfix --pattern "**/*.js"

Debugging

# Enable all debug logging
DEBUG=* tsfix

# Only enable specific components
DEBUG=tsfix:main,tsfix:extractor tsfix

# Show only fixer operations
DEBUG=tsfix:fixer tsfix

Why TSFIX exists

Major TypeScript Issues (Still Unresolved)

  • #16577: Provide a way to add the '.js' file extension to the end of module specifiers (2017)
  • #28288: Feature: disable extensionless imports (2018)
  • #40878: Compiled JavaScript import is missing file extension (2020)
  • #42151: TypeScript cannot emit valid ES modules due to file extension issue (2020)
  • #50501: TypeScript is not an ECMAScript superset post-ES2015 (2022)
  • #61037: rewriteRelativeImportExtensions doesn't rewrite extensions in emitted declaration files (2025)
  • #61213: Allow allowImportingTsExtensions: without either '--noEmit' or '--emitDeclarationOnly' (2025)

Previously Addressed (Partially)

  • #49083: "module": "node16" should support extension rewriting (Partially addressed via #59767)

Performance Options

TSFIX offers two extraction engines:

  • Regex mode (default): Fast pattern-based extraction (5x faster than AST mode)
  • AST mode: Precise syntax tree-based extraction for complex codebases

Contributing

Contributions welcome! Open issues for bugs/features or submit PRs with improvements.