Registry / type-stubs / advanced-utility-types

advanced-utility-types

JSON →
library1.1.0jsnpmunverified

A TypeScript library providing advanced utility generic types such as DeepOptional, DeepOmit, and DeepPaths. Version 1.1.0 allows recursive manipulation of deeply nested object properties using dot-separated paths or template literal strings, with support for arrays. It is released under the MIT license and is intended for type-level programming in TypeScript projects. Unlike simpler utility types libraries (e.g., type-fest), this package focuses specifically on deep path-based transformations.

npm install advanced-utility-types
INSTALL
IMPORT
SIG · ADVANCED-UTILITY-T
A
advanced-utility-types
type-stubsjavascriptv1.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DeepOptional
import { DeepOptional } from 'advanced-utility-types'
const { DeepOptional } = require('advanced-utility-types')
This is a type-only import; the library is intended for TypeScript and does not emit runtime code. Use import type if you prefer.
DeepOmit
import { DeepOmit } from 'advanced-utility-types'
import DeepOmit from 'advanced-utility-types'
DeepOmit is a named export, not a default export.
DeepPaths
import { DeepPaths } from 'advanced-utility-types'
import { DeepPaths } from 'advanced-utility-types/types'
All types are exported from the main entry point; no subpath imports are needed.

Demonstrates usage of DeepOptional, DeepOmit, and DeepPaths to manipulate deeply nested object types.

import { DeepOptional, DeepOmit, DeepPaths } from 'advanced-utility-types'; type Obj = { a: string; b: { c: number; d: { e: boolean; } }; f: Array<{ g: string; h: number }>; }; // DeepOptional: make a deeply nested property optional type OptionalResult = DeepOptional<Obj, 'b.d.e'>; // Expected: { a: string; b: { c: number; d: { e?: boolean } }; f: Array<{ g: string; h: number }> } // DeepOmit: remove a deeply nested property type OmitResult = DeepOmit<Obj, 'b.d.e'>; // Expected: { a: string; b: { c: number; d: {} }; f: Array<{ g: string; h: number }> } // DeepPaths: get all dot-separated paths type Paths = DeepPaths<Obj>; // Expected: 'a' | 'b' | 'b.c' | 'b.d' | 'b.d.e' | 'f' | `f.${number}` | `f.${number}.g` | `f.${number}.h` // Array support with template literals type ArrObj = { a: { b: Array<{ c: string }> } }; type Result = DeepOptional<ArrObj, `a.b.${number}.c`>; // Expected: { a: { b: Array<{ c?: string }> } }
Debug
Known issues
breakingTypeScript version requirement: The library uses template literal types, requiring TypeScript 4.1 or later.
fix
Upgrade TypeScript to at least version 4.1.
affects: >=0.0.0
breakingDeepPaths may generate very large union types for deeply nested objects, leading to performance issues or TypeScript compilation errors.
fix
Limit the depth of nested types or use alternative types with manual path specification.
affects: >=0.0.0
gotchaDeepOptional does not deeply preserve required properties for array items; only the specified path is made optional.
fix
When using array paths like `a.b.${number}.c`, only the leaf property (c) becomes optional, not the array indices.
affects: >=0.0.0
gotchaDeepOmit will remove the property entirely; if the object becomes empty (e.g., all properties omitted), the type reduces to {}.
fix
Ensure that after omission, the resulting type still matches your expected shape; consider using DeepOptional instead.
affects: >=0.0.0
Errors
Common errors & fixes
Type instantiation is excessively deep and possibly infinite.
DeepPaths or related recursive types applied to a deeply nested object type.
fix
Reduce nesting depth or use explicit path strings instead of DeepPaths.
Cannot find name 'DeepOptional'. Did you mean 'Optional'?
Incorrect import path or library not installed.
fix
Install the package: npm install advanced-utility-types, then import as named export.
Type 'string' is not assignable to type '${number}'.
Using a plain string literal instead of a template literal type for array indices.
fix
Use a template literal: `a.b.${number}.c` instead of `a.b.number.c`.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies
typescriptrequiredThe library provides TypeScript type definitions; it requires TypeScript 4.1+ for template literal support.
Agent activity
52 hits · last 30 days
node
44
Perplexity
1
OpenAI (training)
1
Resources
advanced-utility-types — npm install advanced-utility-types · libregistry