@insanedev2478/tstoolset 1.0.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vedansh Shetti
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # 🧰 **tstoolset**
2
+ **Open-source**, **Zero‑runtime** TypeScript **utility types** for cleaner, safer, more expressive code. <br>
3
+ ![npm version](https://img.shields.io/npm/v/@insanedev2478/tstoolset)
4
+ ![license](https://img.shields.io/github/license/vedanshshetti/tstoolset)
5
+
6
+
7
+ ---
8
+
9
+ ## 🚀 Installation
10
+
11
+ ```sh
12
+ npm install @insanedev2478/tstoolset
13
+ ```
14
+
15
+ ---
16
+
17
+ ## ✨ Features
18
+
19
+ - Strong, readable primitive aliases (`String`, `Number`, `Boolean`, etc.)
20
+ - Utility containers (`Obj<T>`, `Arr<T>`, `Func<T>`)
21
+ - Template‑literal types (`UUIDV4`, `TrustableEmail`)
22
+ - Nominal typing with `Brand<T, Name>`
23
+ - Exact object enforcement with `Exact<T>`
24
+ - Safe assertion helper: `convert<T>(x)`
25
+ - Zero runtime cost — pure TypeScript
26
+
27
+ ---
28
+
29
+ ## 📦 Usage
30
+
31
+ ### **Primitive & container helpers**
32
+ ```ts
33
+ import type { String, Obj, Arr } from "@insanedev2478/tstoolset";
34
+
35
+ type User = Obj<String>;
36
+ type Tags = Arr<String>;
37
+ ```
38
+
39
+ ### **Exact object enforcement**
40
+ ```ts
41
+ import type { Exact } from "@insanedev2478/tstoolset";
42
+
43
+ type User = { id: string };
44
+ const u: Exact<User> = { id: "123" }; // ok
45
+ const x: Exact<User> = { id: "123", a: 1 } // ❌ extra key
46
+ ```
47
+
48
+ ### **snake_case to camelCase**
49
+ ```ts
50
+ import type { CamelCase } from "@insanedev2478/tstoolset";
51
+
52
+ type User = { id: string };
53
+ const u: Exact<User> = { id: "123" }; // ok
54
+ const x: Exact<User> = { id: "123", a: 1 } // ❌ extra key
55
+ ```
56
+
57
+ ### **Nominal typing**
58
+ ```ts
59
+ import type { Brand } from "@insanedev2478/tstoolset";
60
+
61
+ type UserId = Brand<string, "UserId">;
62
+
63
+ const id: UserId = "abc" as UserId;
64
+ ```
65
+
66
+ ### **Merge**
67
+ ```ts
68
+ import type { Merge } from "@insanedev2478/tstoolset";
69
+ type A = { id: string; name: string };
70
+ type B = { id: number; admin: boolean };
71
+
72
+ const merged: Merge<A, B> = {
73
+ id: 123, // overridden by B
74
+ name: "John",
75
+ admin: true
76
+ };
77
+
78
+ ```
79
+
80
+ ### **UUID & Email template types**
81
+ ```ts
82
+ import type { UUIDV4, TrustableEmail } from "@insanedev2478/tstoolset";
83
+
84
+ const id: UUIDV4 = "550e8400-e29b-41d4-a716-446655440000";
85
+ const email: TrustableEmail = "user@gmail.com";
86
+ ```
87
+
88
+ ### **Safe converter**
89
+ ```ts
90
+ import { convert } from "@insanedev2478/tstoolset";
91
+
92
+ const fn = convert<(...args: any[]) => void>(() => {});
93
+ ```
94
+
95
+ ---
96
+
97
+ ## 🗺️ Roadmap
98
+
99
+ - Deep utilities (`DeepPartial`, `DeepReadonly`, `DeepRequired`)
100
+ - JSON‑safe types (`JsonValue`, `JsonObject`)
101
+ - String manipulation types (`CamelCase`, `KebabCase`)
102
+ - Schema‑style helpers
103
+ - More branded primitives
104
+
105
+ ---
106
+
107
+ ## 🤝 Contributing
108
+ I am still a 6th grader, so new releases will only be on weekends, but <br>
109
+ issues, ideas, and PRs are welcome — this project is growing fast and feedback helps shape the toolkit.
110
+
111
+ ---
112
+
113
+ ## 📄 License
114
+
115
+ MIT
package/dist/index.d.ts CHANGED
@@ -19,4 +19,17 @@ export type PromiseType<T = any> = Promise<T>;
19
19
  export type UUIDV4 = `${String}-${String}-4${String}-${"8" | "9" | "A" | "B"}${String}-${String}`;
20
20
  type TrustedEmailProviders = "gmail.com" | "yahoo.com" | "yahoo.in" | "outlook.com" | "live.com" | "hotmail.com" | "protonmail.com" | "icloud.com" | "aol.com";
21
21
  export type TrustableEmail = `${String}@${TrustedEmailProviders}`;
22
+ export type Exact<T, U extends T = T> = T & {
23
+ [K in Exclude<keyof U, keyof T>]: never;
24
+ };
25
+ declare const brand: unique symbol;
26
+ export type Brand<T, Name> = T & {
27
+ [brand]: Name;
28
+ };
29
+ type ConvertableTypes = Primitive | Obj | Arr | Func | TrustableEmail | UUIDV4;
30
+ export declare function convert<T extends ConvertableTypes>(x: unknown): T;
31
+ export type Merge<A, B> = {
32
+ [K in keyof A | keyof B]: K extends keyof B ? B[K] : K extends keyof A ? A[K] : never;
33
+ };
34
+ export type CamelCase<S extends string> = S extends `${infer Head}_${infer Tail}` ? `${Head}${CamelCase<Capitalize<Tail>>}` : S;
22
35
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insanedev2478/tstoolset",
3
- "version": "1.0.0",
3
+ "version": "1.3.0",
4
4
  "description": "Collection of handy TypeScript types, ranging from primitives like numbers all the way to UUIDs and Email Addresses. ",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -16,7 +16,8 @@
16
16
  ],
17
17
  "scripts": {
18
18
  "build": "tsc --emitDeclarationOnly --declaration --outDir dist ./src/index.ts",
19
- "prepublishOnly": "npm run build"
19
+ "prepublishOnly": "npm run build",
20
+ "github:commit": "git add . && git commit -m \"Added new script to package.json\""
20
21
  },
21
22
  "keywords": [
22
23
  "typescript",
@@ -29,5 +30,9 @@
29
30
  "type-level",
30
31
  "zero-runtime",
31
32
  "tstoolset"
32
- ]
33
+ ],
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/vedanshshetti/tstoolset.git"
37
+ }
33
38
  }