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 🙏

© 2025 – Pkg Stats / Ryan Hefner

typespy

v1.0.8

Published

Do you love typescript but hate those `any`s and `unknown`s ?

Downloads

13

Readme

typespy 🕵🏻‍♂️

Do you love typescript but hate those anys and unknowns ?

too lazy to add console logs all over the place to see runtime values?

typespy is a webserver and a babel plugin to make tracking runtime values as easy as adding a single comment.

main screen

Installation

  • npm install typespy

  • add a new command in your package.json file to run the server "typespy": "typespy"

  • add this plugin to your babel config './node_modules/typespy/dist/babel/plugin.js'. Make sure to include it only in dev mode!

  • Add this code as early to your app

    import { typespyFactory, DEFAULT_FN_NAME } from 'typespy';
    
    // or however you check for dev mode!
    if (__DEV__) {
      window[DEFAULT_FN_NAME] = typespyFactory();
    }
  • thats it! commit those changes to be ready anytime 🎉

Usage

  • run the typespy sever npm run typespy
  • if you want to know the value of any expression like someVariable or this.props
    • add a spy comment like this one where you want to check the value: // spy someVariable
    • run your app and try to trigger hit the commented line
    • all the values and suggested type will be shown in the typespy server
  • everytime a spy comment gets executed you will be notified with a notification and the server UI will update

Changing defaults

import { typespyFactory, DEFAULT_FN_NAME } from 'typespy';

// or however you check for dev mode!
if (__DEV__) {
  // default is localhost, use this ip to access localhost from the android emulator for example
  const host = '10.0.2.2';
  // default is 4444
  const port = 1234;

  window[DEFAULT_FN_NAME] = typespyFactory(host, port);
}

Then you have to define your typespy npm task like this "typespy": "TYPESPY_PORT_NUM=1234 typespy"

You must also pass the same options to the babel plugin like this:

  • global: defaults to window, change it if you want to attach the global function somewhere else.
  • magicWord: defaults to spy, change it if you prefer another comment keyword.
  • fnName: defaults to the value of DEFAULT*FN_NAME which is \_typespy*.
{
  "plugins": [
    [
      "./node_modules/typespy/dist/babel/plugin.js",
      { "global": "globalThis", "magicWord": "wth_is", "fnName": "CIA_SPY" }
    ]
  ]
}

then you will need this changes as well

globalThis['CIA_SPY'] = typespyFactory(host, port);

and then your spy comments should look like this

// wth_is props