All essential TypeScript types in one place 🤙
<a href="https://www.npmjs.com/package/ts-essentials" title="View this project on NPM">
<img alt="Version" src="https://img.shields.io/npm/v/ts-essentials.svg">
</a>
<img alt="Downloads" src="https://img.shields.io/npm/dm/ts-essentials.svg">
<a href="https://github.com/ts-essentials/ts-essentials/actions?query=branch%3Amaster" title="View Github Build status">
<img alt="Build status" src="https://github.com/ts-essentials/ts-essentials/actions/workflows/ci.yml/badge.svg">
</a>
<a href="https://t.me/ts_essentials" title="Get support in Telegram">
<img alt="Telegram" src="https://img.shields.io/badge/-telegram-red?color=white&logo=telegram">
</a>
<a href="https://github.com/ts-essentials/ts-essentials/raw/v10.2.1/package.json"><img alt="Software License" src="https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square"></a>
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
👉 As we really want types to be stricter, we require enabled strictNullChecks in your project
ts-essentials is a set of high-quality, useful TypeScript types that make writing type-safe code easier.
Builtin - Matches primitive, function, date, error or regular expressionJsonArray - Matches any JSON arrayJsonObject - Matches any JSON objectJsonPrimitive - Matches any
JSON primitive valueJsonValue - Matches any JSON valueKeyofBase -
keyofStringsOnly-tolerant analogue for PropertyKeyPrettify<Type> - flattens type and makes it more readable on the hover in your IDEPrimitive - Matches any
primitive valueStrictExclude<UnionType, ExcludedMembers> - Constructs a type by excluding from UnionType
all union members that are assignable to ExcludedMembers. This is stricter version of
ExcludeStrictExtract<Type, Union> - Constructs a type by extracting from Type all union members
that are assignable to Union. This is stricter version of
ExtractStrictOmit<Type, Keys> - Constructs a type by picking all properties from Type and then
removing Keys. This is stricter version of
OmitWritable<Type> - Constructs a type with removed readonly for all properties of Type, meaning
the properties of the constructed type can be reassignedAsyncOrSync<Type> - Constructs a type with Type or PromiseLike<Type>AsyncOrSyncType<Type> - Unwraps AsyncOrSync typeDictionary<Type, Keys?> - Constructs a required object type which property keys are Keys
(string by default) and which property values are TypeMerge<Object1, Object2> - 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 sameMergeN<Tuple> - Constructs a type by merging objects with type Merge in tuple Tuple recursivelyNewable<ReturnType> - Constructs a class type with constructor which has return type ReturnTypeOmitNeverProperties<Type> - Constructs a type by picking all properties from type Type, which values don't
equal to neverOmitProperties<Type, Value> - Constructs a type by picking all properties from type Type
and removing those properties which values equal to ValueOpaque<Type, Token> - Constructs a type which is a subset of Type with a specified unique token
TokenPathValue<Type, Path> - Constructs a path value for type Type and path PathPaths<Type> - Constructs a union type by picking all possible paths for type TypePickProperties<Type, Value> - Constructs a type by picking all properties from type Type
which values equal to ValuePublicInterface<Type> - Constructs a type by extracting only the public members of Type, producing a plain object-compatible interfaceRequireAtLeastOne<Type, Keys?> - Constructs a type with at least one required key from Keys (keyof Type by default) and other keys from Type which are not part of KeysRequireAtMostOne<Type, Keys?> - Constructs a type with at most one required key from Keys (keyof Type by default) and other keys from Type which are not part of Keys SafeDictionary<Type, Keys?> - Constructs an optional object type which property keys are
Keys (string by default) and which property values are TypeUnionToIntersection<Union> - Constructs a intersection type from union type UnionValueOf<Type> - 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 objectsXOR<Type1, Type2, Type3?, ..., Type50?> - 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.MarkOptional<Type, Keys> - Constructs a type by picking all properties from type Type where
properties Keys are set as optional, meaning they aren't requiredMarkReadonly<Type, Keys> - Constructs a type by picking all properties from type Type where
properties Keys are set to readonly, meaning they cannot be reassignedMarkRequired<Type, Keys> - Constructs a type by picking all properties from type Type where
properties Keys are set as requiredMarkWritable<Type, Keys> - Constructs a type by picking all properties from type Type where
properties Keys remove readonly modifier, meaning they can be reassignedBuildable<Type> - 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 requiredDeepMarkOptional<Type, KeyPathUnion> - Constructs a type by picking all properties from type Type where
properties by paths KeyPathUnion are set as optional. To mark properties optional on one level, use MarkOptional<Type, Keys>. DeepMarkRequired<Type, KeyPathUnion> - Constructs a type by picking all properties from type Type where
properties by paths KeyPathUnion are set as required. To mark properties required on one level, use MarkRequired<Type, Keys>.DeepNonNullable<Type> - 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<Type>DeepNullable<Type> - Constructs a type by picking all properties from type Type recursively
and include null property values for all of themDeepOmit<Type, Filter> - 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<Type, Filter>.DeepPartial<Type> - 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<Type>DeepPick<Type, Filter> - 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<Type, Filter>.DeepReadonly<Type, OverrideDeepReadonlyOptions?> - 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<Type>DeepRequired<Type> - Constructs a type by picking all properties from type Type recursively
and setting as required. To make properties required on one level, use
Required<Type>DeepUndefinable<Type> - Constructs a type by picking all properties from type Type
recursively and include undefined property values for all of themDeepWritable<Type> - 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<Type>StrictDeepOmit<Type, Filter> - 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<Type, Filter> - 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.OptionalKeys<Type> - Constructs a union type by picking all optional properties of object type
TypePickKeys<Type, Value> - Constructs a union type by picking all properties of object type Type
which values are assignable to type ValueReadonlyKeys<Type> - Constructs a union type by picking all readonly properties of object
type Type, meaning their values cannot be reassignedRequiredKeys<Type> - Constructs a union type by picking all required properties of object type
TypeUnionKeys<UnionType> - Constructs a union type by picking all properties from all union members of UnionTypeWritableKeys<Type> - Constructs a union type by picking all writable properties of object type
Type, meaning their values can be reassignedIsAny<Type> - Returns true when type Type is any. Otherwise returns falseIsExact<Type, Shape> - Returns Type when type Type and Shape are identical. Otherwise returns
neverIsNever<Type> - Returns true when type Type is never. Otherwise returns falseIsUnknown<Type> - Returns true when type Type is unknown. Otherwise returns falseIsTuple<Type> - Returns Type when type Type is tuple. Otherwise returns neverNonEmptyObject<Object> - Returns Object when Object has at least one key. Otherwise
returns neverNonUnion<Type> - Returns Type when Type is not an union. Otherwise returns neverAnyArray<Type?> - Matches Array or ReadonlyArray (Type is any by default)AnyNonEmptyArray<Type> - Matches array with at least one element of type TypeArrayOrSingle<Type> - Matches Type or Type[]ElementOf<Type> - Constructs a type which equals to array element type for type TypeHead<Type> - Constructs a type which equals to first element in type TypeReadonlyArrayOrSingle - Matches Type or readonly Type[]Tail<Type> - Constructs a type which equals to elements but first one in type TypeTuple<Type?> - Matches type constraint for tuple with elements of type Type (any by default)CamelCase<Type> - Converts type Type to camel case (e.g. $ claude mcp add ts-essentials \
-- python -m otcore.mcp_server <graph>