@pdnsyamkumar/ts-utils
v1.0.1
Published
Shared TypeScript utility types and helpers.
Readme
@pdnsyamkumar/ts-utils
A collection of pure, framework-agnostic TypeScript utility types.
DeepPartial
Recursively makes all properties of an object optional. Unlike the default Partial<T>, it correctly handles nested objects while safely preserving built-in types (like Date, Map, Set, RegExp) and Arrays.
Example
import { DeepPartial } from "@pdnsyamkumar/ts-utils";
interface User {
preferences: { theme: string };
tags: string[];
}
const user: DeepPartial<User> = {
preferences: { theme: "dark" },
tags: ["admin"] // Array types and methods are safely preserved!
};