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

type-party

v0.7.3

Published

Extends `type-fest` with extra goodies.

Readme

type-party

Extends type-fest with extra goodies.

Mostly contains pure TS types, but also includes some type predicates and runtime utilities -- although those are all exported under separate entrypoints, so won't be loaded by default.

Install

npm install type-party

Use as:

// To get a pure type
import type { XXXX } from "type-party";

// To get one of the runtime exports.
// See package.json for the available /runtime/xyz.js export paths.
import { XXX } from "type-party/runtime/json.js"

Types

Array & Tuple Types

  • Filter<T, U> — Filters an array or tuple type, keeping only elements that extend type U. Preserves tuple structure and readonly properties.

  • PreserveReadonly<T, V> — Utility that preserves the readonly nature of an array type when transforming it to another array type. This simplifies building utility types that transform array types.

Assignability & Type Safety

  • Satisfies<T, U> — Type-level equivalent of the satisfies operator. Returns type T while ensuring it's assignable to U. This can be very useful for keeping types in sync or setting up various type-level "alarms" for when some expected invariant gets broken.

  • SatisfiedBy<T, U> — Returns the first type parameter while enforcing that it's a supertype of the second parameter.

Date Types

  • DateString — Tagged string type for date strings, useful for distinguishing dates from arbitrary strings in JSON contexts. Import from type-party/runtime/dates.js to get the relevant functions for creating/parsing these.

Design by Contract

  • PublicInterface<T> — Extracts only the public methods and fields from a class type. Useful for dependency injection where mocks need to satisfy the interface without private implementation details.

  • PublicMethodNames<T> — Extracts the public method names from a type, returning a union of string literal types.

Discriminated Union Helpers

  • CollapseCases<T> — Takes a union of object types and returns a single object type where each key's type is the union of types for that key across all cases. This is useful in cases where TS can't correctly figure out the assignability of complex union types. See the definition for examples.

  • CollapseCasesDeep<T> — Like CollapseCases, but works recursively on nested object types within discriminated unions.

Function Types

JSON Types

  • JSON — Represents valid JSON values: objects, arrays, strings, numbers, booleans, and null. Very similar to type-fest's JsonValue, except that it doesn't allow keys with undefined values.

  • JSONWithUndefined — Like JSON, but allows types with optional keys and undefined values that get omitted during JSON serialization.

  • JsonOf<T> — Tagged string type representing a JSON serialization of type T. See explainer and usage examples. jsonParse, jsonStringify, and jsonStringifyUnstable are exported from type-party/runtime/nonempty.js to support working with this type.

Math & Numeric Types

  • NumericRange<Min, Max> — Creates a union type of numbers from Min to Max (inclusive).

  • Permutations<T> — Generates all possible permutations of a tuple type using tuple length arithmetic.

Non-empty Types

  • NonEmptyString — Tagged string type that represents a non-empty string.

  • NonEmptyArray<T> — Array type that guarantees at least one element: [T, ...T[]].

isNonEmptyString, isNonEmptyArray, and mapNonEmpty are exported from type-party/runtime/nonempty.js to simplify working with these types.

Nullish Handling

  • RemoveUndefinedDeep<T> — Recursively removes undefined from a type, useful for converting JSONWithUndefined to JSON.

Object Key Manipulation

  • AllKeys<T> — Returns all keys from a union of object types, unlike keyof which only returns keys present in every union member.

  • StringKeys<T> — Filters object keys to only string keys.

  • NullableKeys<T> — Returns keys from an object type where the value can be null.

  • NarrowKeys<T, K, V> — Narrows specific keys in an object type to a more specific value type when there's type compatibility.

Type Simplification

  • Simplify<T> — Flattens intersection types into a single object type for better IDE display. Similar to type-fest's simplify, but uses DrainOuterGeneric to avoid "type instantiation excessively deep" errors.

  • DrainOuterGeneric<T> — Prevents type computations from contributing to TypeScript's instantiation depth counter, helping avoid "excessively deep" errors.

  • DepthCapped<T, DepthLimit?, AtDepthLimitType?> — Limits the nesting depth of recursive types to prevent TypeScript compiler performance issues. When depth limit is reached, deeper structures are replaced with the specified type (defaults to any). This is sometimes needed when working with infinitely recursive types.

Type Mapping