1 | <p align="center">
|
2 | <a href="https://github.com/millsp/ts-toolbelt">
|
3 | <img alt="banner" title="ts-toolbelt" src="https://raw.githubusercontent.com/millsp/ts-toolbelt/master/.github/banner.svg">
|
4 | </a>
|
5 | <h4 align="center">TypeScript's largest utility library</h4>
|
6 | </p>
|
7 |
|
8 | <p align="center">
|
9 | <a href="https://www.npmjs.com/package/ts-toolbelt" >
|
10 | <img src="https://img.shields.io/npm/v/ts-toolbelt.svg">
|
11 | </a>
|
12 | <a href="https://travis-ci.org/millsp/ts-toolbelt" >
|
13 | <img src="https://img.shields.io/travis/millsp/ts-toolbelt.svg">
|
14 | </a>
|
15 | <a href="#">
|
16 | <img src="https://img.shields.io/npm/dm/ts-toolbelt.svg">
|
17 | </a>
|
18 | <a href="https://lgtm.com/projects/g/millsp/ts-toolbelt/context:javascript">
|
19 | <img alt="Language grade: JavaScript" src="https://img.shields.io/lgtm/grade/javascript/g/millsp/ts-toolbelt.svg?logo=lgtm&logoWidth=-2"/>
|
20 | </a>
|
21 | <a href="#">
|
22 | <img src="http://isitmaintained.com/badge/resolution/millsp/ts-toolbelt.svg"/>
|
23 | </a>
|
24 | </p>
|
25 |
|
26 | <p align="center">
|
27 | <a href="https://gitter.im/ts-toolbelt/community?utm_source=share-link&utm_medium=link&utm_campaign=share-link" >
|
28 | <img src="https://img.shields.io/gitter/room/ts-toolbelt/community.svg">
|
29 | </a>
|
30 | <a href="http://makeapullrequest.com" >
|
31 | <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg">
|
32 | </a>
|
33 | <a href="https://conventionalcommits.org" >
|
34 | <img src="https://img.shields.io/badge/Conventional%20Commits-1.0.0-green.svg">
|
35 | </a>
|
36 | <a href="https://github.com/millsp/ts-toolbelt/blob/master/CODE_OF_CONDUCT.md" >
|
37 | <img src="https://img.shields.io/badge/CoC-Contributor%20Covenant-green.svg">
|
38 | </a>
|
39 | <a href="#">
|
40 | <img src="https://img.shields.io/npm/l/ts-toolbelt.svg">
|
41 | </a>
|
42 | </p>
|
43 |
|
44 | <p align="center">
|
45 | <a href="https://millsp.github.io/ts-toolbelt/">📖 Documentation</a>
|
46 | ·
|
47 | <a href="https://github.com/millsp/ts-toolbelt/issues?utf8=✓&q=is%3Aissue+label%3Aannouncement+sort%3Acreated-desc+">📣 Announcements</a>
|
48 | ·
|
49 | <a href="https://github.com/millsp/ts-toolbelt/issues/new?template=---bug-report.md" alt="Bug Report">🐞 Report Bug</a>
|
50 | ·
|
51 | <a href="https://github.com/millsp/ts-toolbelt/issues/new?template=---feature-request.md" alt="Request Feature">🍩 Request Feature</a>
|
52 | ·
|
53 | <a href="https://github.com/millsp/ts-toolbelt/discussions/new" alt="Ask Questions">🤔 Ask Questions</a>
|
54 | </p>
|
55 |
|
56 | ## About
|
57 |
|
58 | **ts-toolbelt** is the largest, and most tested type library available right
|
59 | now, featuring **+200 utilities**. Our type collection packages some of the most
|
60 | advanced mapped types, conditional types, and recursive types on the market.
|
61 |
|
62 | **Spend less time, build stronger**. Benefit from a wide range of generic type
|
63 | functions to achieve better type safety.
|
64 |
|
65 | We work just like lodash, or ramda, but applied to the type system. Our mission
|
66 | is to provide you with simple ways to compute, change, and create types. We
|
67 | abstract all those complex type checks away for you. We provide a simple,
|
68 | reusable, and standard API to help you get more done with TypeScript.
|
69 |
|
70 | **ts-toolbelt** is a well organized package that can help you perform advanced
|
71 | operations on object types, union types, as well as function, and literal types.
|
72 | It is carefully and coherently designed for building robust, flexible, and
|
73 | type-safe software.
|
74 |
|
75 | <p align="center">
|
76 | <a href="https://codesandbox.io/s/ts-toolbelt-x4jly?file=/src/index.ts">
|
77 | <img alt="demo" width="800" title="ts-toolbelt" src="https://raw.githubusercontent.com/millsp/ts-toolbelt/master/.github/demo.svg">
|
78 | </a>
|
79 | </p>
|
80 |
|
81 | We are a community and a knowledge base. Everyone is welcome to ask questions
|
82 | about types. If you are stuck or you misunderstand something, you came to the
|
83 | right place!. We welcome beginners and advanced developers to come take part.
|
84 | **Welcome!**
|
85 |
|
86 | ## Getting Started
|
87 |
|
88 | ### Prerequisites
|
89 |
|
90 | ```sh
|
91 | npm install typescript@^4.1.0 --save-dev
|
92 | ```
|
93 |
|
94 | For best results, add this to your `tsconfig.json`
|
95 |
|
96 | ```ts
|
97 | {
|
98 | "compilerOptions": {
|
99 | // highly recommended (required by few utilities)
|
100 | "strictNullChecks": true,
|
101 |
|
102 | // this is optional, but enable whenever possible
|
103 | "strict": true,
|
104 |
|
105 | // this is the lowest supported standard library
|
106 | "lib": ["es2015"],
|
107 | }
|
108 | }
|
109 | ```
|
110 |
|
111 | ### Installation
|
112 |
|
113 | ```sh
|
114 | npm install ts-toolbelt --save
|
115 | ```
|
116 |
|
117 | ### Hello World
|
118 |
|
119 | ```ts
|
120 | import {Object} from "ts-toolbelt"
|
121 | // Check the docs below for more
|
122 |
|
123 | // Merge two `object` together
|
124 | type merge = Object.Merge<{name: string}, {age?: number}>
|
125 | // {name: string, age?: number}
|
126 |
|
127 | // Make a field of an `object` optional
|
128 | type optional = Object.Optional<{id: number, name: string}, "name">
|
129 | // {id: number, name?: string}
|
130 | ```
|
131 |
|
132 | You can [**level-up, and re-code this library from
|
133 | scratch**](https://medium.com/free-code-camp/typescript-curry-ramda-types-f747e99744ab).
|
134 |
|
135 | ## [Documentation ⤢](https://millsp.github.io/ts-toolbelt/)
|
136 |
|
137 | ### Imports
|
138 |
|
139 | The project is organized around TypeScript's main concepts:
|
140 |
|
141 | | **Any** | **Boolean** | **Class** | **Function** | **Iteration** | **List** |
|
142 | |------------|-------------|--------------|--------------|---------------|----------|
|
143 | | **Number** | **Object** | **Object.P** | **String** | **Union** | **Test** |
|
144 |
|
145 | > **`TIP`** How to choose categories? Match your type with them.
|
146 |
|
147 | There are many ways to import the types into your project:
|
148 |
|
149 | * **Explicit**
|
150 | ```ts
|
151 | import {Any, Boolean, Class, Function, Iteration, List, Number, Object, String, Union} from "ts-toolbelt"
|
152 | ```
|
153 |
|
154 | * **Compact**
|
155 | ```ts
|
156 | import {A, B, C, F, I, L, N, O, S, U} from "ts-toolbelt"
|
157 | ```
|
158 |
|
159 | * **Portable**
|
160 | ```ts
|
161 | import tb from "ts-toolbelt"
|
162 | ```
|
163 |
|
164 | You can also import our non-official API from the community:
|
165 | ```ts
|
166 | import {Community} from "ts-toolbelt"
|
167 | ```
|
168 |
|
169 | > **`TIP`** The community API is for our community to publish useful types that
|
170 | > don't see fit in the standard API.
|
171 |
|
172 | ### Utility Index
|
173 |
|
174 | |ANY|OBJECT|LIST|FUNCTION|STRING|UNION|CLASS|BOOLEAN|NUMBER|OBJECT.P|ITERATION|
|
175 | |---|---|---|---|---|---|---|---|---|---|---|
|
176 | |[Await](https://millsp.github.io/ts-toolbelt/modules/any_await.html)|[Assign](https://millsp.github.io/ts-toolbelt/modules/object_assign.html)|[Append](https://millsp.github.io/ts-toolbelt/modules/list_append.html)|[AutoPath](https://millsp.github.io/ts-toolbelt/modules/function_autopath.html)|[At](https://millsp.github.io/ts-toolbelt/modules/string_at.html)|[Diff](https://millsp.github.io/ts-toolbelt/modules/union_diff.html)|[Class](https://millsp.github.io/ts-toolbelt/modules/class_class.html)|[And](https://millsp.github.io/ts-toolbelt/modules/boolean_and.html)|[Absolute](https://millsp.github.io/ts-toolbelt/modules/number_absolute.html)|[Merge](https://millsp.github.io/ts-toolbelt/modules/object_p_merge.html)|[Iteration](https://millsp.github.io/ts-toolbelt/modules/iteration_iteration.html)|
|
177 | |[At](https://millsp.github.io/ts-toolbelt/modules/any_at.html)|[AtLeast](https://millsp.github.io/ts-toolbelt/modules/object_atleast.html)|[Assign](https://millsp.github.io/ts-toolbelt/modules/list_assign.html)|[Compose](https://millsp.github.io/ts-toolbelt/modules/function_compose.html)|[Join](https://millsp.github.io/ts-toolbelt/modules/string_join.html)|[Exclude](https://millsp.github.io/ts-toolbelt/modules/union_exclude.html)|[Instance](https://millsp.github.io/ts-toolbelt/modules/class_instance.html)|[Not](https://millsp.github.io/ts-toolbelt/modules/boolean_not.html)|[Add](https://millsp.github.io/ts-toolbelt/modules/number_add.html)|[Omit](https://millsp.github.io/ts-toolbelt/modules/object_p_omit.html)|[IterationOf](https://millsp.github.io/ts-toolbelt/modules/iteration_iterationof.html)|
|
178 | |[Cast](https://millsp.github.io/ts-toolbelt/modules/any_cast.html)|[Compulsory](https://millsp.github.io/ts-toolbelt/modules/object_compulsory.html)|[AtLeast](https://millsp.github.io/ts-toolbelt/modules/list_atleast.html)|[Curry](https://millsp.github.io/ts-toolbelt/modules/function_curry.html)|[Length](https://millsp.github.io/ts-toolbelt/modules/string_length.html)|[Filter](https://millsp.github.io/ts-toolbelt/modules/union_filter.html)|[Parameters](https://millsp.github.io/ts-toolbelt/modules/class_parameters.html)|[Or](https://millsp.github.io/ts-toolbelt/modules/boolean_or.html)|[Greater](https://millsp.github.io/ts-toolbelt/modules/number_greater.html)|[Pick](https://millsp.github.io/ts-toolbelt/modules/object_p_pick.html)|[Key](https://millsp.github.io/ts-toolbelt/modules/iteration_key.html)|
|
179 | |[Compute](https://millsp.github.io/ts-toolbelt/modules/any_compute.html)|[CompulsoryKeys](https://millsp.github.io/ts-toolbelt/modules/object_compulsorykeys.html)|[Compulsory](https://millsp.github.io/ts-toolbelt/modules/list_compulsory.html)|[Exact](https://millsp.github.io/ts-toolbelt/modules/function_exact.html)|[Replace](https://millsp.github.io/ts-toolbelt/modules/string_replace.html)|[Has](https://millsp.github.io/ts-toolbelt/modules/union_has.html)||[Xor](https://millsp.github.io/ts-toolbelt/modules/boolean_xor.html)|[GreaterEq](https://millsp.github.io/ts-toolbelt/modules/number_greatereq.html)|[Readonly](https://millsp.github.io/ts-toolbelt/modules/object_p_readonly.html)|[Next](https://millsp.github.io/ts-toolbelt/modules/iteration_next.html)|
|
180 | |[Contains](https://millsp.github.io/ts-toolbelt/modules/any_contains.html)|[Diff](https://millsp.github.io/ts-toolbelt/modules/object_diff.html)|[CompulsoryKeys](https://millsp.github.io/ts-toolbelt/modules/list_compulsorykeys.html)|[Function](https://millsp.github.io/ts-toolbelt/modules/function_function.html)|[Split](https://millsp.github.io/ts-toolbelt/modules/string_split.html)|[IntersectOf](https://millsp.github.io/ts-toolbelt/modules/union_intersectof.html)|||[IsNegative](https://millsp.github.io/ts-toolbelt/modules/number_isnegative.html)|[Update](https://millsp.github.io/ts-toolbelt/modules/object_p_update.html)|[Pos](https://millsp.github.io/ts-toolbelt/modules/iteration_pos.html)|
|
181 | |[Equals](https://millsp.github.io/ts-toolbelt/modules/any_equals.html)|[Either](https://millsp.github.io/ts-toolbelt/modules/object_either.html)|[Concat](https://millsp.github.io/ts-toolbelt/modules/list_concat.html)|[Length](https://millsp.github.io/ts-toolbelt/modules/function_length.html)||[Last](https://millsp.github.io/ts-toolbelt/modules/union_last.html)|||[IsPositive](https://millsp.github.io/ts-toolbelt/modules/number_ispositive.html)|[Record](https://millsp.github.io/ts-toolbelt/modules/object_p_record.html)|[Prev](https://millsp.github.io/ts-toolbelt/modules/iteration_prev.html)|
|
182 | |[Extends](https://millsp.github.io/ts-toolbelt/modules/any_extends.html)|[Exclude](https://millsp.github.io/ts-toolbelt/modules/object_exclude.html)|[Diff](https://millsp.github.io/ts-toolbelt/modules/list_diff.html)|[Narrow](https://millsp.github.io/ts-toolbelt/modules/function_narrow.html)||[Merge](https://millsp.github.io/ts-toolbelt/modules/union_merge.html)|||[IsZero](https://millsp.github.io/ts-toolbelt/modules/number_iszero.html)|||
|
183 | |[Key](https://millsp.github.io/ts-toolbelt/modules/any_key.html)|[ExcludeKeys](https://millsp.github.io/ts-toolbelt/modules/object_excludekeys.html)|[Drop](https://millsp.github.io/ts-toolbelt/modules/list_drop.html)|[NoInfer](https://millsp.github.io/ts-toolbelt/modules/function_noinfer.html)||[NonNullable](https://millsp.github.io/ts-toolbelt/modules/union_nonnullable.html)|||[Lower](https://millsp.github.io/ts-toolbelt/modules/number_lower.html)|||
|
184 | |[Keys](https://millsp.github.io/ts-toolbelt/modules/any_keys.html)|[Filter](https://millsp.github.io/ts-toolbelt/modules/object_filter.html)|[Either](https://millsp.github.io/ts-toolbelt/modules/list_either.html)|[Parameters](https://millsp.github.io/ts-toolbelt/modules/function_parameters.html)||[Nullable](https://millsp.github.io/ts-toolbelt/modules/union_nullable.html)|||[LowerEq](https://millsp.github.io/ts-toolbelt/modules/number_lowereq.html)|||
|
185 | |[KnownKeys](https://millsp.github.io/ts-toolbelt/modules/any_knownkeys.html)|[FilterKeys](https://millsp.github.io/ts-toolbelt/modules/object_filterkeys.html)|[Exclude](https://millsp.github.io/ts-toolbelt/modules/list_exclude.html)|[Pipe](https://millsp.github.io/ts-toolbelt/modules/function_pipe.html)||[Pop](https://millsp.github.io/ts-toolbelt/modules/union_pop.html)|||[Negate](https://millsp.github.io/ts-toolbelt/modules/number_negate.html)|||
|
186 | |[Is](https://millsp.github.io/ts-toolbelt/modules/any_is.html)|[Has](https://millsp.github.io/ts-toolbelt/modules/object_has.html)|[ExcludeKeys](https://millsp.github.io/ts-toolbelt/modules/list_excludekeys.html)|[Promisify](https://millsp.github.io/ts-toolbelt/modules/function_promisify.html)||[Replace](https://millsp.github.io/ts-toolbelt/modules/union_replace.html)|||[Range](https://millsp.github.io/ts-toolbelt/modules/number_range.html)|||
|
187 | |[Promise](https://millsp.github.io/ts-toolbelt/modules/any_promise.html)|[HasPath](https://millsp.github.io/ts-toolbelt/modules/object_haspath.html)|[Extract](https://millsp.github.io/ts-toolbelt/modules/list_extract.html)|[Return](https://millsp.github.io/ts-toolbelt/modules/function_return.html)||[Select](https://millsp.github.io/ts-toolbelt/modules/union_select.html)|||[Sub](https://millsp.github.io/ts-toolbelt/modules/number_sub.html)|||
|
188 | |[Try](https://millsp.github.io/ts-toolbelt/modules/any_try.html)|[Includes](https://millsp.github.io/ts-toolbelt/modules/object_includes.html)|[Filter](https://millsp.github.io/ts-toolbelt/modules/list_filter.html)|[UnCurry](https://millsp.github.io/ts-toolbelt/modules/function_uncurry.html)||[Strict](https://millsp.github.io/ts-toolbelt/modules/union_strict.html)||||||
|
189 | |[Type](https://millsp.github.io/ts-toolbelt/modules/any_type.html)|[Intersect](https://millsp.github.io/ts-toolbelt/modules/object_intersect.html)|[FilterKeys](https://millsp.github.io/ts-toolbelt/modules/list_filterkeys.html)|[ValidPath](https://millsp.github.io/ts-toolbelt/modules/function_validpath.html)||[ListOf](https://millsp.github.io/ts-toolbelt/modules/union_listof.html)||||||
|
190 | |[x](https://millsp.github.io/ts-toolbelt/modules/any_x.html)|[IntersectKeys](https://millsp.github.io/ts-toolbelt/modules/object_intersectkeys.html)|[Flatten](https://millsp.github.io/ts-toolbelt/modules/list_flatten.html)|||||||||
|
191 | ||[Invert](https://millsp.github.io/ts-toolbelt/modules/object_invert.html)|[Group](https://millsp.github.io/ts-toolbelt/modules/list_group.html)|||||||||
|
192 | ||[ListOf](https://millsp.github.io/ts-toolbelt/modules/object_listof.html)|[Has](https://millsp.github.io/ts-toolbelt/modules/list_has.html)|||||||||
|
193 | ||[Merge](https://millsp.github.io/ts-toolbelt/modules/object_merge.html)|[HasPath](https://millsp.github.io/ts-toolbelt/modules/list_haspath.html)|||||||||
|
194 | ||[MergeAll](https://millsp.github.io/ts-toolbelt/modules/object_mergeall.html)|[Head](https://millsp.github.io/ts-toolbelt/modules/list_head.html)|||||||||
|
195 | ||[Modify](https://millsp.github.io/ts-toolbelt/modules/object_modify.html)|[Includes](https://millsp.github.io/ts-toolbelt/modules/list_includes.html)|||||||||
|
196 | ||[NonNullable](https://millsp.github.io/ts-toolbelt/modules/object_nonnullable.html)|[Intersect](https://millsp.github.io/ts-toolbelt/modules/list_intersect.html)|||||||||
|
197 | ||[NonNullableKeys](https://millsp.github.io/ts-toolbelt/modules/object_nonnullablekeys.html)|[IntersectKeys](https://millsp.github.io/ts-toolbelt/modules/list_intersectkeys.html)|||||||||
|
198 | ||[Nullable](https://millsp.github.io/ts-toolbelt/modules/object_nullable.html)|[KeySet](https://millsp.github.io/ts-toolbelt/modules/list_keyset.html)|||||||||
|
199 | ||[NullableKeys](https://millsp.github.io/ts-toolbelt/modules/object_nullablekeys.html)|[Last](https://millsp.github.io/ts-toolbelt/modules/list_last.html)|||||||||
|
200 | ||[Object](https://millsp.github.io/ts-toolbelt/modules/object_object.html)|[LastKey](https://millsp.github.io/ts-toolbelt/modules/list_lastkey.html)|||||||||
|
201 | ||[Omit](https://millsp.github.io/ts-toolbelt/modules/object_omit.html)|[Length](https://millsp.github.io/ts-toolbelt/modules/list_length.html)|||||||||
|
202 | ||[Optional](https://millsp.github.io/ts-toolbelt/modules/object_optional.html)|[List](https://millsp.github.io/ts-toolbelt/modules/list_list.html)|||||||||
|
203 | ||[OptionalKeys](https://millsp.github.io/ts-toolbelt/modules/object_optionalkeys.html)|[Longest](https://millsp.github.io/ts-toolbelt/modules/list_longest.html)|||||||||
|
204 | ||[Overwrite](https://millsp.github.io/ts-toolbelt/modules/object_overwrite.html)|[Merge](https://millsp.github.io/ts-toolbelt/modules/list_merge.html)|||||||||
|
205 | ||[Partial](https://millsp.github.io/ts-toolbelt/modules/object_partial.html)|[MergeAll](https://millsp.github.io/ts-toolbelt/modules/list_mergeall.html)|||||||||
|
206 | ||[Patch](https://millsp.github.io/ts-toolbelt/modules/object_patch.html)|[Modify](https://millsp.github.io/ts-toolbelt/modules/list_modify.html)|||||||||
|
207 | ||[PatchAll](https://millsp.github.io/ts-toolbelt/modules/object_patchall.html)|[NonNullable](https://millsp.github.io/ts-toolbelt/modules/list_nonnullable.html)|||||||||
|
208 | ||[Path](https://millsp.github.io/ts-toolbelt/modules/object_path.html)|[NonNullableKeys](https://millsp.github.io/ts-toolbelt/modules/list_nonnullablekeys.html)|||||||||
|
209 | ||[Paths](https://millsp.github.io/ts-toolbelt/modules/object_paths.html)|[Nullable](https://millsp.github.io/ts-toolbelt/modules/list_nullable.html)|||||||||
|
210 | ||[Pick](https://millsp.github.io/ts-toolbelt/modules/object_pick.html)|[NullableKeys](https://millsp.github.io/ts-toolbelt/modules/list_nullablekeys.html)|||||||||
|
211 | ||[Readonly](https://millsp.github.io/ts-toolbelt/modules/object_readonly.html)|[ObjectOf](https://millsp.github.io/ts-toolbelt/modules/list_objectof.html)|||||||||
|
212 | ||[ReadonlyKeys](https://millsp.github.io/ts-toolbelt/modules/object_readonlykeys.html)|[Omit](https://millsp.github.io/ts-toolbelt/modules/list_omit.html)|||||||||
|
213 | ||[Record](https://millsp.github.io/ts-toolbelt/modules/object_record.html)|[Optional](https://millsp.github.io/ts-toolbelt/modules/list_optional.html)|||||||||
|
214 | ||[Replace](https://millsp.github.io/ts-toolbelt/modules/object_replace.html)|[OptionalKeys](https://millsp.github.io/ts-toolbelt/modules/list_optionalkeys.html)|||||||||
|
215 | ||[Required](https://millsp.github.io/ts-toolbelt/modules/object_required.html)|[Overwrite](https://millsp.github.io/ts-toolbelt/modules/list_overwrite.html)|||||||||
|
216 | ||[RequiredKeys](https://millsp.github.io/ts-toolbelt/modules/object_requiredkeys.html)|[Partial](https://millsp.github.io/ts-toolbelt/modules/list_partial.html)|||||||||
|
217 | ||[Select](https://millsp.github.io/ts-toolbelt/modules/object_select.html)|[Patch](https://millsp.github.io/ts-toolbelt/modules/list_patch.html)|||||||||
|
218 | ||[SelectKeys](https://millsp.github.io/ts-toolbelt/modules/object_selectkeys.html)|[PatchAll](https://millsp.github.io/ts-toolbelt/modules/list_patchall.html)|||||||||
|
219 | ||[Undefinable](https://millsp.github.io/ts-toolbelt/modules/object_undefinable.html)|[Path](https://millsp.github.io/ts-toolbelt/modules/list_path.html)|||||||||
|
220 | ||[UndefinableKeys](https://millsp.github.io/ts-toolbelt/modules/object_undefinablekeys.html)|[Paths](https://millsp.github.io/ts-toolbelt/modules/list_paths.html)|||||||||
|
221 | ||[Unionize](https://millsp.github.io/ts-toolbelt/modules/object_unionize.html)|[Pick](https://millsp.github.io/ts-toolbelt/modules/list_pick.html)|||||||||
|
222 | ||[UnionOf](https://millsp.github.io/ts-toolbelt/modules/object_unionof.html)|[Pop](https://millsp.github.io/ts-toolbelt/modules/list_pop.html)|||||||||
|
223 | ||[Update](https://millsp.github.io/ts-toolbelt/modules/object_update.html)|[Prepend](https://millsp.github.io/ts-toolbelt/modules/list_prepend.html)|||||||||
|
224 | ||[Writable](https://millsp.github.io/ts-toolbelt/modules/object_writable.html)|[Readonly](https://millsp.github.io/ts-toolbelt/modules/list_readonly.html)|||||||||
|
225 | ||[WritableKeys](https://millsp.github.io/ts-toolbelt/modules/object_writablekeys.html)|[ReadonlyKeys](https://millsp.github.io/ts-toolbelt/modules/list_readonlykeys.html)|||||||||
|
226 | |||[Remove](https://millsp.github.io/ts-toolbelt/modules/list_remove.html)|||||||||
|
227 | |||[Repeat](https://millsp.github.io/ts-toolbelt/modules/list_repeat.html)|||||||||
|
228 | |||[Replace](https://millsp.github.io/ts-toolbelt/modules/list_replace.html)|||||||||
|
229 | |||[Required](https://millsp.github.io/ts-toolbelt/modules/list_required.html)|||||||||
|
230 | |||[RequiredKeys](https://millsp.github.io/ts-toolbelt/modules/list_requiredkeys.html)|||||||||
|
231 | |||[Reverse](https://millsp.github.io/ts-toolbelt/modules/list_reverse.html)|||||||||
|
232 | |||[Select](https://millsp.github.io/ts-toolbelt/modules/list_select.html)|||||||||
|
233 | |||[SelectKeys](https://millsp.github.io/ts-toolbelt/modules/list_selectkeys.html)|||||||||
|
234 | |||[Shortest](https://millsp.github.io/ts-toolbelt/modules/list_shortest.html)|||||||||
|
235 | |||[Tail](https://millsp.github.io/ts-toolbelt/modules/list_tail.html)|||||||||
|
236 | |||[Take](https://millsp.github.io/ts-toolbelt/modules/list_take.html)|||||||||
|
237 | |||[Undefinable](https://millsp.github.io/ts-toolbelt/modules/list_undefinable.html)|||||||||
|
238 | |||[UndefinableKeys](https://millsp.github.io/ts-toolbelt/modules/list_undefinablekeys.html)|||||||||
|
239 | |||[Unionize](https://millsp.github.io/ts-toolbelt/modules/list_unionize.html)|||||||||
|
240 | |||[UnionOf](https://millsp.github.io/ts-toolbelt/modules/list_unionof.html)|||||||||
|
241 | |||[UnNest](https://millsp.github.io/ts-toolbelt/modules/list_unnest.html)|||||||||
|
242 | |||[Update](https://millsp.github.io/ts-toolbelt/modules/list_update.html)|||||||||
|
243 | |||[Writable](https://millsp.github.io/ts-toolbelt/modules/list_writable.html)|||||||||
|
244 | |||[WritableKeys](https://millsp.github.io/ts-toolbelt/modules/list_writablekeys.html)|||||||||
|
245 | |||[Zip](https://millsp.github.io/ts-toolbelt/modules/list_zip.html)|||||||||
|
246 | |||[ZipObj](https://millsp.github.io/ts-toolbelt/modules/list_zipobj.html)|||||||||
|
247 |
|
248 | ### [Archives ⤢](https://github.com/millsp/ts-toolbelt/tree/gh-pages)
|
249 |
|
250 | > **`EXAMPLE`** https://millsp.github.io/ts-toolbelt/4.2.1/
|
251 |
|
252 | ## [Good to Know ⤢](https://github.com/millsp/ts-toolbelt/discussions/categories/q-a)
|
253 |
|
254 | In this wiki, you will find some extra resources for your learning, and
|
255 | understanding.
|
256 |
|
257 | **Are you missing something?** Participate to the open-wiki by [posting your
|
258 | questions](https://github.com/millsp/ts-toolbelt/discussions/new).
|
259 |
|
260 | ## Running tests
|
261 |
|
262 | ### For this project
|
263 |
|
264 | To run the `lint` & `type` tests, simply run:
|
265 |
|
266 | ```sh
|
267 | npm test
|
268 | ```
|
269 |
|
270 | ### For your project
|
271 |
|
272 | Want to test your own types? Let's get started:
|
273 |
|
274 | ```ts
|
275 | import {Number, Test} from "ts-toolbelt"
|
276 |
|
277 | const {checks, check} = Test
|
278 |
|
279 | checks([
|
280 | check<Number.Add<1, 30>, 31, Test.Pass>(),
|
281 | check<Number.Add<5, -3>, 2, Test.Pass>(),
|
282 | ])
|
283 | ```
|
284 |
|
285 | > **`TIP`** Place it in a file that won't be executed, it's just for TypeScript
|
286 | > to test types.
|
287 |
|
288 | ### Continuous Integration
|
289 |
|
290 | The releases are done with Travis CI in stages & whenever a branch or PR is
|
291 | pushed:
|
292 |
|
293 | - Tests are run with `npm test`
|
294 | - Tests against
|
295 | [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped/)
|
296 | - Releases to npm@[branch-name]
|
297 |
|
298 | ## Compatibility
|
299 |
|
300 | The project is maintained to adapt to the constant [changes of
|
301 | TypeScript](https://github.com/Microsoft/TypeScript/wiki/Roadmap):
|
302 |
|
303 | | ts-toolbelt | typescript |
|
304 | |-------------|------------|
|
305 | | 9.x.x | ^4.1.x |
|
306 |
|
307 | Major version numbers will upgrade whenever TypeScript had breaking changes.
|
308 |
|
309 | Otherwise, the release versions will naturally follow the semantic versioning.
|
310 |
|
311 | ## What's next
|
312 |
|
313 | * Automated performance tests
|
314 | ```sh
|
315 | # performance is checked manually with
|
316 | npx tsc --noEmit --extendedDiagnostics
|
317 | ```
|
318 |
|
319 | * Need to write more examples
|
320 |
|
321 | ## Related Projects
|
322 |
|
323 | | **Name** | **Intro** |
|
324 | |----------------------------------------------------------------|------------------------------------------------------------------------------------------|
|
325 | | [`eledoc`](https://github.com/millsp/eledoc) | 🌒 A material dark theme for TypeDoc. |
|
326 | | [`material-candy`](https://github.com/millsp/material-candy) | 🍬 A vscode theme to uplift your mood, stay happy and focused. |
|
327 | | [`utility-types`](https://github.com/piotrwitek) | Collection of utility types, complementing TypeScript built-in mapped types and aliases. |
|
328 |
|
329 | ## License
|
330 |
|
331 | [![FOSSA
|
332 | Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fpirix-gh%2Fts-toolbelt.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fpirix-gh%2Fts-toolbelt?ref=badge_large)
|
333 |
|
\ | No newline at end of file |