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 🙏

© 2024 – Pkg Stats / Ryan Hefner

tc-passing

v1.0.0

Published

Only type check previously passing files

Downloads

8

Readme

A command that uses TypeScript to only type check previously passing files

Why?

When integrating TypeScript into a large codebase, using tsc --noEmit type-checks all files and can result in an overwhelming flood of errors. This can make it difficult to spot new errors in files that were previously error-free.

tc-passing records the list of files that pass type check so you can be sure your type safe files remain type safe!

🚀 Install

npm i tc-passing

Note: typescript (or vue-tsc) is assumed to be installed already

Usage

1. Setup (Optional)

You can use tc-passing directly with npx, but for your convenience, it's recommend to add the following commands to your package.json:

{
    "scripts": {
        // ...

        "type-check": "tc-passing",
        "type-check:update": "tc-passing --update"
    },

    "lint-staged": {
        "**/*.{js,ts}": "tc-passing"
    }
}

You can also add it to a commit hook or lint-staged, but note tc-passing does not accept any arguments (e.g. for staged files).

2. Recording passing files

Start by running tc-passing --update to record the list of files that pass type check. This creates a .tc-passing file in your current working directory serving as a baseline for when you type check.

Here's an example of what this file looks like:

# Files passing type check (33.33%) (Generated by tc-passing)
path/to/file-a.ts
path/to/file-b.js

The first line shows a percentage of how much of the codebase is passing.

Make sure to check this file into version control: git add .tc-passing

3. Type check

Simply run tc-passing and it will only type check files in .tc-passing.

Make sure you run tc-passing --update periodically or whenever you fix types in a file.

Type checker

By default, tc-passing will expect you to have typescript installed for tsc. If you have vue-tsc installed, it will use that instead.

FAQ

How does tc-passing compare to tsc-baseline?

Both tools aim to streamline TypeScript integration, but they approach baselining differently:

tsc-baseline

  • Focus

    Only show new type errors since last baseline update.

  • Baseline file

    JSON file of errors, which can grow large and may lead to merge conflicts in team settings.

  • Workflow impact

    Requires frequent updates to maintain an accurate baseline, often necessitating updates with every TypeScript-related commit. Otherwise CI can fail. Running tsc on every commit can slow down development.

tc-passing

  • Focus

    Type checking ensures files that were previously passing type checks to remain error-free.

  • Baseline file

    List of passing files, which is typically smaller and easier to manage, reducing merge conflicts.

  • Workflow impact

    Needs updates less frequently, only necessary when files change from failing to passing, thus streamlining the development process by minimizing the frequency of checks.

Sponsors