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.
npm install ts-essentialsVerified import paths — ran on the pinned version, not inferred.
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.
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.
Add or ensure `'strictNullChecks': true` is set in your `compilerOptions` in `tsconfig.json`.
Replace `DictionaryValues<Type>` with `ValueOf<Type>` in your codebase. For example, `type MyValues = ValueOf<MyDictionary>`.
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`.
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.
Upgrade your TypeScript version to `4.2.0` or higher. The library officially requires `4.5.0` or higher for full functionality.
Ensure `strictNullChecks` is enabled in your `tsconfig.json`. Also, verify that the object being assigned indeed has all required properties as non-nullable.
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.