Utility Types
_<T>
#
Placeholder that sometimes helps force TS to display what you want it to.
Partial<T>
#
Make all properties in T optional
Required<T>
#
Make all properties in T required
Readonly<T>
#
Make all properties in T readonly
Writable<T>
#
Make all properties in T non-readonly.
Pick<T, K>
#
From T pick a set of properties K
Omit<T, K>
#
Returns a subset of type T which excludes properties K
Record<K, T>
#
Construct a type with a set of properties K of type T
Exclude<T, U>
#
Exclude from T those types that are assignable to U
Extract<T, U>
#
Extract from T those types that are assignable to U
ExtractKeys<T, U>
#
Returns a union of all the keys of T whose values extend from U
ExtractMembers<T, U>
#
Returns a new object type of all the keys of T whose values extend from U
ExcludeKeys<T, U>
#
Returns a union of all the keys of T whose values do not extend from U
ExcludeMembers<T, U>
#
Returns a new object type of all the keys of T whose values do not extend from U
NonNullable<T>
#
Exclude null and undefined from T
Parameters<T>
#
Obtain the parameters of a function type in a tuple | never
.
ConstructorParameters<T>
#
Obtain the parameters of a constructor function type in a tuple | never
ReturnType<T>
#
Obtain the return type of a function type
InstanceType<T>
#
Obtain the return type of a constructor function type
Reconstruct<T>
#
Combines a series of intersections into one object, e.g. { x: number } & { y: number } becomes { x: number, y: number }
UnionToIntersection<T>
#
Converts a series of object unions to a series of intersections, e.g. A | B becomes A & B
ThisParameterType<T>
#
Extracts the type of the 'this' parameter of a function type, or 'unknown' if the function type has no 'this' parameter.
OmitThisParameter<T>
#
Removes the 'this' parameter from a function type.
WritablePropertyNames<T>
#
Given an object T
, returns a unioned type of all non-readonly property names.
WritableProperties<T>
#
Given an object T
, returns an object with readonly fields filtered out.
InstancePropertyNames<T>
#
Given an Instance T
, returns a unioned type of all property names.
InstanceMethodNames<T>
#
Given an Instance T
, returns a unioned type of all method names.
InstanceEventNames<T>
#
Given an Instance T
, returns a unioned type of all event names.
InstanceProperties<T>
#
Given an Instance T
, returns an object with only properties.
InstanceMethods<T>
#
Given an Instance T
, returns an object with only methods.
InstanceEvents<T>
#
Given an Instance T
, returns an object with only events.
WritableInstanceProperties<T>
#
Given an Instance T
, returns an object with readonly fields, methods, and events filtered out.
ExcludeNominalMembers<T>
#
Returns a new object type of all the keys of T which do not start with _nominal_