Skip to content

Commit

Permalink
docs(README): Add Install, Usage, Tip in README (#55)
Browse files Browse the repository at this point in the history
* docs: Add Install, Usage, Tip in readme

* chore: Add keywords
  • Loading branch information
haejunejung authored Aug 28, 2024
1 parent f3cbd14 commit 9cc9a99
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 2 deletions.
49 changes: 48 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="/assets/logo.png" alt="ts-typekit" height=300 />
<img src="assets/logo.png" alt="ts-typekit" height=300 />
<h1 align="center">ts-typekit</h1>
<p align="center">🧰 Collection of TypeScript utility types</p>
<p align="center">
Expand All @@ -20,6 +20,53 @@

Whether you're dealing with complex type transformations, conditional types, or need to enforce specific type constraints, ts-typekit has you covered with a growing collection of utility types that cater to a variety of common and advanced use cases.

## Install

```ts
npm install ts-typekit
yarn add ts-typekit
```

Requires TypeScript >= 5.1

## Usage

```ts
import type { StrictOmit } from 'ts-typekit';

type User = {
id: number;
name: string;
};

type UserWithoutId = StrictOmit<User, 'id'>; // { name: string }
```

## Tip

Recommend working with the **{strict: true}** option in tsconfig.

If your team is using ESLint and wants to enforce the use of **StrictOmit** instead of the standard **Omit**, you can configure ESLint to help catch this. The **@typescript-eslint/ban-types** rule can be configured to display an error message when Omit is used, guiding developers to use StirctOmit instead. Here's how you can set up your ESLint configuration:

```js
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
rules: {
// Include other relevant rules here
'@typescript-eslint/ban-types': [
'error',
{
types: {
Omit: 'Use StrictOmit instead', // write the error message.
},
extendsDefaults: true,
},
],
},
};
```

## Contributing

Read below for detailed contribution guide.
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
"typescript",
"ts",
"tsd",
"types"
"types",
"utility",
"utility-types"
],
"types": "./index.d.ts",
"publishConfig": {
Expand Down

0 comments on commit 9cc9a99

Please sign in to comment.