Skip to content

A comprehensive collection of highly-optimized TypeScript type utilities for building type-safe applications

License

Notifications You must be signed in to change notification settings

komed3/devtypes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypeScript Advanced Type Utilities

A comprehensive collection of high-performance TypeScript type utilities focused on type safety and developer experience.

Features

  • Zero Runtime Overhead - Pure type definitions
  • Type Safety - Advanced constraint utilities
  • Modular Design - Import only what you need
  • Rich Toolset - From basic to advanced type operations
  • IntelliSense Optimized - Great IDE support

Installation

npm install devtypes

Quick Examples

Object Type Manipulation

import { Merge, RequireExactlyOne } from 'devtypes';

type UserBase = { id: number; name: string; email?: string };
type UserAuth = { email: string; password: string };

// Merge types (smart conflict resolution)
type User = Merge< UserBase, UserAuth >;
// { id: number; name: string; email: string; password: string }

// Require exactly one field
type LoginCredentials = RequireExactlyOne<
    { email?: string; phone?: string; username?: string; },
    'email' | 'phone' | 'username'
>;

Deep Utilities

import { DeepPartial, DeepRequired } from 'devtypes';

interface Config {
    server: {
        port: number;
        host: string;
        ssl?: {
            cert: string;
            key: string;
        };
    };
    database: {
        url: string;
        timeout?: number;
    };
}

// Make everything optional
type PartialConfig = DeepPartial< Config >;

// Make everything required
type FullConfig = DeepRequired< Config >;

Documentation

Core Modules

  • base - Core type utilities
  • collections - Array and object operations
  • combinators - Union and tuple operations
  • constraints - Property requirement utilities
  • functionals - Function type utilities
  • primitives - Primitive type helpers
  • utils - General type transformations

Performance Tips

Import from specific modules:

// Good
import { Merge } from 'devtypes/types/utils';

// Avoid
import { Merge } from 'devtypes';

License

Copyright 2025 Paul Köhler (komed3).
Distributed under the MIT license.

About

A comprehensive collection of highly-optimized TypeScript type utilities for building type-safe applications

Topics

Resources

License

Stars

Watchers

Forks