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

@definitelytyped/dts-critic

v0.1.16

Published

Checks a new .d.ts against the Javascript source and tells you what problems it has

Downloads

203,078

Readme

dts-critic

Checks a new dts against the Javascript sources and tells you what problems it has.

Usage

Build the program:

$ npm run build

Run the program using node:

$ node dist/index.js --dts=path-to-d.ts [--js=path-to-source] [--mode=mode] [--debug]

If the d.ts path is to a file named index.d.ts, the name of the directory will be used as the package name instead. For example ~/dt/types/jquery/index.d.ts will use jquery as the name.

path-to-source is optional; if you leave it off, the code will check npm for a package with the same name as the d.ts.

Mode

You can run dts-critic in different modes that affect which checks will be performed:

  1. name-only: dts-critic will check your package name and DefinitelyTyped header (if present) against npm packages. For example, if your declaration is for an npm package called 'cool-js-package', it will check if a package named 'cool-js-package' actually exists in npm.

  2. code: in addition to the checks performed in name-only mode, dts-critic will check if your declaration exports match the source JavaScript module exports. For example, if your declaration has a default export, it will check if the JavaScript module also has a default export.

Current checks

Npm declaration

If your declaration is for an npm package:

  1. An npm package with the same name of your declaration's package must exist.
  2. If your package has a Definitely Typed-conforming package.json, the npm package's version must match your version.
  3. If you are running under code mode, your declaration must also match the source JavaScript module.

Non-npm declaration

If your declaration is for a non-npm package (in other words, if your declaration has a Definitely Typed-conforming package.json with "nonNpm": true):

  1. An npm package with the same name of your declaration's package cannot exist.
  2. If you are running under code mode and a path to the JavaScript source file was provided, your declaration must also match the source JavaScript module.

Planned work

  1. Make sure your module structure fits the source.
  2. Make sure your exported symbols match the source.
  3. Make sure your types match the source types???
  4. Download source based on npm homepage (if it is github).

Note that for real use on Definitely Typed, a lot of these checks need to be pretty loose.

Contributing

Testing

The tests use the Jest framework. To build and execute the tests, run:

$ npm run test

This will build the program and run jest.