Registry / type-stubs / typescript-treasure

typescript-treasure

JSON →
library0.0.12jsnpmunverified

A collection of TypeScript type utilities inspired by a coding style called MuGuaTS. Provides generic tools like If_Num, If_Str, If_Bool, If_Arr, If_Obj, If_Nul, If_Und, If_Never, If_Any, If_Unknown, If_Union, If_Equal, If_Includes, If_Some, If_Every, If_Key, If_Val, If_Readonly, If_Optional, If_Required, If_Mutable, If_Writable, If_Fn, If_Tuple, etc. Current stable version 0.0.12. Release cadence is infrequent; appears to be a side project. Differentiators: opinionated naming convention and one-line/multi-line formatting rules aimed at readability.

npm install typescript-treasure
INSTALL
IMPORT
SIG · TYPESCRIPT-TREASUR
T
typescript-treasure
type-stubsjavascriptv0.0.12
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

If_Num
import { If_Num } from 'typescript-treasure'
const { If_Num } = require('typescript-treasure')
Import from 'typescript-treasure'. Use named import.
If_Str
import { If_Str } from 'typescript-treasure'
import If_Str from 'typescript-treasure'
Default export is not provided; use named import.
If_Equal
import { If_Equal } from 'typescript-treasure'
import { IfEqual } from 'typescript-treasure'
Function name uses underscore: If_Equal, not IfEqual.
If_Bool
import { If_Bool } from 'typescript-treasure'
Named import; all utility types start with If_.
If_Arr
import { If_Arr } from 'typescript-treasure'
Named import.

Demonstrates usage of several type utilities: If_Num, If_Str, If_Bool, If_Equal, If_Includes with example types.

import { If_Num, If_Str, If_Bool, If_Equal, If_Includes } from 'typescript-treasure'; type Test1 = If_Num<42>; // true type Test2 = If_Str<'hello'>; // true type Test3 = If_Bool<false>; // true type Test4 = If_Equal<1, 2>; // false type Test5 = If_Includes<[1, 2, 3], 2>; // true
Debug
Known issues
gotchaAll utility types are prefixed with 'If_' and use underscores after 'If'. Incorrect casing (e.g., 'IfNum') will cause type errors.
fix
Use correct names like 'If_Num', 'If_Str'.
affects: >=0.0.1
gotchaPackage is not tree-shakeable in all bundlers due to possible barrel exports; importing unused utilities may increase bundle size in some setups.
fix
Use import destructuring and ensure bundler supports tree shaking (e.g., ES modules).
affects: >=0.0.1
gotchaDocumentation is primarily in Chinese; English docs may be incomplete or missing.
fix
Refer to inline type comments or experiment with the utilities directly.
affects: >=0.0.1
Errors
Common errors & fixes
Cannot find module 'typescript-treasure' or its corresponding type declarations.
Package not installed or not in tsconfig paths.
fix
Run 'npm install typescript-treasure' and ensure 'typescript-treasure' is in node_modules types.
'If_Num' is not exported from 'typescript-treasure'.
Typo or using default import instead of named.
fix
Use import { If_Num } from 'typescript-treasure'.
Type 'If_Num<42>' is not assignable to type 'boolean'.
If_Num returns a type (true/false), not a runtime value.
fix
Use If_Num<42> extends true ? ... : ... pattern.
Upgrade
Version history
0.0.12latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
26 hits · last 30 days
node
20
OpenAI (training)
1
Resources
typescript-treasure — npm install typescript-treasure · libregistry