{"id":10728,"library":"deep-utility-types","title":"Deep Utility Types","description":"Deep Utility Types is a TypeScript-focused library providing advanced utility types for performing operations like `Omit`, `Pick`, `Require`, and `Optional` on nested object structures. Unlike standard TypeScript utility types, this library supports dot-notation for accessing and modifying properties at any depth within an object, including handling arrays. It is fully type-safe, offers excellent autocompletion support in IDEs, and includes a mechanism for ignoring specific types (like large classes or built-ins) to improve type-checker performance and reduce noise in autocompletion suggestions. The current stable version is 1.3.1, with releases typically focusing on bug fixes and incremental features, such as exposing internal types for broader use. Its primary differentiator is its robust deep-nesting support and type-safety for complex object manipulations, which is not natively provided by TypeScript.","status":"active","version":"1.3.1","language":"javascript","source_language":"en","source_url":"https://github.com/tobloef/deep-utility-types","tags":["javascript","typescript","utility","types"],"install":[{"cmd":"npm install deep-utility-types","lang":"bash","label":"npm"},{"cmd":"yarn add deep-utility-types","lang":"bash","label":"yarn"},{"cmd":"pnpm add deep-utility-types","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This library ships only TypeScript types and is intended for ES module imports in modern TypeScript projects. CommonJS 'require' will not work as it's a type-only package.","wrong":"const { DeepOmit } = require('deep-utility-types');","symbol":"DeepOmit","correct":"import { DeepOmit } from 'deep-utility-types';"},{"note":"Used for picking nested properties via dot notation. Works identically to DeepOmit in terms of import pattern.","symbol":"DeepPick","correct":"import { DeepPick } from 'deep-utility-types';"},{"note":"This utility type was exposed publicly in v1.3.0. Users on older versions will not be able to import it directly.","symbol":"KeysAsDotNotation","correct":"import { KeysAsDotNotation } from 'deep-utility-types';"}],"quickstart":{"code":"import { DeepOmit } from 'deep-utility-types';\n\ntype UserProfile = {\n  id: string;\n  name: string;\n  contact: {\n    email: string;\n    phone: string;\n    address: {\n      street: string;\n      city: string;\n      zip: string;\n    };\n  };\n  settings: {\n    notifications: boolean;\n    theme: 'light' | 'dark';\n  };\n};\n\n// Create a type that omits the user's phone number and notification setting\ntype PublicUserProfile = DeepOmit<UserProfile, 'contact.phone' | 'settings.notifications'>;\n\nconst user: PublicUserProfile = {\n  id: 'user-123',\n  name: 'John Doe',\n  contact: {\n    email: 'john.doe@example.com',\n    address: {\n      street: '123 Main St',\n      city: 'Anytown',\n      zip: '12345',\n    },\n  },\n  settings: {\n    theme: 'dark',\n  },\n};\n\nconsole.log(user);","lang":"typescript","description":"Demonstrates how to use `DeepOmit` to create a new type by removing specified nested properties using dot notation."},"warnings":[{"fix":"Ensure you are using `import` statements and only leveraging these constructs at the TypeScript compilation level, not at runtime.","message":"This library provides only TypeScript type definitions; it has no runtime JavaScript code. Attempting to use `require()` or expecting runtime behavior will result in errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Update to `deep-utility-types@1.3.1` or newer to ensure correct handling of unions within `KeysAsDotNotation`.","message":"When working with `KeysAsDotNotation` and union types, versions prior to v1.3.1 might incorrectly handle the union, leading to unexpected or incomplete key paths.","severity":"breaking","affected_versions":"<1.3.1"},{"fix":"Upgrade to `deep-utility-types@1.3.0` or later to access `KeysAsDotNotation` and `DefaultIgnoredTypes`.","message":"The `KeysAsDotNotation` and `DefaultIgnoredTypes` were explicitly exposed as exportable types starting from version 1.3.0. If you are on an older version, these types will not be directly importable.","severity":"gotcha","affected_versions":"<1.3.0"},{"fix":"Pass the specific types to ignore as the third generic argument (e.g., `DeepOmit<MyType, 'key', SomeLargeClass>`) or leverage the exported `DefaultIgnoredTypes`.","message":"For types with very large or complex properties (like many built-in JavaScript classes such as `Function`, `Map`, `Promise`), not utilizing the `IgnoredTypes` generic parameter can lead to degraded type-checker performance and cluttered autocompletion suggestions.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Install the package: `npm install --save-dev deep-utility-types` or `yarn add --dev deep-utility-types`. Ensure your files are being processed by TypeScript and `tsconfig.json` includes the relevant directories.","cause":"The package is not installed, or TypeScript cannot locate its declarations, possibly due to incorrect `tsconfig.json` setup or trying to import in a non-TypeScript file.","error":"Cannot find module 'deep-utility-types' or its corresponding type declarations."},{"fix":"Carefully review the keys provided to `DeepOmit` or `DeepPick` to ensure they accurately reflect the desired output type. If properties should be optional, consider using `DeepOptional` or explicitly marking the resultant type as `Partial<T>` if the intention is to allow partial assignment.","cause":"Incorrectly applying the deep utility type, or trying to assign an incomplete object where properties were expected to be optional but remain required by the new type definition.","error":"Type 'Partial<OmittedType>' is not assignable to type 'OmittedType'. Property 'foo2' is missing in type 'Partial<OmittedType>' but required in type 'OmittedType'."}],"ecosystem":"npm"}