## Install
```sh
npm install --save-dev ts-essentials
```
π We require `typescript>=4.5`. If you're looking for support for older TS versions, please have a look at the
[TypeScript dependency table](https://github.com/ts-essentials/ts-essentials/tree/master#TypeScript-dependency-table)
π As we really want types to be stricter, we require enabled
[strictNullChecks](https://www.typescriptlang.org/tsconfig#strictNullChecks) in your project
## API
`ts-essentials` is a set of high-quality, useful TypeScript types that make writing type-safe code easier.
### Basic
- [`Builtin`](/lib/built-in) - Matches primitive, function, date, error or regular expression
- [`KeyofBase`](/lib/key-of-base) -
[`keyofStringsOnly`](https://www.typescriptlang.org/tsconfig#keyofStringsOnly)-tolerant analogue for `PropertyKey`
- [`Prettify`](/lib/prettify/) - flattens type and makes it more readable on the hover in your IDE
- [`Primitive`](/lib/primitive) - Matches any
[primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive)
- [`StrictExclude`](/lib/strict-exclude) - Constructs a type by excluding from `UnionType`
all union members that are assignable to `ExcludedMembers`. This is stricter version of
[`Exclude`](https://www.typescriptlang.org/docs/handbook/utility-types.html#excludeuniontype-excludedmembers)
- [`StrictExtract`](/lib/strict-extract) - Constructs a type by extracting from `Type` all union members
that are assignable to `Union`. This is stricter version of
[`Extract`](https://www.typescriptlang.org/docs/handbook/utility-types.html#extracttype-union)
- [`StrictOmit`](/lib/strict-omit) - Constructs a type by picking all properties from `Type` and then
removing `Keys`. This is stricter version of
[`Omit`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys)
- [`Writable`](/lib/writable) - Constructs a type with removed `readonly` for all properties of `Type`, meaning
the properties of the constructed type can be reassigned
### Utility types
- [`AsyncOrSync`](/lib/async-or-sync) - Constructs a type with `Type` or `PromiseLike`
- [`AsyncOrSyncType`](/lib/async-or-sync-type) - Unwraps `AsyncOrSync` type
- [`Dictionary`](/lib/dictionary) - Constructs a required object type which property keys are `Keys`
(`string` by default) and which property values are `Type`
- [`DictionaryValues`](/lib/dictionary-values) - This type unwraps `Dictionary` value type
- [`Merge`](/lib/merge) - Constructs a type by picking all properties from `Object1` and `Object2`.
Property values from `Object2` override property values from `Object1` when property keys are the same
- [`MergeN`](/lib/merge-n) - Constructs a type by merging objects with type `Merge` in tuple `Tuple` recursively
- [`Newable`](/lib/newable) - Constructs a class type with constructor which has return type `ReturnType`
- [`NonNever`](/lib/non-never) - Constructs a type by picking all properties from type `Type` which values don't
equal to `never`
- [`OmitProperties`](/lib/omit-properties) - Constructs a type by picking all properties from type `Type`
and removing those properties which values equal to `Value`
- [`Opaque`](/lib/opaque) - Constructs a type which is a subset of `Type` with a specified unique token
`Token`
- [`PathValue`](/lib/path-value) - Constructs a path value for type `Type` and path `Path`
- [`Paths`](/lib/paths) - Constructs a union type by picking all possible paths for type `Type`
- [`PickProperties`](/lib/pick-properties) - Constructs a type by picking all properties from type `Type`
which values equal to `Value`
- [`SafeDictionary`](/lib/safe-dictionary) - Constructs an optional object type which property keys are
`Keys` (`string` by default) and which property values are `Type`
- [`UnionToIntersection`](/lib/union-to-intersection) - Constructs a intersection type from union type `Union`
- [`ValueOf`](/lib/value-of) - Constructs a type for type `Type` and equals to a primitive for primitives, array
elements for arrays, function return type for functions or object property values for objects
- [`XOR`](/lib/xor) - Construct a type which is assignable to either type `Type1`,
`Type2` but not both. Starting in ts-essentials@10, it supports up to 50 generic types.
### Mark wrapper types
- [`MarkOptional`](/lib/mark-optional) - Constructs a type by picking all properties from type `Type` where
properties `Keys` are set as optional, meaning they aren't required
- [`MarkReadonly`](/lib/mark-readonly) - Constructs a type by picking all properties from type `Type` where
properties `Keys` are set to `readonly`, meaning they cannot be reassigned
- [`MarkRequired`](/lib/mark-required) - Constructs a type by picking all properties from type `Type` where
properties `Keys` are set as required
- [`MarkWritable`](/lib/mark-writable) - Constructs a type by picking all properties from type `Type` where
properties `Keys` remove `readonly` modifier, meaning they can be reassigned
### Deep wrapper types
- [`Buildable`](/lib/buildable) - Constructs a type by combining `DeepPartial` and `DeepWritable`, meaning all
properties from type `Type` are recursively set as non-`readonly` and optional, meaning they can be reassigned and
aren't required
- [`DeepNonNullable`](/lib/deep-non-nullable) - Constructs a type by picking all properties from type `Type`
recursively and exclude `null` and `undefined` property values from all of them. To make properties non-nullable on
one level, use [`NonNullable`](https://www.typescriptlang.org/docs/handbook/utility-types.html#nonnullabletype)
- [`DeepNullable`](/lib/deep-nullable) - Constructs a type by picking all properties from type `Type` recursively
and include `null` property values for all of them
- [`DeepOmit`](/lib/deep-omit) - Constructs a type by picking all properties from type `Type` and removing
properties which values are `never` or `true` in type `Filter`. If you'd like type `Filter` to be validated against a
structure of `Type`, please use [`StrictDeepOmit`](./lib/strict-deep-omit/).
- [`DeepPartial`](/lib/deep-partial) - Constructs a type by picking all properties from type `Type` recursively
and setting them as optional, meaning they aren't required. To make properties optional on one level, use
[`Partial`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype)
- [`DeepPick`](/lib/deep-pick) - Constructs a type by picking set of properties, which have property
values `never` or `true` in type `Filter`, from type `Type`. If you'd like type `Filter` to be validated against a
structure of `Type`, please use [`StrictDeepPick`](./lib/strict-deep-pick/).
- [`DeepReadonly`](/lib/deep-readonly) - Constructs a type by picking all properties from type `Type` recursively
and setting `readonly` modifier, meaning they cannot be reassigned. To make properties `readonly` on one level, use
[`Readonly`](https://www.typescriptlang.org/docs/handbook/utility-types.html#readonlytype)
- [`DeepRequired`](/lib/deep-required) - Constructs a type by picking all properties from type `Type` recursively
and setting as required. To make properties required on one level, use
[`Required`](https://www.typescriptlang.org/docs/handbook/utility-types.html#requiredtype)
- [`DeepUndefinable`](/lib/deep-undefinable) - Constructs a type by picking all properties from type `Type`
recursively and include `undefined` property values for all of them
- [`DeepWritable`](/lib/deep-writable) - Constructs a type by picking all properties from type `Type` recursively
and removing `readonly` modifier, meaning they can be reassigned. To make properties writable on one level, use
`Writable`
- [`StrictDeepOmit`](/lib/strict-deep-omit) - Constructs a type by picking all properties from type `Type`
and removing properties which values are `never` or `true` in type `Filter`. The type `Filter` is validated against a
structure of `Type`.
- [`StrictDeepPick`](/lib/strict-deep-pick) - Constructs a type by picking set of properties, which have
property values `never` or `true` in type `Filter`, from type `Type`. The type `Filter` is validated against a
structure of `Type`.
### Key types
- [`OptionalKeys`](/lib/optional-keys) - Constructs a union type by picking all optional properties of object type
`Type`
- [`PickKeys`](/lib/pick-keys) - Constructs a union type by picking all properties of object type `Type`
which values are assignable to type `Value`
- [`ReadonlyKeys`](/lib/readonly-keys) - Constructs a union type by picking all `readonly` properties of object
type `Type`, meaning their values cannot be reassigned
- [`RequiredKeys`](/lib/required-keys) - Constructs a union type by picking all required properties of object type
`Type`
- [`WritableKeys`](/lib/writable-keys) - Constructs a union type by picking all writable properties of object type
`Type`, meaning their values can be reassigned
### Type checkers
- [`Exact`](/lib/exact) - Returns `Type` when type `Type` and `Shape` are identical. Otherwise returns
`never`
- [`IsAny`](/lib/is-any) - Returns `true` when type `Type` is `any`. Otherwise returns `false`
- [`IsNever`](/lib/is-never) - Returns `true` when type `Type` is `never`. Otherwise returns `false`
- [`IsUnknown`](/lib/is-unknown) - Returns `true` when type `Type` is `unknown`. Otherwise returns `false`
- [`IsTuple`](/lib/is-tuple) - Returns `Type` when type `Type` is tuple. Otherwise returns `never`
- [`NonEmptyObject