ts-toolbelt
Advanced tools
Comparing version 1.0.31 to 1.0.32
{ | ||
"name": "ts-toolbelt", | ||
"version": "1.0.31", | ||
"version": "1.0.32", | ||
"license": "Apache-2.0", | ||
@@ -44,2 +44,3 @@ "author": "Pierre-Antoine Mills", | ||
"eslint-plugin-react": "^7.13.0", | ||
"npx": "^10.2.0", | ||
"release-it": "^12.3.0", | ||
@@ -46,0 +47,0 @@ "ts-node": "^8.2.0", |
188
README.md
@@ -45,53 +45,55 @@ <p align="center"> | ||
- [About](#about) | ||
- [Features](#features) | ||
- [Getting started](#getting-started) | ||
- [Documentation](#documentation) | ||
- [Contributing](#contributing) | ||
- [Sponsoring issues](#sponsoring-issues) | ||
- [Running tests](#running-tests) | ||
- [Compatibility](#compatibility) | ||
- [What's next](#whats-next) | ||
- [Acknowledgments](#acknowledgments) | ||
- [Contact](#contact) | ||
- [Licence](#licence) | ||
* [๐ About](#-about) | ||
* [๐ฉ Features](#-features) | ||
* [๐ Getting started](#-getting-started) | ||
* [๐ Documentation](#-documentation) | ||
* [โ Contributing](#-contributing) | ||
* [๐ Sponsoring issues](#-sponsoring-issues) | ||
* [๐ Running tests](#-running-tests) | ||
* [๐ง Compatibility](#-compatibility) | ||
* [๐ฎ What's next](#-whats-next) | ||
* [๐ Acknowledgments](#-acknowledgments) | ||
## About | ||
## ๐ About | ||
**ts-toolbelt** is a collection of types that makes programming with TypeScript even safer. | ||
**ts-toolbelt** is a collection of types that makes TypeScript even **safer**. | ||
It's goal is to improve type correctness while adding a whole new set of | ||
**features** to TypeScript. | ||
It's goal is to ensure type correctness without too much effort from | ||
your part, while adding a whole new set of features to TypeScript. | ||
It uses the type system itself for TypeScript to compute more complex types. In | ||
other words, its API exposes types that trade **CPU & RAM** for higher type | ||
safety. | ||
### How? | ||
**ts-toolbelt** completes TypeScript with a collection of more than **150** | ||
tested types. | ||
**ts-toolbelt** performs complex operations on types. It's API exposes types that will trade your CPU & RAM for a higher type safety. | ||
#### Goals | ||
* This package aims to be the home of all **utility types** | ||
* To keep reasonable **performance**, so it won't bloat TS | ||
* And write software that's more type-safe, more **robust** | ||
* (And bring a whole new set of **features** to TypeScript) | ||
### Demo | ||
## ๐ฉ Features | ||
## Features | ||
Here's some of the most useful features: | ||
Only the most useful features are mentioned here. You will find the complete | ||
list in the [documentation](https://pirix-gh.github.io/ts-toolbelt/) website. | ||
* Merge two types together (doc) | ||
* Update the field of a type (doc) | ||
* Make some fields optional (doc) | ||
* Change a type at any depth! (doc) | ||
* Concat two tuples together (doc) | ||
* Get the last item of a tuple (doc) | ||
* [Merge two types together](https://pirix-gh.github.io/ts-toolbelt/modules/_object_merge_.html#merge) | ||
* [Update the field of a type](https://pirix-gh.github.io/ts-toolbelt/modules/_object_update_.html#update) | ||
* [Make some fields optional](https://pirix-gh.github.io/ts-toolbelt/modules/_object_optional_.html#optional) | ||
* [Change a type at any depth!](https://pirix-gh.github.io/ts-toolbelt/modules/_object_p_update_.html#update) | ||
* [Concat two tuples together](https://pirix-gh.github.io/ts-toolbelt/modules/_tuple_concat_.html#concat) | ||
* [Get the last item of a tuple](https://pirix-gh.github.io/ts-toolbelt/modules/_tuple_last_.html#last) | ||
* ... and so much more | ||
One of the goals of **ts-toolbelt** is to bring all the types one would ever | ||
need to a single package. | ||
<p align="center"> | ||
<img src="https://raw.githubusercontent.com/pirix-gh/ts-toolbelt/master/.github/demo.gif" id="demo"> | ||
<p align="center"> | ||
If you don't find the type you were looking for, please feel welcome to open | ||
> If you don't find the type you are looking for, you are welcome to open | ||
a [feature request](https://github.com/pirix-gh/ts-toolbelt/issues/new?template=---feature-request.md)! | ||
## Getting Started | ||
## ๐ Getting Started | ||
The project is maintained to adapt to the constant changes of TypeScript. See [compatibility](#compatibility) for more information. | ||
#### Prerequisites | ||
### Prerequisites | ||
```sh | ||
@@ -101,3 +103,3 @@ npm install typescript@^3.5.0 --save | ||
### Installation | ||
#### Installation | ||
@@ -108,30 +110,57 @@ ```sh | ||
### Hello World | ||
#### Hello World | ||
```ts | ||
import tb from 'ts-toolbelt' | ||
import {A, B, C, F, I, N, O, S, T, U} from 'ts-toolbelt' | ||
type merged = tb.O.Merge<{name: string}, {age: number}> | ||
// {name: string, age: number} | ||
type concat = tb.T.Concat<['hello'], ['world']> | ||
// ['hello', 'world'] | ||
// Merge two `object` together | ||
type merge = O.Merge<{name: string}, {age?: number}> | ||
``` | ||
## Documentation | ||
## [๐ Documentation โคข](https://pirix-gh.github.io/ts-toolbelt/) | ||
Right above, you might have notices that we've used `O` and `T` to access the | ||
tools. They stand for **O**bject and **T**uple, respectively. And the whole | ||
library is organized the same way, around TypeScript concepts: | ||
The project is organized around TypeScript's main concepts: | ||
- A[ny] | ||
- B[boolean] | ||
- | ||
| | | | | | | ||
|----------------|----------------|-----------------|--------------|-------------| | ||
| **A**(ny) | **C**(lass) | **I**(teration) | **O**(bject) | **T**(uple) | | ||
| **B**(boolean) | **F**(unction) | **N**(umber) | **S**(tring) | **U**(nion) | | ||
https://pirix-gh.github.io/ts-toolbelt/ | ||
## ๐ Contributing | ||
## Contributing | ||
Contributions are what make the open source community such an amazing place to | ||
learn, inspire, and create. Any contributions you make are **greatly appreciated**. | ||
There are many ways to contribute to the project: | ||
## Sponsoring issues | ||
#### Community | ||
* [Help the community with answers on Gitter](https://gitter.im/ts-toolbelt/community?utm_source=share-link&utm_medium=link&utm_campaign=share-link) | ||
* [Reporting bugs or requesting new features](https://github.com/pirix-gh/ts-toolbelt/issues/new/choose) | ||
#### Codebase | ||
* Improving existing documentation | ||
* Add new types to the collection | ||
#### Pull Requests | ||
1. Fork the project | ||
2. Clone your fork | ||
3. Create a pr/**feature** branch | ||
```sh | ||
git checkout -b pr/CoolFeature | ||
``` | ||
4. Commit your changes | ||
```sh | ||
git commit -m 'Added this CoolFeature' | ||
``` | ||
5. Run the tests | ||
6. Commit your changes | ||
```sh | ||
git push origin pr/CoolFeature | ||
``` | ||
7. Open a pull request | ||
## ๐ Sponsoring issues | ||
**Sponsored issues have higher priority over non-critical issues**.<br> | ||
You can either request a new feature or a bug fix then fund it. | ||
<a href="https://issuehunt.io/r/pirix-gh/ts-toolbelt"> | ||
@@ -141,11 +170,52 @@ <img | ||
</a> | ||
<br> | ||
<br> | ||
## Running tests | ||
**The money will be transparently split with an issue's assignees.** | ||
## Compatibility | ||
## ๐ Running tests | ||
## What's next | ||
#### For this project | ||
To run the `lint` & `type` tests, simply run: | ||
## Acknowledgements | ||
```sh | ||
npm test | ||
``` | ||
## Licence | ||
#### For your project | ||
What to test your own types? Get started: | ||
```ts | ||
import {A, B, C, F, I, N, O, S, T, U, Test} from 'ts-toolbelt' | ||
const {checks, check} = Test | ||
checks([ | ||
check<N.Plus<'1', '30'>, '31', Test.Pass>(), | ||
check<N.Plus<'5', '-3'>, '2', Test.Pass>(), | ||
]) | ||
``` | ||
## ๐ง Compatibility | ||
The project is maintained to adapt to the constant | ||
[changes of TypeScript](https://github.com/Microsoft/TypeScript/wiki/Roadmap): | ||
| ts-toolbelt | typescript | | ||
|-------------|------------| | ||
| 1.0.x | 3.5.x | | ||
## ๐ฎ What's next | ||
* Automated performance tests | ||
```sh | ||
# performance is checked manually with | ||
npx tsc --noEmit ----extendedDiagnostics | ||
``` | ||
* Improve with user feedback | ||
## ๐ Acknowledgements | ||
Many, many thanks to all the | ||
[contributors](https://github.com/pirix-gh/ts-toolbelt/graphs/contributors) and: | ||
* [Matt McCutchen](https://github.com/mattmccutchen) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
114649
218
11