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

check-node-types

v1.0.0

Published

Verify @types/node major version matches your engines.node minimum

Downloads

289

Readme

check-node-types 🔬

Keep @types/node in sync with your actual Node.js target.

npm version zero dependencies TypeScript node >= 20 license


The Problem

@types/node major versions map directly to Node.js releases: @types/node@22 provides types for Node.js 22.
If your project targets Node 20 but @types/node is ^22, TypeScript will happily let you use Node 22 APIs that don't exist at runtime.

No existing linter, ESLint plugin, or package manager catches this drift. We searched. Extensively.

Why Not Just…?

We evaluated every existing tool. None solve this.

| Tool | What it does | Why it's not enough | | ----------------------------------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | | Dependabot | Bumps @types/node to latest | Cannot update engines.node. Will bump @types/node past your target. | | Renovate | Can group engines.node + @types/node PRs | Groups updates but doesn't verify the majors match. Drift still possible from manual edits. | | syncpack | Enforces consistent versions across monorepos | Cannot cross-reference engines with devDependencies. | | npm-package-json-lint | Validates package.json fields | Has valid-values-engines but no cross-field comparison with dependency versions. | | eslint-plugin-package-json | Lints package.json | Has require-engines but nothing for dependency-to-engine consistency. | | ls-engines | Checks dependency tree engine compatibility | Checks engine requirements, not @types/node alignment. | | check-engine / check-node-version | Validates the running Node.js version | Checks the runtime, not the type definitions. | | @tsconfig/node bases | Sets target/module for a Node version | Doesn't set or validate @types/node. Using @tsconfig/node20 with @types/node@24 produces no error. | | Shell one-liners | Custom CI scripts | Work, but no standard solution — every team reinvents the wheel. |

The gap is well-documented: DefinitelyTyped Discussion #69418 is the canonical thread where maintainers and users discuss the lack of tooling for this.

The Recommended Workflow

check-node-types is designed as a companion to check-node-version. Together they cover both sides of the Node.js version problem:

| Tool | What it checks | | -------------------- | ------------------------------------------- | | check-node-version | Is the running Node.js version correct? | | check-node-types | Is the @types/node version correct? |

The recommended approach:

  1. Exclude @types/node from automated dependency updates — tools like npm-check-updates or npm-check will always flag a new @types/node major as available, even when upgrading would be wrong for your project.
  2. Use check-node-types in CI or as a lint step to verify that your @types/node stays in sync with your actual Node.js target.
  3. When you intentionally upgrade Node.js, bump @types/node in the same commit.

This way you avoid the constant noise from update checkers, while still catching accidental drift.


Install

npm install -D check-node-types

Or run directly:

npx check-node-types

Usage

# Check using engines.node (default)
check-node-types

# Read Node.js version from different sources
check-node-types --source engines      # reads engines.node from package.json (default)
check-node-types --source volta        # reads volta.node from package.json
check-node-types --source nvmrc        # reads .nvmrc file
check-node-types --source node-version # reads .node-version file

# Point to a specific package.json
check-node-types --package ./packages/my-lib/package.json

# Print detected versions and exit
check-node-types --print

# Quiet mode — only output on error
check-node-types -q

# JSON output (for CI parsing)
check-node-types --json

As an npm script

{
	"scripts": {
		"check-types": "check-node-types"
	}
}

In CI (GitHub Actions)

- name: Verify @types/node matches target Node.js version
  run: npx check-node-types

In a Dockerfile

# Validate before installing dependencies
COPY package.json ./
RUN npx -y check-node-types
RUN npm ci

With lint-staged / Husky

{
	"lint-staged": {
		"package.json": ["check-node-types"]
	}
}

Options

| Flag | Short | Description | Default | | ------------------- | ----- | --------------------------------------------- | ---------------- | | --source <source> | | Where to read the Node.js version (see below) | engines | | --package <path> | | Path to package.json | ./package.json | | --print | | Print detected versions and exit | | | --quiet | -q | Only output on error | | | --json | | Output as JSON | | | --no-color | | Disable colored output | auto-detect |

Version Sources

| Source | Reads from | | -------------- | ------------------------------------------------------ | | engines | engines.node in package.json | | volta | volta.node in package.json | | nvmrc | .nvmrc file in same directory as package.json | | node-version | .node-version file in same directory as package.json |

Exit Codes

| Code | Meaning | | ---- | -------------------------------------------------------------------------------- | | 0 | Pass — versions match | | 1 | Fail — major version mismatch | | 2 | Warning — missing version source, missing @types/node, or unparseable versions |

Example Output

Pass:

check-node-types: PASS

Fail:

check-node-types: FAIL
  engines.node major:  20
  @types/node major:   22

  Fix: npm install -D @types/node@^20

Print:

engines.node: >=20 (major: 20)
@types/node: ^20.11.0 (major: 20)

How It Works

  1. Reads the target Node.js version from the configured source (default: engines.node)
  2. Reads the @types/node version from devDependencies or dependencies
  3. Compares the major versions
  4. Reports the result with an actionable fix command on mismatch

License

MIT