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

@billdaddy/typemit

v0.1.1

Published

Tiny, fully type-safe event emitter with a wildcard listener and a promise-based waitFor. Zero dependencies.

Downloads

211

Readme

typemit

All Contributors

Tiny, fully type-safe event emitter — with a wildcard listener and a promise-based waitFor. Zero dependencies.

CI npm version bundle size types license

Most event emitters take (string, ...any[]) and hope for the best. typemit takes an event map, so the event name is checked, the payload type is inferred, and a typo or wrong payload is a compile error — not a 2 a.m. bug.

import { createEmitter } from "@billdaddy/typemit";

const bus = createEmitter<{
  login: { id: string };
  message: string;
  ready: void;
}>();

bus.on("login", (user) => console.log(user.id)); // user: { id: string }
bus.emit("login", { id: "42" });
bus.emit("ready");                                // void event — no payload
bus.emit("login", "oops");                        // ❌ compile error

Why typemit?

  • Type-safe end to end. on/once/emit/waitFor are all checked against your event map; void events take no payload.
  • waitFor as a promise. Await the next event — with an optional filter and an AbortSignal to bail out. Great for tests and request/response flows.
  • Wildcard listener. onAny((event, payload) => …) for logging/debugging.
  • Tidy lifecycle. on/once/onAny return an unsubscribe; clear() and listenerCount() for housekeeping. Handlers may unsubscribe themselves mid-emit.
  • Zero dependencies, ESM + CJS + types, ~1 kB.

Install

npm install @billdaddy/typemit
# or: pnpm add @billdaddy/typemit  /  yarn add @billdaddy/typemit  /  bun add @billdaddy/typemit

API

const bus = createEmitter<Events>();

Subscribe / emit

const off = bus.on("message", (text) => …);  // returns unsubscribe
bus.once("ready", () => …);                    // fires once
bus.off("message", handler);
bus.emit("message", "hello");
off();

waitFor(event, { signal?, filter? }) → Promise<payload>

const user = await bus.waitFor("login");
const big = await bus.waitFor("message", { filter: (m) => m.length > 100 });

const ac = new AbortController();
const next = bus.waitFor("login", { signal: ac.signal }); // rejects if aborted

Wildcard & housekeeping

const offAny = bus.onAny((event, payload) => log(event, payload));
bus.listenerCount("message"); // listeners for one event
bus.listenerCount();          // all listeners, incl. wildcard
bus.clear("message");         // remove one event's listeners
bus.clear();                  // remove everything

Pairs well with

  • timefence — race waitFor against a deadline.

Contributors ✨

This project follows the all-contributors specification. Contributions of any kind are welcome — code, docs, bug reports, ideas, reviews! See the emoji key for how each contribution is recognized, and open a PR or issue to get involved.

Thanks goes to these wonderful people:

License

MIT © Tung Tran