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

typelab

v1.0.1

Published

A lab of reusable utility types for everyday TypeScript code.

Readme

typelab

License NPM Latest NPM Downloads

Github CI CodeQL

📝 Table of Contents

🤔 About

This package offers a suite of versatile utility types that simplify common tasks, improve type safety, and boost productivity.

  • Easy to use
  • Zero third party dependencies
  • Type level only
  • No more copy paste "type definitions" between projects

🔌 Installation

# NPM
npm install --save-dev typelab

# BUN
bun add -d typelab

📔 Docs

Showcases

Here is an example for some types from each categories.

  • Primitive

    const value1: Primitive = ""; // valid
    const value2: Primitive = {}; // invalid
  • Nullable

    const example: Nullable<string> = null; // valid
    const example2: Nullable<string> = undefined; // invalid
  • Undefinable

    const example: Undefinable<string> = undefined; // valid
    const example2: Undefinable<string> = null; // invalid
  • IsExtends

    type Extends = IsExtends<'', string>; // true
    type NotExtends = IsExtends<string, ''>; // false
  • IsEqual

    type Equal = IsEqual<string, string>; // true
    type NotEqual = IsEqual<string, ''>; // false
  • IsAny

    type Valid = IsAny<any>; // true
    type Invalid = IsAny<string>; // false
  • IfExtends

    type Yes = IfExtends<'', string, 'yes', 'no'>; // 'yes'
    type No = IfExtends<string, '', 'yes', 'no'>; // 'no'
    type YesOrNo = IfExtends<string | number, string, 'yes', 'no'>; // 'yes' | 'no'
  • IfEqual

    type Yes = IfEqual<string, string, 'yes', 'no'>; // 'yes'
    type No = IfEqual<string, number, 'yes', 'no'>; // 'no'
  • IfAny

    type Yes = IfAny<any, 'yes', 'no'>; // 'yes'
    type No = IfAny<string, 'yes', 'no'>; // 'no'
  • FunctionCallbackify

    // (a: string, callback: (error: unknown, result: string) => void) => void
    type Callbackified = FunctionCallbackify<(a: string) => Promise<string>>;
  • FunctionPromisify

    // Callback-style function:
    // (a: string) => Promise<string>
    type Promisified = FunctionPromisify<(a: string, callback: (error: Error, result: string) => void) => void>;
    
    // Regular function:
    // (a: string) => Promise<string>
    type PromisifiedFn = FunctionPromisify<(a: string) => string>;
  • ObjectAssign

    // { a: string; b: string; c: boolean }
    type Assign1 = ObjectAssign<{ a: string; b: number }, { b: string; c: boolean }>;
    
    // { a: string; 0: string }
    type Assign2 = ObjectAssign<{ a: string }, [string]>;
    
    // { [x: number]: string, a: string }
    type Assign3 = ObjectAssign<{ a: string }, string[]>;
    
    // [number, number]
    type Assign4 = ObjectAssign<[string], [number, number]>;
    
    // (string | number)[]
    type Assign5 = ObjectAssign<string[], [number, number]>;
    
    // (string | number)[]
    type Assign6 = ObjectAssign<string[], number[]>;
    
    // [number, string]
    type Assign7 = ObjectAssign<[string], { 0: number; 1: string }>;
    
    // (string | number)[]
    type Assign8 = ObjectAssign<[number], 'str'>;
    
    // { [x: number]: string, a: string }
    type Assign9 = ObjectAssign<{a: string}, 'str'>;

All Available Types

A complete reference for all available reusable types.

⛏️ Built Using

  • Typescript Strongly typed programming language that builds on JavaScript.
  • Bun All-in-one JavaScript runtime & toolkit designed for speed, complete with a bundler, test runner, and Node.js-compatible package manager.

📄 License

The code in this project is released under the MIT License.