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

@ludeschersoftware/types

v1.3.0

Published

Generic collection of TypeScript type definitions and helpers.

Downloads

29

Readme

A generic collection of TypeScript type definitions and zero-runtime helpers. Start with 2D geometry primitives—Vector2, Size, Box—and extend with any domain-specific types your projects need. Includes utility types to make your type modeling more expressive and flexible.


📦 Installation

Add the package as a development dependency:

npm install --save-dev @ludeschersoftware/types

Or with Yarn:

yarn add --dev @ludeschersoftware/types

🔧 Usage

Keep your types modular and explicit. Import only what you need:

import { Vector2, Size, Box, Loose, Optional, RequiredProps, ExcludeProps } from '@ludeschersoftware/types'

const origin: Vector2 = { x: 0, y: 0 }
const canvasSize: Size = { width: 800, height: 600 }

const viewport: Box = { ...origin, ...canvasSize }

type PartialCanvas = Loose<Size> // width and height can be null or undefined
type StrictCanvas = RequiredProps<Size> // width and height must be defined

// Exclude certain props
type PublicCanvas = ExcludeProps<Size, "height"> // only width remains

📐 Core Types

Geometry Primitives

  • Vector2 A 2D vector with x and y coordinates.

    interface Vector2 {
      x: number;
      y: number;
    }
  • Size A 2D size descriptor with width and height.

    interface Size {
      width: number;
      height: number;
    }
  • Box Combines both Vector2 and Size into an axis-aligned rectangle.

    interface Box extends Vector2, Size {}

🛠️ Utility Types

These helpers make it easier to adapt strict types to flexible scenarios like forms, API responses, or optional configuration.

  • Loose<T> Makes all properties of T optional and allows null or undefined.

    type Loose<T> = { [K in keyof T]?: T[K] | null | undefined }
  • Optional<T> Makes all properties of T optional.

    type Optional<T> = { [K in keyof T]?: T[K] }
  • Nullable<T> Makes all properties of T explicitly nullable, but required.

    type Nullable<T> = { [K in keyof T]: T[K] | null }
  • Undefinable<T> Makes all properties of T potentially undefined, but required.

    type Undefinable<T> = { [K in keyof T]: T[K] | undefined }
  • RequiredProps<T> Forces all properties of T to be required.

    type RequiredProps<T> = { [K in keyof T]-?: T[K] }
  • NonNullableProps<T> Forces all properties of T to be required and strips null and undefined.

    type NonNullableProps<T> = { [K in keyof T]-?: NonNullable<T[K]> }
  • ExcludeProps<T, K> Excludes one or more keys from a type. K can be a single key or an array of keys.

    type ExcludeProps<T, K extends keyof T | (keyof T)[]> =
      Omit<T, K extends (keyof T)[] ? K[number] : K>

🔍 Utility Type Comparison

Here’s how the utility types transform a sample User type:

type User = {
  id?: number | null;
  name?: string;
  email?: string | undefined;
  password?: string;
};

| Utility Type | Resulting Shape | | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | | Loose<User> | { id?: number \| null \| undefined; name?: string \| null \| undefined; email?: string \| null \| undefined; password?: string \| null \| undefined } | | Optional<User> | { id?: number \| null; name?: string; email?: string \| undefined; password?: string } | | Nullable<User> | { id: number \| null; name: string \| null; email: string \| null; password: string \| null } | | Undefinable<User> | { id: number \| null \| undefined; name: string \| undefined; email: string \| undefined; password: string \| undefined } | | RequiredProps<User> | { id: number \| null; name: string; email: string \| undefined; password: string } | | NonNullableProps<User> | { id: number; name: string; email: string; password: string } | | ExcludeProps<User, "password"> | { id?: number \| null; name?: string; email?: string \| undefined } | | ExcludeProps<User, ["password","email"]> | { id?: number \| null; name?: string } |

This table shows exactly how each helper changes the “strictness” or shape of your types.


🧼 License

MIT © Johannes Ludescher


💬 Feedback

Got ideas or improvements? Feel free to open an issue or submit a PR. Contributions are welcome!