types-kit.md

September 4, 2023 ยท View on GitHub

Home > types-kit

types-kit package

Type Aliases

Type AliasDescription
AndAnd operator for types.
ArrayEntryreturn the type of that array's entry.
ArrayItemGet the item type from an array.
ClassCreate a class type.
ConditionalKeysGet keys by Condition (value).
ConditionalOmitOmit by Condition (value).
ConditionalPickPick by Condition (value).
ConstructorCreate a constructor type.
DeepGetGet the deep specified value from T.
DeepKeysGet deep keys of T.
DeepMergeMerge two types into a new type. Keys of the second type will assign keys of the first type.
DeepMergeTupleMerge two tuples, values of the second array will assign values of the array type.
DeepOmitRemove the deep value path from T.
DeepPickGet the deep value path from T.
DeepReplacePickCreate a type that replace the values in the corresponding deep keys.
DeepTupleGetGet the deep specified value by tuple from T.
DeepValueOfGet deep values of T.
DiffSet difference of union and intersection of given union types A and B.
DiffPickFrom T remove properties that exist in U.
Entriesreturn the type of that collection's entries.
Entryreturn the type of that collection's entry.
EqualTag
ExtendsTag
FalsyMatches any falsy value.
FalsyWithoutUnknown
FillCreate a tuple filled with V, and the length of the tuple is L.
FilterCreate an array that filters / keeps out items of the given type V from T.
FlatCreate an array that includes the flatten array type.
FlattedArrayItemGet the flatted item type from an array.
GetGet the specified value from T.
GetSubTuple
IfIf for types.
IfElseIfIf/Else if for types.
IfExtendsIf Condition[0] extends Condition[1], return Case1, else return Case2.
IncludesIf V is a member of T, return true, else return false.
InternalAddUrlQueryValueToResult
InternalDeepKeys
InternalDeepMergeTupleValue
InternalDeepReplacePick
InternalDeepReplacePickKeys
InternalDeepReplacePickValue
InternalDeepTupleGet
InternalFill
InternalNormalizeSliceIndex
InternalReplacePickValue
InternalSlice
InternalStringToNumber
InternalTupleGet
InternalUrlParamsToUnion
InternalUrlQueryToObject
IsAnyIf T is any, return true, else return false.
IsEmptyTypeArrayIf T is a empty array, return true, else return false.
IsEqualsif A equals B, return true, else return false.
IsExtendsif A extends B (no distributed condition type), return true, else return false.
IsFalsyIf T is a falsy value, return true, else return false.
IsNeverIf T is never, return true, else return false.
IsObjectIf T is object, return true, else return false.
IsPrimitiveIf T is a primitive value, return true, else return false.
IsReadonlyArrayIf T is a readonly array, return true, else return false.
IsTruthyIf T is a truthy value, return true, else return false.
IsTupleIf T is a tuple, return true, else return false.
IsUnknownIf T is unknown, return true, else return false.
IterableValueGet the value type of an Iterable / AsyncIterable.
KeysGet keys of T.
LastInUnionGet the last type in a union type (important!: the result is random when you are using tsc, the correct type can only be obtained through the editor environment).
LiteralToPrimitiveGiven a literal type return the Primitive it belongs to, or never if it's not a primitive. eg: Working with generic types that may be literal types.
LiteralUnionAllows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
MapEntryreturn the type of that map's entry.
MergeMerge two types into a new type. Keys of the second type will override keys of the first type.
MergeExclusiveCreate a type that has mutually exclusive keys.
MergeTupleMerge two tuples, values of the second array will override values of the array type.
MutableMake all properties in T mutable (remove readonly decorator) .
MutableDeepMake all properties (includes deep properties) in T mutable (remove readonly decorator) .
MutableKeysGet mutable property keys of T.
NotNot operator for types.
ObjectEntryreturn the type of that object's entry.
OptionalKeysGet optional property keys of T.
OrOr operator for types.
OtherToStringStringify other types
PartialDeepMake all properties (includes deep properties) in T optional.
PathKey
PickAllOrNoneCreate a type that requires all of the given keys or none of the given keys. The remaining keys are kept as is.
PickAtLeastOneCreate a type that requires at least one of the given keys. The remaining keys are kept as is.
PickExactlyOneCreate a type that requires at least one of the given keys. The remaining keys are kept as is.
PrimitiveMatches any primitive value.
ReadonlyDeepMake all properties (includes deep properties) in T readonly (add readonly decorator).
ReadonlyKeysGet readonly property keys of T.
RemoveIndexSignatureCreate a type that only has explicitly defined properties, absent of any index signatures.
ReplacePickCreate a type that replace the values in the corresponding keys.
RequiredDeepMake all properties (includes deep properties) in T required.
RequiredKeysGet required property keys of T.
ReverseReverses an array.
SetEntryreturn the type of that set's entry.
SetMutableMake some properties in T mutable (remove readonly decorator).
SetMutableDeepPickMake some properties (includes deep properties) in T readonly (add readonly decorator)..
SetOptionalMake some properties in T optional.
SetOptionalDeepMake some properties (includes deep properties) in T optional.
SetReadonlyMake some properties in T readonly (add readonly decorator).
SetReadonlyDeepMake some properties (includes deep properties) in T readonly (add readonly decorator)..
SetRequiredMake some properties in T required.
SetRequiredDeepMake some properties (includes deep properties) in T required.
SimplifyFlatten the type output to improve type hints shown in editors.
SliceCreate a subarray of Arr from index Start to End. Indexes with negative numbers will be counted from reversely.
StrictExcludeStrict version of Exclude.
StrictOmitStrict version of Omit.
StringToNumberConvert string (${number}) to number
SwitchSwitch for types.
TupleCreate a tuple.
TupleGetGet the specified value by tuple from T.
TupleKeysGet keys of tuple T.
TupleToObjectConvert a tuple to an object, it can pass in a tag to modify the key value.
TupleToUnionConvert a tuple to union type.
UnionToIntersectionConvert union type to Intersection type.
UnionToSubTupleArrayGet all sub tuple array from the passing parameter.
UnionToTupleConvert union type to a tuple.
UrlParamsToUnionParser the params of a url into a union type
UrlQueryToObjectParser the querystring of a url into an object type
ValueOfGet values of T.
WithConflictingIndexSignatureCreate a type that contains T, and uses the ConflictingIndexSignatureType type as the index signature.
WithIndexSignatureCreate a type that contains T, and uses the IndexSignatureType type as the index signature.
Without