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

@m0n0lab/ts-types

v1.0.6

Published

[![npm version](https://img.shields.io/npm/v/@m0n0lab/ts-types.svg)](https://www.npmjs.com/package/@m0n0lab/ts-types) [![ts-types coverage](https://codecov.io/gh/pabloimrik17/monolab/badge.svg?flag=ts-types)](https://codecov.io/gh/pabloimrik17/monolab?fla

Readme

@m0n0lab/ts-types

npm version ts-types coverage ts-types bundle

A centralized package for sharing custom TypeScript type definitions, utilities, and type guards across all Monolab projects.

Features

  • 🎯 Centralized type definitions
  • ✅ Fully typed with TypeScript
  • 📦 Zero runtime dependencies
  • ⚡ Lightweight and tree-shakeable
  • 🔒 Type-safe and reliable
  • 📚 Comprehensive documentation
  • 🚀 Production ready library
  • 📘 Well documented

Installation

npm

npm install @m0n0lab/ts-types

pnpm

pnpm add @m0n0lab/ts-types

JSR

npx jsr add @m0n0lab/ts-types

Usage

Nullable Types

Handle nullable values with type-safe utilities:

import type { Nullable, NonNullable } from "@m0n0lab/ts-types";
import { isNullable, isNonNullable } from "@m0n0lab/ts-types";

// Type definitions
type NullableString = Nullable<string>; // string | null
type RequiredString = NonNullable<string | null>; // string

// Type guards
const value: string | null = getValue();
if (isNonNullable(value)) {
    console.log(value.toUpperCase()); // TypeScript knows value is string
}

// Filter arrays
const items: (string | null)[] = ["hello", null, "world"];
const validItems = items.filter(isNonNullable); // string[]

Undefinable Types

Work with optional values safely:

import type { Undefinable, NonUndefinable } from "@m0n0lab/ts-types";
import { isUndefinable, isNonUndefinable } from "@m0n0lab/ts-types";

// Type definitions
type OptionalString = Undefinable<string>; // string | undefined
type RequiredString = NonUndefinable<string | undefined>; // string

// Type guards
const value: string | undefined = findValue();
if (isNonUndefinable(value)) {
    console.log(value.length); // TypeScript knows value is defined
}

Nullish Types

Handle both null and undefined:

import type { Nullish, NonNullish } from "@m0n0lab/ts-types";
import { isNullish, isNonNullish } from "@m0n0lab/ts-types";

// Type definitions
type MaybeString = Nullish<string>; // string | null | undefined
type DefiniteString = NonNullish<string | null | undefined>; // string

// Type guards
const value: string | null | undefined = getOptionalValue();
if (isNonNullish(value)) {
    console.log(value.trim()); // TypeScript knows value is string
}

// Filter arrays
const items: (string | null | undefined)[] = [
    "hello",
    null,
    undefined,
    "world",
];
const validItems = items.filter(isNonNullish); // string[]

StrictOmit

Omit object properties with compile-time safety:

import type { StrictOmit } from "@m0n0lab/ts-types";

interface User {
    id: string;
    name: string;
    email: string;
}

// Valid: 'email' exists in User
type PublicUser = StrictOmit<User, "email">; // { id: string; name: string }

// Error: 'age' doesn't exist in User
// type Invalid = StrictOmit<User, 'age'>; // TypeScript error!

// Unlike built-in Omit which allows non-existent keys:
type Unsafe = Omit<User, "age">; // No error, less safe

StringKeyOf

Extract only string keys from object types, filtering out numeric and symbol keys:

import type { StringKeyOf } from "@m0n0lab/ts-types";

interface MixedKeys {
    name: string; // string key
    age: number; // string key
    42: string; // numeric key
    [Symbol.iterator]: () => void; // symbol key
}

// Only extracts string keys
type OnlyStringKeys = StringKeyOf<MixedKeys>; // "name" | "age"

// Useful for type-safe object key operations
interface Config {
    host: string;
    port: number;
    debug: boolean;
}

type ConfigKey = StringKeyOf<Config>; // "host" | "port" | "debug"

// Works with Record types
type StringRecord = Record<string, number>;
type RecordKeys = StringKeyOf<StringRecord>; // string

// Returns never for objects with no string keys
interface OnlyNumeric {
    0: string;
    1: number;
}
type NoKeys = StringKeyOf<OnlyNumeric>; // never

Contributing

Contributions are welcome! Please read our contributing guidelines before submitting a pull request.

License

MIT