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

asserticide

v0.4.0

Published

Kill every redundant type assertion in your TypeScript codebase

Downloads

340

Readme

asserticide

Kill every redundant type assertion and non-null assertion in your TypeScript codebase

How

For each assertion.

  1. Delete it.
  2. Typecheck via tsgo.
  3. Keep the deletion if it typechecks; revert otherwise.

What survives is the set of assertions actually doing work — plus the small set preserved by rule.

Preserved by rule

A few cases where an assertion is kept even though tsgo would accept the deletion:

  • as const — never touched.
  • as never — never touched; almost always an intentional type hack.
  • x as T when removing it would let any from x silently propagate (and Tany).
  • x as any as T — neither half is removed in a way that would change the value's effective type.
  • An assertion whose removal would change a function's inferred return type (explicit annotations are exempt).
  • { ... } as T initializing an unannotated variable — the assertion drives the object literal's contextual typing.
  • x! when strictNullChecks is off — usually scaffolding for an in-progress migration to strict null checks.

Use

npx asserticide                          # uses ./tsconfig.json
npx asserticide path/to/tsconfig.json
npx asserticide path/to/dir              # uses path/to/dir/tsconfig.json

Requires Node ≥ 24. asserticide refuses to run if the project doesn't typecheck cleanly under tsgo. Commit your working tree first so you can review the diff afterwards.

Sample output:

---
total assertions found:    412
removed assertions:        287
reverted by typecheck:     118
preserved by rule:         7
files changed:             54
- src/api/client.ts
- src/components/Grid.tsx
- ...

How it compares to no-unnecessary-type-assertion

The difference is scale.

The @typescript-eslint/no-unnecessary-type-assertion lint rule works at the expression level: it reports an assertion when removing it preserves the expression type or still satisfies the contextual type at that position.

asserticide works at project level: it tries deleting each type assertion, runs tsgo, and keeps the edit if the checked project still typechecks and no preservation rule applies.

So asserticide can remove assertions with real local type effects when those effects are unused projectwide.