types-kit.md
September 4, 2023 ยท View on GitHub
types-kit package
Type Aliases
| Type Alias | Description |
|---|---|
| And | And operator for types. |
| ArrayEntry | return the type of that array's entry. |
| ArrayItem | Get the item type from an array. |
| Class | Create a class type. |
| ConditionalKeys | Get keys by Condition (value). |
| ConditionalOmit | Omit by Condition (value). |
| ConditionalPick | Pick by Condition (value). |
| Constructor | Create a constructor type. |
| DeepGet | Get the deep specified value from T. |
| DeepKeys | Get deep keys of T. |
| DeepMerge | Merge two types into a new type. Keys of the second type will assign keys of the first type. |
| DeepMergeTuple | Merge two tuples, values of the second array will assign values of the array type. |
| DeepOmit | Remove the deep value path from T. |
| DeepPick | Get the deep value path from T. |
| DeepReplacePick | Create a type that replace the values in the corresponding deep keys. |
| DeepTupleGet | Get the deep specified value by tuple from T. |
| DeepValueOf | Get deep values of T. |
| Diff | Set difference of union and intersection of given union types A and B. |
| DiffPick | From T remove properties that exist in U. |
| Entries | return the type of that collection's entries. |
| Entry | return the type of that collection's entry. |
| EqualTag | |
| ExtendsTag | |
| Falsy | Matches any falsy value. |
| FalsyWithoutUnknown | |
| Fill | Create a tuple filled with V, and the length of the tuple is L. |
| Filter | Create an array that filters / keeps out items of the given type V from T. |
| Flat | Create an array that includes the flatten array type. |
| FlattedArrayItem | Get the flatted item type from an array. |
| Get | Get the specified value from T. |
| GetSubTuple | |
| If | If for types. |
| IfElseIf | If/Else if for types. |
| IfExtends | If Condition[0] extends Condition[1], return Case1, else return Case2. |
| Includes | If 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 | |
| IsAny | If T is any, return true, else return false. |
| IsEmptyTypeArray | If T is a empty array, return true, else return false. |
| IsEquals | if A equals B, return true, else return false. |
| IsExtends | if A extends B (no distributed condition type), return true, else return false. |
| IsFalsy | If T is a falsy value, return true, else return false. |
| IsNever | If T is never, return true, else return false. |
| IsObject | If T is object, return true, else return false. |
| IsPrimitive | If T is a primitive value, return true, else return false. |
| IsReadonlyArray | If T is a readonly array, return true, else return false. |
| IsTruthy | If T is a truthy value, return true, else return false. |
| IsTuple | If T is a tuple, return true, else return false. |
| IsUnknown | If T is unknown, return true, else return false. |
| IterableValue | Get the value type of an Iterable / AsyncIterable. |
| Keys | Get keys of T. |
| LastInUnion | Get 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). |
| LiteralToPrimitive | Given 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. |
| LiteralUnion | Allows 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. |
| MapEntry | return the type of that map's entry. |
| Merge | Merge two types into a new type. Keys of the second type will override keys of the first type. |
| MergeExclusive | Create a type that has mutually exclusive keys. |
| MergeTuple | Merge two tuples, values of the second array will override values of the array type. |
| Mutable | Make all properties in T mutable (remove readonly decorator) . |
| MutableDeep | Make all properties (includes deep properties) in T mutable (remove readonly decorator) . |
| MutableKeys | Get mutable property keys of T. |
| Not | Not operator for types. |
| ObjectEntry | return the type of that object's entry. |
| OptionalKeys | Get optional property keys of T. |
| Or | Or operator for types. |
| OtherToString | Stringify other types |
| PartialDeep | Make all properties (includes deep properties) in T optional. |
| PathKey | |
| PickAllOrNone | Create a type that requires all of the given keys or none of the given keys. The remaining keys are kept as is. |
| PickAtLeastOne | Create a type that requires at least one of the given keys. The remaining keys are kept as is. |
| PickExactlyOne | Create a type that requires at least one of the given keys. The remaining keys are kept as is. |
| Primitive | Matches any primitive value. |
| ReadonlyDeep | Make all properties (includes deep properties) in T readonly (add readonly decorator). |
| ReadonlyKeys | Get readonly property keys of T. |
| RemoveIndexSignature | Create a type that only has explicitly defined properties, absent of any index signatures. |
| ReplacePick | Create a type that replace the values in the corresponding keys. |
| RequiredDeep | Make all properties (includes deep properties) in T required. |
| RequiredKeys | Get required property keys of T. |
| Reverse | Reverses an array. |
| SetEntry | return the type of that set's entry. |
| SetMutable | Make some properties in T mutable (remove readonly decorator). |
| SetMutableDeepPick | Make some properties (includes deep properties) in T readonly (add readonly decorator).. |
| SetOptional | Make some properties in T optional. |
| SetOptionalDeep | Make some properties (includes deep properties) in T optional. |
| SetReadonly | Make some properties in T readonly (add readonly decorator). |
| SetReadonlyDeep | Make some properties (includes deep properties) in T readonly (add readonly decorator).. |
| SetRequired | Make some properties in T required. |
| SetRequiredDeep | Make some properties (includes deep properties) in T required. |
| Simplify | Flatten the type output to improve type hints shown in editors. |
| Slice | Create a subarray of Arr from index Start to End. Indexes with negative numbers will be counted from reversely. |
| StrictExclude | Strict version of Exclude. |
| StrictOmit | Strict version of Omit. |
| StringToNumber | Convert string (${number}) to number |
| Switch | Switch for types. |
| Tuple | Create a tuple. |
| TupleGet | Get the specified value by tuple from T. |
| TupleKeys | Get keys of tuple T. |
| TupleToObject | Convert a tuple to an object, it can pass in a tag to modify the key value. |
| TupleToUnion | Convert a tuple to union type. |
| UnionToIntersection | Convert union type to Intersection type. |
| UnionToSubTupleArray | Get all sub tuple array from the passing parameter. |
| UnionToTuple | Convert union type to a tuple. |
| UrlParamsToUnion | Parser the params of a url into a union type |
| UrlQueryToObject | Parser the querystring of a url into an object type |
| ValueOf | Get values of T. |
| WithConflictingIndexSignature | Create a type that contains T, and uses the ConflictingIndexSignatureType type as the index signature. |
| WithIndexSignature | Create a type that contains T, and uses the IndexSignatureType type as the index signature. |
| Without |