0.0.11 • Published 2 months ago

typescript-treasure v0.0.11

Weekly downloads
-
License
ISC
Repository
-
Last release
2 months ago

typescript-treasure

Elegant and pragmatic collection of typescript tools

Installation

npm install typescript-treasure -S

Document

中文文档

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

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

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

type SomeFn = <T1, T2>
    (arg1: T1, arg2: T2) =>
    (
        T1 extends any ?
        (
            SomeThing
        )
        :
        (
            SomeThing
        )
    )
0.0.11

2 months ago

0.0.10

6 months ago

0.0.9

7 months ago

0.0.8

7 months ago

0.0.5

7 months ago

0.0.7

7 months ago

0.0.6

7 months ago

0.0.4

8 months ago

0.0.3

8 months ago

0.0.2

9 months ago

0.0.2-dev.2023.8.9

9 months ago

0.0.2-dev.2023.7.26

10 months ago

0.0.1

10 months ago