{"id":12172,"library":"ts-essentials","title":"TypeScript Essentials","description":"ts-essentials is a comprehensive collection of advanced TypeScript utility types designed to enhance type safety and improve developer experience beyond the standard library. As of version 10.1.1, it provides a wide array of types like `Prettify`, `DeepReadonly`, `StrictOmit`, and robust path-based utilities for complex object transformations, such as `Paths` and `PathValue`. The library is actively maintained with frequent patch and minor releases, typically occurring every few weeks, addressing bug fixes and introducing new utility types. Key differentiators include stricter versions of built-in utility types (e.g., `StrictExclude`), deep transformation types like `DeepRequired` and `DeepMarkOptional`, and sophisticated path-based type manipulation. It requires `typescript>=4.5.0` as a peer dependency and mandates the `strictNullChecks` compiler option in `tsconfig.json` for optimal functionality and type correctness, ensuring a higher level of type strictness.","status":"active","version":"10.1.1","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/ts-essentials/ts-essentials","tags":["javascript","typescript","types","essentials","utils","toolbox","toolbelt","lodash","underscore"],"install":[{"cmd":"npm install ts-essentials","lang":"bash","label":"npm"},{"cmd":"yarn add ts-essentials","lang":"bash","label":"yarn"},{"cmd":"pnpm add ts-essentials","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required peer dependency for correct type inference and functionality. Specific versions are mandated by major releases of ts-essentials.","package":"typescript","optional":false}],"imports":[{"note":"A widely used type to flatten and improve the readability of complex intersection types in IDE tooltips.","symbol":"Prettify","correct":"import { Prettify } from 'ts-essentials'"},{"note":"Applies readonly recursively to all properties, making entire object structures immutable at the type level.","symbol":"DeepReadonly","correct":"import { DeepReadonly } from 'ts-essentials'"},{"note":"Generates a union of all possible string paths to properties within a given object type. Its performance is depth-limited to 7 by default since v10.0.3.","symbol":"Paths","correct":"import { Paths } from 'ts-essentials'"},{"note":"A stricter version of TypeScript's built-in Omit utility, preventing common mistakes with union types.","symbol":"StrictOmit","correct":"import { StrictOmit } from 'ts-essentials'"}],"quickstart":{"code":"import { Prettify, DeepReadonly, StrictOmit, Paths, PathValue } from 'ts-essentials';\n\ninterface User {\n  id: string;\n  name: string;\n  email?: string;\n  address: {\n    street: string;\n    city: string;\n    zip: number;\n    coordinates?: [number, number];\n  };\n  preferences: {\n    theme: 'dark' | 'light';\n    notifications: boolean;\n  };\n  roles: ('admin' | 'editor' | 'viewer')[];\n}\n\n// Prettify: Flattens and makes types more readable in IDE tooltips\ntype PrettyUser = Prettify<User>;\n\n// DeepReadonly: Makes all properties and nested properties readonly\ntype ImmutableUser = DeepReadonly<User>;\n// ImmutableUser.address.street = 'New Street'; // Type Error: Cannot assign to 'street' because it is a read-only property.\n\n// StrictOmit: Constructs a type by picking all properties from Type and then removing Keys.\n// It is a stricter version of TypeScript's built-in Omit.\ntype UserWithoutSensitiveInfo = StrictOmit<User, 'email' | 'address.coordinates' | 'roles'>;\n\nconst newUser: UserWithoutSensitiveInfo = {\n  id: 'abc-123',\n  name: 'Jane Doe',\n  address: { street: 'Main St', city: 'Anytown', zip: 12345 },\n  preferences: { theme: 'dark', notifications: true }\n  // email: 'jane@example.com' // Type Error: Object literal may only specify known properties\n};\n\n// Paths: Generates a union of all possible string paths within an object type\ntype UserPathExamples = Paths<User>;\n// UserPathExamples could include 'id' | 'address.city' | 'preferences.theme' | 'roles.0'\n\n// PathValue: Retrieves the type of the value at a specific path\ntype AddressCityType = PathValue<User, 'address.city'>; // string\ntype FirstRoleType = PathValue<User, 'roles.0'>; // 'admin' | 'editor' | 'viewer'\n","lang":"typescript","description":"Demonstrates the usage of `Prettify` for readability, `DeepReadonly` for immutability, `StrictOmit` for precise property exclusion, and `Paths`/`PathValue` for advanced path-based type introspection on a complex object."},"warnings":[{"fix":"Upgrade your project's TypeScript version to `4.5.0` or higher. Ensure your `package.json` reflects `\"typescript\": \">=4.5.0\"` as a devDependency or peerDependency.","message":"`ts-essentials` versions prior to v10.0.0 supported older TypeScript versions. Since v10.0.0, the minimum required TypeScript version is `^4.2.0` due to advanced type features like `PathValue` and `Paths`. From v10.0.0 onward, specifically for `Mark*` utility types, `typescript>=4.5` is required.","severity":"breaking","affected_versions":">=10.0.0"},{"fix":"Add or ensure `'strictNullChecks': true` is set in your `compilerOptions` in `tsconfig.json`.","message":"The library explicitly requires `strictNullChecks` to be enabled in your `tsconfig.json`. Disabling this option can lead to unexpected type behaviors and diminish the strictness and correctness of the provided utility types.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Replace `DictionaryValues<Type>` with `ValueOf<Type>` in your codebase. For example, `type MyValues = ValueOf<MyDictionary>`.","message":"The `DictionaryValues` utility type has been deprecated since version 10.0.2. Users should migrate to the `ValueOf` utility type for equivalent functionality.","severity":"deprecated","affected_versions":">=10.0.2"},{"fix":"Review existing usages of `DeepOmit` and `DeepPick`. If you relied on the previous generic constraints or need stricter behavior, consider migrating to `StrictDeepOmit` or `StrictDeepPick`.","message":"In v10.0.0, the generic constraint on the second type parameter of `DeepOmit` and `DeepPick` was removed, and new `StrictDeepOmit` and `StrictDeepPick` types were introduced with generic constraints. This changes how these types are used.","severity":"breaking","affected_versions":">=10.0.0"},{"fix":"If you require paths for objects nested deeper than 7 levels, you might need to reconsider your object structure or explore custom type solutions, as there's currently no direct way to configure this depth via options within the type.","message":"To prevent excessively deep type instantiation, the `Paths` utility type now limits the depth of path generation to 7 by default. While this improves performance, it might truncate paths for extremely deeply nested objects.","severity":"gotcha","affected_versions":">=10.0.3"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Upgrade your TypeScript version to `4.2.0` or higher. The library officially requires `4.5.0` or higher for full functionality.","cause":"Using `PathValue` or `Paths` with an older TypeScript version, particularly below 4.2.0, which lacks optimizations for deep type calculations.","error":"Type instantiation is excessively deep and possibly infinite. (2589)"},{"fix":"Ensure `strictNullChecks` is enabled in your `tsconfig.json`. Also, verify that the object being assigned indeed has all required properties as non-nullable.","cause":"Attempting to assign an object that is missing a formerly optional property to a type transformed by `Required` or `DeepRequired`, especially when `strictNullChecks` is not enabled, leading to incorrect type inference.","error":"Property 'someOptionalProperty' does not exist on type 'Required<MyType>'."},{"fix":"Carefully review the `UnionType` and `ExcludedMembers` parameters for `StrictExclude`, or `Type` and `Keys` for `StrictOmit`, ensuring they precisely match the desired exclusion logic. These strict types are less forgiving than their built-in counterparts.","cause":"Incorrectly attempting to use a stricter utility type like `StrictExclude` or `StrictOmit` with a union type that does not align with its strict exclusion rules, leading to unintended type narrowing.","error":"Argument of type '(...)' is not assignable to parameter of type 'never'."}],"ecosystem":"npm"}