Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
typescript-treasure
Advanced tools
Elegant and pragmatic collection of typescript tools
npm install typescript-treasure -S
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
)
)
FAQs
Elegant and pragmatic collection of typescript tools
The npm package typescript-treasure receives a total of 242 weekly downloads. As such, typescript-treasure popularity was classified as not popular.
We found that typescript-treasure demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.