Skip to content

Commit

Permalink
Merge pull request #2 from hemengke1997/dts
Browse files Browse the repository at this point in the history
chore: add usage docs and only emit declaration on build
  • Loading branch information
thomas-void0 authored Dec 22, 2023
2 parents fc8c3b8 + 025b48f commit cce2894
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,32 @@

t2t-tools is type conversion tool of typescript.

# install
## Install

```shell
```bash
npm install t2t-tools -D
```

# example
## Usage

Add to a d.ts declaration file
```ts
/// <reference types="t2t-tools" />
```

OR

add `t2t-tools` to `compilerOptions.types` inside tsconfig.json

```json
{
"compilerOptions": {
"types": ["t2t-tools"]
}
}
```

## Example

```ts
import { Merge } from 't2t-tools'
Expand All @@ -18,7 +37,7 @@ type A = Merge<{ a: number; c: boolean }, { a: string; b: number }>
// A = { a: string; b: number; c: boolean }
```

# api
## API

| 方法名 | 解释 |
| :-------------------: | :---------------------------------------------------: |
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
"name": "t2t-tools",
"version": "0.1.1",
"description": "type conversion tool of typescript",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"./dist/*.d.ts"
],
"repository": "https://github.com/thomas-void0/t2t-tools",
"homepage": "https://github.com/thomas-void0/t2t-tools",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"pretty": true,
"removeComments": false,
"sourceMap": false,
"stripInternal": true
"stripInternal": true,
"emitDeclarationOnly": true
}
}

0 comments on commit cce2894

Please sign in to comment.