# typescript-treasure

> Elegant and pragmatic collection of typescript tools

Latest version **0.0.12** (published 2025-05-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install typescript-treasure
pnpm add typescript-treasure
yarn add typescript-treasure
bun add typescript-treasure
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.12 |
| Published | 2025-05-09 |
| First published | 2023-07-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 48.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Autumn-one |
| Maintainers | autumn-one |
| Keywords | typescript, typescript-treasure, ts, tools, types, typesafe |

## Links

- npm: https://www.npmjs.com/package/typescript-treasure
- npm.io page: https://npm.io/package/typescript-treasure

## Alternatives

- [csv-to-markdown-table](https://npm.io/package/csv-to-markdown-table.md) — 47.0K weekly downloads
- [@sapphire/ratelimits](https://npm.io/package/@sapphire/ratelimits.md) — 4.4K weekly downloads
- [js-csvparser](https://npm.io/package/js-csvparser.md) — 2.0K weekly downloads
- [@adadapted/js-sdk](https://npm.io/package/@adadapted/js-sdk.md) — 251 weekly downloads
- [@grapecity/spread-sheets-sparklines](https://npm.io/package/@grapecity/spread-sheets-sparklines.md) — 103 weekly downloads

## Recent versions

- 0.0.12 (latest) — 2025-05-09
- 0.0.2-dev.2023.8.9 (dev) — 2023-08-09
- 0.0.11 — 2024-03-01
- 0.0.10 — 2023-11-14
- 0.0.9 — 2023-10-25
- 0.0.8 — 2023-10-25
- 0.0.7 — 2023-10-25
- 0.0.6 — 2023-10-25
- 0.0.5 — 2023-10-24
- 0.0.4 — 2023-09-26
- 0.0.3 — 2023-09-07
- 0.0.2 — 2023-08-23
- 0.0.2-dev.2023.8.23 — 2023-08-23
- 0.0.2-dev.2023.8.13 — 2023-08-13
- 0.0.2-dev.2023.7.2601 — 2023-07-26
- … 2 more at https://npm.io/package/typescript-treasure/versions

## README

# typescript-treasure

Elegant and pragmatic collection of typescript tools

## Installation
```bash
npm install typescript-treasure -S
```

## Document
<a href="https://autumn-one.github.io/typescript-treasure-doc/" target="_blank">中文文档</a>

## ts type code specification
I call this code specification：**MuGuaTS**（Chinese interpretation：**木瓜TS**）

**All judgment tools are named using If_Xxx**
For example, `If_Num<T>` is a generic tool used to determine if it is a number.

**Short generic tools can be written on one line**

```typescript
type SomeTool<T> =  T extends any ? true : false;
```

**More complex generic tools need to wrap lines after the equal sign and follow the following wording**

```typescript
type ComplexTool<T1, T2> =
    If_NumStr<T1> extends true ?
    (
        If_Includes<T2, 2> extends true ?
        (
            SomeThing
        )
        :
        (
           SomeThing
        )
    )
    :
    (
        SomeThing
    )
```

**The generic parameter part of a generic function should follow the equal sign**

```typescript
type SomeFn = <T1, T2>
    (arg1: T1, arg2: T2) =>
    (
        T1 extends any ?
        (
            SomeThing
        )
        :
        (
            SomeThing
        )
    )
```

---
_Source: https://npm.io/package/typescript-treasure · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
