A comprehensive collection of high-performance TypeScript type utilities focused on type safety and developer experience.
npm install devtypes
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'
>;
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 >;
Import from specific modules:
// Good
import { Merge } from 'devtypes/types/utils';
// Avoid
import { Merge } from 'devtypes';
Copyright 2025 Paul Köhler (komed3).
Distributed under the MIT license.