@kakasoo/deep-strict-types 2.0.5 → 2.0.6

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.
Files changed (36) hide show
  1. package/README.md +141 -267
  2. package/bin/src/functions/DeepStrictAssert.d.ts +19 -0
  3. package/bin/src/functions/DeepStrictAssert.d.ts.map +1 -1
  4. package/bin/src/functions/DeepStrictAssert.js +19 -0
  5. package/bin/src/functions/DeepStrictAssert.js.map +1 -1
  6. package/bin/src/functions/DeepStrictObjectKeys.d.ts +27 -0
  7. package/bin/src/functions/DeepStrictObjectKeys.d.ts.map +1 -1
  8. package/bin/src/functions/DeepStrictObjectKeys.js +20 -0
  9. package/bin/src/functions/DeepStrictObjectKeys.js.map +1 -1
  10. package/bin/src/types/DeepDateToString.d.ts +22 -4
  11. package/bin/src/types/DeepDateToString.d.ts.map +1 -1
  12. package/bin/src/types/DeepStrictMerge.d.ts +11 -0
  13. package/bin/src/types/DeepStrictMerge.d.ts.map +1 -1
  14. package/bin/src/types/DeepStrictObjectKeys.d.ts +4 -3
  15. package/bin/src/types/DeepStrictObjectKeys.d.ts.map +1 -1
  16. package/bin/src/types/DeepStrictObjectLastKeys.d.ts +18 -3
  17. package/bin/src/types/DeepStrictObjectLastKeys.d.ts.map +1 -1
  18. package/bin/src/types/DeepStrictOmit.d.ts +13 -0
  19. package/bin/src/types/DeepStrictOmit.d.ts.map +1 -1
  20. package/bin/src/types/DeepStrictUnbrand.d.ts +13 -0
  21. package/bin/src/types/DeepStrictUnbrand.d.ts.map +1 -1
  22. package/bin/src/types/Equal.d.ts +7 -4
  23. package/bin/src/types/Equal.d.ts.map +1 -1
  24. package/bin/src/types/IsAny.d.ts +11 -6
  25. package/bin/src/types/IsAny.d.ts.map +1 -1
  26. package/bin/src/types/RemoveAfterDot.d.ts +22 -0
  27. package/bin/src/types/RemoveAfterDot.d.ts.map +1 -1
  28. package/bin/src/types/RemoveArraySymbol.d.ts +16 -4
  29. package/bin/src/types/RemoveArraySymbol.d.ts.map +1 -1
  30. package/bin/src/types/RemoveLastProperty.d.ts +21 -0
  31. package/bin/src/types/RemoveLastProperty.d.ts.map +1 -1
  32. package/bin/src/types/StringToDeepObject.d.ts +25 -0
  33. package/bin/src/types/StringToDeepObject.d.ts.map +1 -1
  34. package/bin/src/types/ValueType.d.ts +17 -0
  35. package/bin/src/types/ValueType.d.ts.map +1 -1
  36. package/package.json +1 -1
package/README.md CHANGED
@@ -1,362 +1,236 @@
1
- # DeepStrictTypes Library Documentation
1
+ # @kakasoo/deep-strict-types
2
2
 
3
- - [한국어 설명](./docs/README_KO.md)
3
+ [![npm version](https://img.shields.io/npm/v/@kakasoo/deep-strict-types.svg)](https://www.npmjs.com/package/@kakasoo/deep-strict-types)
4
+ [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)
5
+ [![TypeScript](https://img.shields.io/badge/TypeScript-%3E%3D5.0-blue)](https://www.typescriptlang.org/)
4
6
 
5
- ## Table of Contents
7
+ Type-safe `Pick`, `Omit`, and key extraction for deeply nested TypeScript objects and arrays.
6
8
 
7
- 1. [Introduction](#introduction)
8
- 2. [DeepStrictObjectKeys](#deepstrictobjectkeys)
9
- 3. [DeepStrictOmit](#deepstrictomit)
10
- 4. [DeepStrictPick](#deepstrictpick)
11
- 5. [StringToDeepObject](#stringtodeepobject)
12
- 6. [DeepStrictMerge](#deepstrictmerge)
13
- 7. [DeepDateToString](#deepdatetostring)
14
-
15
- ## Introduction
16
-
17
- DeepStrictTypes is a tool that takes TypeScript’s type manipulation to the next level.
18
- It helps you safely perform tasks like `Omit` and `Pick` even with complex nested objects or arrays.
19
- By addressing the limitations of TypeScript’s built-in utility types, it allows you to easily handle internal keys with strict and precise type inference.
20
-
21
- Key features include:
22
-
23
- - **Safe Nested Key Extraction:** It extracts all keys from within an object, boosting type safety.
24
- - **Precise Type Manipulation:** You can pick or omit only the keys you need even in deeply nested structures, making it easier to work with complex data.
25
- - **Unbranding and Merging:** It removes unnecessary constraints from branded types and safely merges multiple types.
26
- - **Utility Function Support (Experimental):** It even provides runtime functions to further ensure type safety during development.
27
-
28
- Below is a GIF showing an example of how to use the library.
9
+ [한국어 설명](./docs/README_KO.md)
29
10
 
30
11
  ![example](https://github.com/user-attachments/assets/28316425-8302-453e-b238-0c732606e6a7)
31
12
 
32
- ## DeepStrictObjectKeys
33
-
34
- `DeepStrictObjectKeys` extracts all keys from a nested object, preserving its hierarchical structure as a union of string paths.
35
- That means you can access not only top-level keys but also nested keys using dot notation or, for arrays, using `[*]`.
36
-
37
- ### Key Features
13
+ ## Installation
38
14
 
39
- - **Preserves Hierarchy:** It retrieves every key from within an object so you can express paths like "user.address.city".
40
- - **Accurate Type Inference:** Instead of just using `keyof`, it thoroughly infers every nested key for enhanced type safety.
41
- - **Array Support:** For objects within arrays, it uses `[*]` instead of an index, so you cover all elements at once.
42
-
43
- ### Example
15
+ ```bash
16
+ npm install @kakasoo/deep-strict-types
17
+ ```
44
18
 
45
- The following example shows how to extract keys from a nested object using `DeepStrictObjectKeys`.
19
+ ## Quick Start
46
20
 
47
21
  ```typescript
48
- type Example = {
49
- user: {
22
+ import { DeepStrictObjectKeys, DeepStrictPick, DeepStrictOmit } from '@kakasoo/deep-strict-types';
23
+
24
+ type User = {
25
+ id: string;
26
+ profile: {
50
27
  name: string;
51
- address: {
52
- city: string;
53
- zip: number;
54
- };
28
+ age: number;
55
29
  };
30
+ posts: {
31
+ title: string;
32
+ tags: string[];
33
+ }[];
56
34
  };
57
35
 
58
- // Result: "user" | "user.name" | "user.address" | "user.address.city" | "user.address.zip"
59
- type Keys = DeepStrictObjectKeys<Example>;
60
- ```
36
+ // Extract all nested key paths
37
+ type Keys = DeepStrictObjectKeys<User>;
38
+ // "id" | "profile" | "profile.name" | "profile.age" | "posts" | "posts[*].title" | "posts[*].tags"
61
39
 
62
- The library also offers a utility function `deepStrictObjectKeys` based on this type, which works like `Object.keys` but correctly extracts nested paths.
40
+ // Pick only what you need
41
+ type NameOnly = DeepStrictPick<User, 'profile.name'>;
42
+ // { profile: { name: string } }
63
43
 
64
- ```typescript
65
- type Target = { a: 1 }[][];
66
- const keys = deepStrictObjectKeys({} as Target); // Result: ["[*].[*].a"]
44
+ // Remove what you don't need
45
+ type NoAge = DeepStrictOmit<User, 'profile.age'>;
46
+ // { id: string; profile: { name: string }; posts: { title: string; tags: string[] }[] }
67
47
  ```
68
48
 
69
- ## DeepStrictOmit
70
-
71
- `DeepStrictOmit` creates a new type by removing specified keys from a nested object type.
72
- Similar to the built-in `Omit`, it lets you precisely specify key paths—even in nested structures and arrays—to remove unwanted properties.
73
-
74
- ### Key Features
75
-
76
- - **Omit Nested Keys:** You can specify a nested key path like `"user.profile.name"` to remove just that property.
77
- - **Handles Arrays:** It applies the same logic to objects within arrays, so you can remove a key from every element.
78
- - **Accurate Type Inference:** It preserves the rest of the object’s structure and types after omission.
79
- - **Supports Branded Types:** It works safely with branded types, removing unnecessary constraints.
49
+ ## Core Types
80
50
 
81
- ### Example
51
+ ### `DeepStrictObjectKeys<T>`
82
52
 
83
- Below is an example of how to apply `DeepStrictOmit` to both nested objects and objects within arrays.
53
+ Extracts all keys from a nested object as a union of dot-notation string paths. Arrays use `[*]` notation.
84
54
 
85
55
  ```typescript
86
- // Define an example object type
87
56
  type Example = {
88
57
  user: {
89
- id: string;
90
- profile: {
91
- name: string;
92
- age: number;
93
- email: string;
94
- };
95
- posts: {
96
- title: string;
97
- content: string;
98
- meta: {
99
- likes: number;
100
- shares: number;
101
- };
102
- }[];
58
+ name: string;
59
+ address: { city: string; zip: number };
103
60
  };
104
61
  };
105
62
 
106
- // Remove the keys 'user.profile.email' and 'user.posts[*].meta.shares'
107
- type Omitted = DeepStrictOmit<Example, 'user.profile.email' | 'user.posts[*].meta.shares'>;
108
-
109
- /*
110
- Resulting type Omitted:
111
- {
112
- user: {
113
- id: string;
114
- profile: {
115
- name: string;
116
- age: number;
117
- };
118
- posts: {
119
- title: string;
120
- content: string;
121
- meta: {
122
- likes: number;
123
- };
124
- }[];
125
- };
126
- }
127
- */
63
+ type Keys = DeepStrictObjectKeys<Example>;
64
+ // "user" | "user.name" | "user.address" | "user.address.city" | "user.address.zip"
128
65
  ```
129
66
 
130
- In short, with `DeepStrictOmit` you can neatly remove only the keys you want from even the most complex nested objects or arrays.
131
-
132
- ## DeepStrictPick
133
-
134
- `DeepStrictPick` creates a new type by selecting only the specified keys from a nested object type.
135
- It works like the built-in `Pick` but lets you precisely choose key paths—even in nested structures and arrays—so you only get the properties you need.
136
-
137
- ### Key Features
67
+ ```typescript
68
+ type WithArray = { items: { name: string; price: number }[] };
138
69
 
139
- - **Pick Nested Keys:** Specify a nested key path like `"user.profile.name"` to pick only that property.
140
- - **Handles Arrays:** It also works on objects within arrays, allowing you to extract just the desired data.
141
- - **Accurate Type Inference:** It builds a type that only includes the selected properties, enhancing both type safety and readability.
142
- - **Flexible:** You can specify multiple nested keys at once.
70
+ type Keys = DeepStrictObjectKeys<WithArray>;
71
+ // "items" | "items[*].name" | "items[*].price"
72
+ ```
143
73
 
144
- ### Example
74
+ ### `DeepStrictPick<T, K>`
145
75
 
146
- Below is an example of using `DeepStrictPick` on nested objects and arrays.
76
+ Creates a new type by selecting only the specified nested keys, preserving the object structure.
147
77
 
148
78
  ```typescript
149
- // Define an example object type
150
79
  type Example = {
151
80
  user: {
152
81
  id: string;
153
- profile: {
154
- name: string;
155
- age: number;
156
- email: string;
157
- };
158
- posts: {
159
- title: string;
160
- content: string;
161
- meta: {
162
- likes: number;
163
- shares: number;
164
- };
165
- }[];
82
+ profile: { name: string; age: number; email: string };
83
+ posts: { title: string; content: string; meta: { likes: number; shares: number } }[];
166
84
  };
167
85
  };
168
86
 
169
- // Pick only the keys 'user.profile.name' and 'user.posts[*].meta.likes'
170
87
  type Picked = DeepStrictPick<Example, 'user.profile.name' | 'user.posts[*].meta.likes'>;
171
-
172
88
  /*
173
- Resulting type Picked:
174
89
  {
175
90
  user: {
176
- profile: {
177
- name: string;
178
- };
179
- posts: {
180
- meta: {
181
- likes: number;
182
- };
183
- }[];
91
+ profile: { name: string };
92
+ posts: { meta: { likes: number } }[];
184
93
  };
185
94
  }
186
95
  */
187
96
  ```
188
97
 
189
- So, `DeepStrictPick` lets you extract only the properties you want from even the most deeply nested structures.
190
-
191
- ## StringToDeepObject
192
-
193
- `StringToDeepObject` takes a string path in dot notation and generates a nested object type corresponding to that path.
194
- It parses the path string step by step, building a nested object and assigning the desired type to the final property.
98
+ ### `DeepStrictOmit<T, K>`
195
99
 
196
- ### Key Features
197
-
198
- - **Parses Path Strings:** Converts a string like "user.profile.name" into an object where each segment becomes a key.
199
- - **Dynamically Creates Objects:** Automatically builds a nested object based on the path, assigning the specified type at the end.
200
- - **Merges Union Types:** If you pass a union of path strings, it merges the resulting objects into one combined type.
201
- - **Type Safe:** Handles string paths safely within the type system to accurately represent nested structures.
202
-
203
- ### Example
100
+ Creates a new type by removing the specified nested keys.
204
101
 
205
102
  ```typescript
206
- // Example: Assigning a string type to the path 'user.profile.name'
207
- type DeepObj = StringToDeepObject<'user.profile.name', string>;
208
-
103
+ type Omitted = DeepStrictOmit<Example, 'user.profile.email' | 'user.posts[*].meta.shares'>;
209
104
  /*
210
- Resulting type DeepObj:
211
105
  {
212
106
  user: {
213
- profile: {
214
- name: string;
215
- };
107
+ id: string;
108
+ profile: { name: string; age: number };
109
+ posts: { title: string; content: string; meta: { likes: number } }[];
216
110
  };
217
111
  }
218
112
  */
113
+ ```
219
114
 
220
- // Another example: Assigning a number type at the end of a path
221
- type DeepNumberObj = StringToDeepObject<'settings.display.brightness', number>;
115
+ ### `DeepStrictMerge<Target, Source>`
222
116
 
223
- /*
224
- Resulting type DeepNumberObj:
225
- {
226
- settings: {
227
- display: {
228
- brightness: number;
229
- };
230
- };
231
- }
232
- */
117
+ Deeply merges two object types. When both types share a key, `Target` takes precedence.
233
118
 
234
- // Union type example: Two paths merge into one combined object type
235
- type MergedObj = StringToDeepObject<'user.profile.name' | 'user.profile.age', string | number>;
119
+ ```typescript
120
+ type A = { user: { id: string; profile: { name: string } } };
121
+ type B = { user: { profile: { email: string }; settings: { theme: string } } };
236
122
 
123
+ type Merged = DeepStrictMerge<A, B>;
237
124
  /*
238
- Resulting type MergedObj:
239
125
  {
240
126
  user: {
241
- profile: {
242
- name: string;
243
- age: number;
244
- };
127
+ id: string;
128
+ profile: { name: string; email: string };
129
+ settings: { theme: string };
245
130
  };
246
131
  }
247
132
  */
248
133
  ```
249
134
 
250
- In short, `StringToDeepObject` lets you quickly create nested object types from a dot-delimited string, and even merge multiple paths if needed.
135
+ Arrays of objects are also merged element-wise:
251
136
 
252
- ## DeepStrictMerge
253
-
254
- `DeepStrictMerge` deeply merges two or more object types into a single unified type.
255
- It recursively combines every property in nested structures, and when the same key exists in multiple objects, it follows a set of rules to merge them.
256
-
257
- ### Key Features
137
+ ```typescript
138
+ type Merged = DeepStrictMerge<{ a: number }[], { b: string }[]>;
139
+ // { a: number; b: string }[]
140
+ ```
258
141
 
259
- - **Deep Merge:** Recursively merges not only top-level properties but also all nested objects.
260
- - **Accurate Type Inference:** Each object’s type information is retained in the merged result, ensuring type safety.
261
- - **Conflict Resolution:** When the same key exists in multiple objects, it resolves the conflict according to defined rules.
262
- - **Flexible:** You can merge several object types at once, making it easy to manage complex data structures.
142
+ ### `GetType<T, K>`
263
143
 
264
- ### Example
144
+ Extracts the type at a specific nested path.
265
145
 
266
146
  ```typescript
267
- // Define two object types to merge
268
- type ObjA = {
147
+ type Data = {
269
148
  user: {
270
- id: string;
271
- profile: {
272
- name: string;
273
- age: number;
274
- };
149
+ name: string;
150
+ posts: { title: string; tags: string[] }[];
275
151
  };
276
152
  };
277
153
 
278
- type ObjB = {
279
- user: {
280
- profile: {
281
- email: string;
282
- // If both objects have the key 'age', the merge rule applies.
283
- age: number;
284
- };
285
- settings: {
286
- theme: string;
287
- };
288
- };
154
+ type T1 = GetType<Data, 'user.name'>; // string
155
+ type T2 = GetType<Data, 'user.posts'>; // { title: string; tags: string[] }[]
156
+ type T3 = GetType<Data, 'user.posts[*].title'>; // string
157
+ type T4 = GetType<Data, 'user.posts[*].tags'>; // string[]
158
+ ```
159
+
160
+ ### `DeepDateToString<T>`
161
+
162
+ Recursively converts all `Date` types to `string`. Useful for representing serialized/JSON response types.
163
+
164
+ ```typescript
165
+ type Input = {
166
+ createdAt: Date;
167
+ user: { name: string; birthDate: Date };
289
168
  };
290
169
 
291
- // Deep merge the two objects into one type
292
- type Merged = DeepStrictMerge<ObjA, ObjB>;
170
+ type Output = DeepDateToString<Input>;
171
+ // { createdAt: string; user: { name: string; birthDate: string } }
172
+ ```
293
173
 
294
- /*
295
- Resulting type Merged:
296
- {
297
- user: {
298
- id: string;
299
- profile: {
300
- name: string;
301
- age: number; // Merged according to the rules
302
- email: string;
303
- };
304
- settings: {
305
- theme: string;
306
- };
307
- };
308
- }
309
- */
174
+ ### `DeepStrictUnbrand<T>`
175
+
176
+ Recursively removes branding (e.g., `typia` tags like `Format<'uuid'>`) from types, restoring base primitives.
177
+
178
+ ```typescript
179
+ type Branded = {
180
+ id: string & { __brand: 'uuid' };
181
+ profile: { email: string & { __brand: 'email' } };
182
+ };
183
+
184
+ type Clean = DeepStrictUnbrand<Branded>;
185
+ // { id: string; profile: { email: string } }
310
186
  ```
311
187
 
312
- So, `DeepStrictMerge` lets you seamlessly combine different object types into one, even when they have complex nested structures.
188
+ ## Runtime Functions
189
+
190
+ ### `deepStrictObjectKeys(obj)`
313
191
 
314
- ## DeepDateToString
192
+ Runtime counterpart of `DeepStrictObjectKeys`. Returns an array of all dot-notation key paths.
315
193
 
316
- `DeepDateToString` finds every `Date` type in an object and converts it to a `string` recursively.
317
- It locates all `Date` properties—even deep within nested objects or arrays—and converts them to strings, which is especially useful for serialization or JSON conversion.
194
+ ```typescript
195
+ import { deepStrictObjectKeys } from '@kakasoo/deep-strict-types';
318
196
 
319
- ### Key Features
197
+ const keys = deepStrictObjectKeys({ a: { b: 1, c: 2 } });
198
+ // ["a", "a.b", "a.c"]
199
+ ```
320
200
 
321
- - **Recursive Conversion:** It transforms every `Date` type found in the object, including those in nested objects and arrays.
322
- - **Ensures Type Consistency:** By explicitly converting `Date` to `string`, it prevents type mismatches during serialization or API responses.
323
- - **Handles Complex Structures:** Works reliably even with deeply nested objects and arrays containing `Date` values.
201
+ ### `deepStrictAssert(obj)(key)`
324
202
 
325
- ### Example
203
+ Curried runtime function that extracts a specific nested property, preserving the object structure. Type-safe counterpart of `DeepStrictPick`.
326
204
 
327
205
  ```typescript
328
- // Define an example object type
329
- type Example = {
330
- createdAt: Date;
331
- updatedAt: Date;
332
- user: {
333
- name: string;
334
- birthDate: Date;
335
- posts: {
336
- title: string;
337
- publishedAt: Date;
338
- }[];
339
- };
340
- };
206
+ import { deepStrictAssert } from '@kakasoo/deep-strict-types';
341
207
 
342
- // Convert all Date properties to string using DeepDateToString
343
- type StringifiedExample = DeepDateToString<Example>;
208
+ const data = {
209
+ user: { name: 'Alice', age: 30 },
210
+ posts: [{ title: 'Hello', content: 'World' }],
211
+ };
344
212
 
345
- /*
346
- Resulting type StringifiedExample:
347
- {
348
- createdAt: string;
349
- updatedAt: string;
350
- user: {
351
- name: string;
352
- birthDate: string;
353
- posts: {
354
- title: string;
355
- publishedAt: string;
356
- }[];
357
- };
358
- }
359
- */
213
+ const result = deepStrictAssert(data)('user.name');
214
+ // { user: { name: 'Alice' } }
360
215
  ```
361
216
 
362
- In short, `DeepDateToString` makes sure that every `Date` inside an object is converted to a `string`, ensuring type consistency for operations like serialization or JSON conversion.
217
+ ## Utility Types
218
+
219
+ | Type | Description | Example |
220
+ |------|-------------|---------|
221
+ | `DeepStrictObjectLastKeys<T>` | Extracts only the leaf-level (deepest) keys | `"a.b.c"` instead of `"a" \| "a.b" \| "a.b.c"` |
222
+ | `StringToDeepObject<T>` | Converts a comma-separated dot-notation string to a nested object type | `StringToDeepObject<"a.b,c">` = `{ a: { b: any }; c: any }` |
223
+ | `Equal<X, Y>` | Type-level equality check (returns `true` or `false`) | `Equal<string, string>` = `true` |
224
+ | `ElementOf<T>` | Extracts the element type from an array | `ElementOf<string[]>` = `string` |
225
+ | `IsAny<T>` | Checks if a type is `any` | `IsAny<any>` = `true` |
226
+ | `IsUnion<T>` | Checks if a type is a union | `IsUnion<string \| number>` = `true` |
227
+ | `ValueType` | Union of all primitive types + `Date` | `string \| number \| boolean \| ...` |
228
+ | `GetMember<T, Prefix>` | Extracts key segments after a dot-notation prefix | Internal helper for `DeepStrictOmit` |
229
+ | `GetElementMember<T, Prefix>` | Extracts array element sub-keys after a `[*]` prefix | Internal helper for `DeepStrictOmit` |
230
+ | `RemoveAfterDot<T, K>` | Generates wildcard patterns for descendant keys | Internal helper for `DeepStrictPick` |
231
+ | `RemoveArraySymbol<T>` | Strips `[*]` suffix from a key string | `RemoveArraySymbol<"items[*]">` = `"items"` |
232
+ | `RemoveLastProperty<T>` | Extracts all parent path segments | `RemoveLastProperty<"a.b.c">` = `"a" \| "a.b"` |
233
+
234
+ ## License
235
+
236
+ ISC
@@ -1,4 +1,23 @@
1
1
  import { DeepStrictObjectKeys } from '../types/DeepStrictObjectKeys';
2
2
  import { DeepStrictPick } from '../types/DeepStrictPick';
3
+ /**
4
+ * @title Runtime Function for Type-Safe Deep Property Extraction.
5
+ *
6
+ * A curried function that takes an object and returns a picker function.
7
+ * The picker function accepts a dot-notation key path and returns a new object
8
+ * containing only the specified nested property, preserving the original structure.
9
+ *
10
+ * This is the runtime counterpart of the {@link DeepStrictPick} type.
11
+ *
12
+ * @template T - The object type of the input
13
+ * @param input - The source object to extract properties from
14
+ * @returns A function that accepts a key path `K` and returns the deeply-picked result
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const result = deepStrictAssert({ a: { b: 1, c: 2 } })('a.b');
19
+ * // result: { a: { b: 1 } }
20
+ * ```
21
+ */
3
22
  export declare const deepStrictAssert: <T extends object>(input: T) => <K extends DeepStrictObjectKeys<T>>(key: K) => DeepStrictPick<T, K>;
4
23
  //# sourceMappingURL=DeepStrictAssert.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DeepStrictAssert.d.ts","sourceRoot":"","sources":["../../../src/functions/DeepStrictAssert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,eAAO,MAAM,gBAAgB,GAC1B,CAAC,SAAS,MAAM,SAAS,CAAC,MAC1B,CAAC,SAAS,oBAAoB,CAAC,CAAC,CAAC,OAAO,CAAC,KAAG,cAAc,CAAC,CAAC,EAAE,CAAC,CAiC/D,CAAC"}
1
+ {"version":3,"file":"DeepStrictAssert.d.ts","sourceRoot":"","sources":["../../../src/functions/DeepStrictAssert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,gBAAgB,GAC1B,CAAC,SAAS,MAAM,SAAS,CAAC,MAC1B,CAAC,SAAS,oBAAoB,CAAC,CAAC,CAAC,OAAO,CAAC,KAAG,cAAc,CAAC,CAAC,EAAE,CAAC,CAiC/D,CAAC"}
@@ -1,6 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deepStrictAssert = void 0;
4
+ /**
5
+ * @title Runtime Function for Type-Safe Deep Property Extraction.
6
+ *
7
+ * A curried function that takes an object and returns a picker function.
8
+ * The picker function accepts a dot-notation key path and returns a new object
9
+ * containing only the specified nested property, preserving the original structure.
10
+ *
11
+ * This is the runtime counterpart of the {@link DeepStrictPick} type.
12
+ *
13
+ * @template T - The object type of the input
14
+ * @param input - The source object to extract properties from
15
+ * @returns A function that accepts a key path `K` and returns the deeply-picked result
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const result = deepStrictAssert({ a: { b: 1, c: 2 } })('a.b');
20
+ * // result: { a: { b: 1 } }
21
+ * ```
22
+ */
4
23
  const deepStrictAssert = (input) => (key) => {
5
24
  const keys = key.split(/(?:\[\*\])?\./g).filter(Boolean);
6
25
  const traverse = (input, keys) => {
@@ -1 +1 @@
1
- {"version":3,"file":"DeepStrictAssert.js","sourceRoot":"","sources":["../../../src/functions/DeepStrictAssert.ts"],"names":[],"mappings":";;;AAGO,MAAM,gBAAgB,GAC3B,CAAmB,KAAQ,EAAE,EAAE,CAC/B,CAAoC,GAAM,EAAwB,EAAE;IAClE,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAEzD,MAAM,QAAQ,GAAG,CAAC,KAAkD,EAAE,IAAc,EAAO,EAAE;QAC3F,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;QAE9B,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;gBACrC,IAAI,KAAK,IAAI,OAAO,EAAE,CAAC;oBACrB,IAAI,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;wBAClE,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC;oBACrD,CAAC;oBAED,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBACrC,CAAC;gBAED,OAAO,OAAO,CAAC;YACjB,CAAC,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,IAAI,KAAK,IAAI,KAAK,EAAE,CAAC;gBACnB,IAAI,OAAO,KAAK,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AC,KAAK,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC;oBACrD,CAAC;oBAED,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBACrC,CAAC;gBAED,OAAO,OAAO,CAAC;YACjB,CAAC,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,IAAI,KAAK,IAAI,KAAK,EAAE,CAAC;gBACnB,IAAI,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,QAAQ,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;oBAC9D,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC;gBACnD,CAAC;gBACD,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YACnC,CAAC;YAED,MAAM,IAAI,KAAK,CAAC,2BAA2B,KAAK,EAAE,CAAC,CAAC;QACtD,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAyB,CAAC;AACvD,CAAC,CAAC;AAnCS,QAAA,gBAAgB,oBAmCzB"}
@@ -1,6 +1,13 @@
1
1
  import { DeepStrictObjectKeys } from '../types';
2
+ /** @internal Removes a leading dot from a string type. e.g., `".foo"` becomes `"foo"`. */
2
3
  type RemoveStartWithDot<T extends string> = T extends `.${infer R extends string}` ? R : T;
4
+ /** @internal Replaces all `[*]` array notation with `${number}` for runtime key path access. */
3
5
  type Replace<S extends string> = S extends '[*]' ? `${number}` : S extends `[*].${infer Rest}` ? `${number}.${Replace<Rest>}` : S extends `${infer Prefix extends string}.[*]${infer Rest}` ? `${Prefix}.${number}${Replace<Rest>}` : S extends `${infer Prefix extends string}[*]${infer Rest}` ? `${Prefix}.${number}${Replace<Rest>}` : S;
6
+ /**
7
+ * @internal The return type for {@link deepStrictObjectKeys}.
8
+ * Converts type-level keys (with `[*]` notation) to runtime-friendly keys (with `${number}` notation),
9
+ * strips leading dots, and wraps the result in an array type.
10
+ */
4
11
  type ReturnType<Target extends object, Joiner extends {
5
12
  array: string;
6
13
  object: string;
@@ -8,6 +15,26 @@ type ReturnType<Target extends object, Joiner extends {
8
15
  array: '[*]';
9
16
  object: '.';
10
17
  }> = [Target] extends [never] ? [] : RemoveStartWithDot<Replace<DeepStrictObjectKeys<Target, Joiner, false>>>[];
18
+ /**
19
+ * @title Runtime Function for Extracting All Nested Keys from an Object.
20
+ *
21
+ * Recursively traverses the input object and returns a flat array of all key paths
22
+ * using dot notation. Nested objects produce paths like `"a.b.c"`, and arrays produce
23
+ * indexed paths at runtime.
24
+ *
25
+ * This is the runtime counterpart of the {@link DeepStrictObjectKeys} type.
26
+ *
27
+ * @template Target - The object type to extract keys from
28
+ * @template Joiner - Separator symbols (defaults to `{ array: '[*]', object: '.' }`)
29
+ * @param target - The object instance to extract keys from
30
+ * @returns An array of all dot-notation key paths in the object
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const keys = deepStrictObjectKeys({ a: { b: 1, c: 2 } });
35
+ * // keys: ["a", "a.b", "a.c"]
36
+ * ```
37
+ */
11
38
  export declare function deepStrictObjectKeys<Target extends object, Joiner extends {
12
39
  array: string;
13
40
  object: string;
@@ -1 +1 @@
1
- {"version":3,"file":"DeepStrictObjectKeys.d.ts","sourceRoot":"","sources":["../../../src/functions/DeepStrictObjectKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,KAAK,kBAAkB,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,IAAI,MAAM,CAAC,SAAS,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;AAE3F,KAAK,OAAO,CAAC,CAAC,SAAS,MAAM,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C;IAAC,MAAM,EAAE,GAAG,CAAA;CAAE,EAChF,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAqB5C"}
@@ -1,6 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deepStrictObjectKeys = deepStrictObjectKeys;
4
+ /**
5
+ * @title Runtime Function for Extracting All Nested Keys from an Object.
6
+ *
7
+ * Recursively traverses the input object and returns a flat array of all key paths
8
+ * using dot notation. Nested objects produce paths like `"a.b.c"`, and arrays produce
9
+ * indexed paths at runtime.
10
+ *
11
+ * This is the runtime counterpart of the {@link DeepStrictObjectKeys} type.
12
+ *
13
+ * @template Target - The object type to extract keys from
14
+ * @template Joiner - Separator symbols (defaults to `{ array: '[*]', object: '.' }`)
15
+ * @param target - The object instance to extract keys from
16
+ * @returns An array of all dot-notation key paths in the object
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const keys = deepStrictObjectKeys({ a: { b: 1, c: 2 } });
21
+ * // keys: ["a", "a.b", "a.c"]
22
+ * ```
23
+ */
4
24
  function deepStrictObjectKeys(target) {
5
25
  let joiner = { array: '[*]', object: '.' };
6
26
  if (joiner === undefined) {
@@ -1 +1 @@
1
- {"version":3,"file":"DeepStrictObjectKeys.js","sourceRoot":"","sources":["../../../src/functions/DeepStrictObjectKeys.ts"],"names":[],"mappings":";;AAmBA,oDAwBC;AAxBD,SAAgB,oBAAoB,CAGlC,MAAc;IACd,IAAI,MAAM,GAAW,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAY,CAAC;IAC7D,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAY,CAAC;IACnD,CAAC;IAED,MAAM,QAAQ,GAAG,EAAE,CAAC;IACpB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,C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AAI,MAAM,EAAE,CAAC;YAClB,MAAM,KAAK,GAAI,MAAc,CAAC,GAAG,CAAC,CAAC;YACnC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBAChD,MAAM,QAAQ,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,EAAE,EAAE,CAAC,CAAC;gBACzE,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,CAA+B,CAAC;AACrE,CAAC"}
@@ -1,10 +1,28 @@
1
1
  import { DeepStrictUnbrand } from './DeepStrictUnbrand';
2
2
  /**
3
- * A utility type that recursively converts all `Date` types within a nested object or array to `string`.
3
+ * @title Type for Recursively Converting All Date Types to String.
4
4
  *
5
- * - If `T` is an array of objects, the type processes each element recursively.
6
- * - If `T` is a `Date`, it is converted to `string`.
7
- * - If `T` is an object, each key is checked recursively for `Date` types or nested objects.
5
+ * A utility type that recursively traverses a nested object or array type and converts
6
+ * every `Date` type to `string`. This is useful for representing serialized forms of objects
7
+ * where dates are transmitted as ISO strings (e.g., JSON responses from APIs).
8
+ *
9
+ * Conversion rules:
10
+ * - If `T` is an array of objects, each element is processed recursively.
11
+ * - If `T` is a `Date`, it becomes `string`.
12
+ * - If `T` is an object, each property is checked: `Date` properties become `string`,
13
+ * nested objects are recursed into, and primitives are preserved as-is.
14
+ * - Union types containing `Date` (e.g., `Date | null`) have only the `Date` portion converted.
15
+ * - Branded types are unbranded via {@link DeepStrictUnbrand} before recursion.
16
+ *
17
+ * @template T - The object type to convert
18
+ * @returns A new type with all `Date` occurrences replaced by `string`
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * type Ex1 = DeepDateToString<{ created: Date; name: string }>; // { created: string; name: string }
23
+ * type Ex2 = DeepDateToString<{ items: { date: Date }[] }>; // { items: { date: string }[] }
24
+ * type Ex3 = DeepDateToString<{ prop: Date | null }>; // { prop: string | null }
25
+ * ```
8
26
  */
9
27
  export type DeepDateToString<T extends object> = DeepStrictUnbrand<T> extends Array<infer I extends object> ? Array<DeepDateToString<I>> : T extends Date ? string : {
10
28
  [K in keyof T]: T[K] extends infer I ? I extends Date ? string : DeepStrictUnbrand<I> extends object ? DeepDateToString<DeepStrictUnbrand<I>> : I : never;
@@ -1 +1 @@
1
- {"version":3,"file":"DeepDateToString.d.ts","sourceRoot":"","sources":["../../../src/types/DeepDateToString.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,IAC3C,iBAAiB,CAAC,CAAC,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,SAAS,MAAM,CAAC,GACtD,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAC1B,CAAC,SAAS,IAAI,GACZ,MAAM,GACN;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,GAChC,CAAC,SAAS,IAAI,GACZ,MAAM,GACN,iBAAiB,CAAC,CAAC,CAAC,SAAS,MAAM,GACjC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,GACtC,CAAC,GACL,KAAK;CACV,CAAC"}
1
+ {"version":3,"file":"DeepDateToString.d.ts","sourceRoot":"","sources":["../../../src/types/DeepDateToString.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,IAC3C,iBAAiB,CAAC,CAAC,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,SAAS,MAAM,CAAC,GACtD,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAC1B,CAAC,SAAS,IAAI,GACZ,MAAM,GACN;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,GAChC,CAAC,SAAS,IAAI,GACZ,MAAM,GACN,iBAAiB,CAAC,CAAC,CAAC,SAAS,MAAM,GACjC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,GACtC,CAAC,GACL,KAAK;CACV,CAAC"}
@@ -25,6 +25,17 @@ declare namespace DeepStrictMerge {
25
25
  * 2. For array types, if both `Target` and `Source` are arrays and their elements are objects, those elements are merged.
26
26
  * - If the elements of the arrays are not objects, merging is not possible.
27
27
  * 3. If only one of the types is an array, merging is not possible.
28
+ *
29
+ * @template Target - The primary object type. Its values take precedence on overlapping keys.
30
+ * @template Source - The secondary object type whose unique keys are added to the result.
31
+ * @returns A deeply merged object type combining `Target` and `Source`
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * type Ex1 = DeepStrictMerge<{ a: 1 }, { b: 2 }>; // { a: 1; b: 2 }
36
+ * type Ex2 = DeepStrictMerge<{ a: { b: 1 } }, { a: { c: 2 } }>; // { a: { b: 1; c: 2 } }
37
+ * type Ex3 = DeepStrictMerge<{ a: 1 }, { a: 2 }>; // { a: 1 } (Target wins)
38
+ * ```
28
39
  */
29
40
  export type DeepStrictMerge<Target extends object, Source extends object> = Target extends Array<infer TE extends object> ? Source extends Array<infer PE extends object> ? DeepStrictMerge.Infer<TE, PE>[] : never : DeepStrictMerge.Infer<Target, Source>;
30
41
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"DeepStrictMerge.d.ts","sourceRoot":"","sources":["../../../src/types/DeepStrictMerge.ts"],"names":[],"mappings":"AAAA,kBAAU,eAAe,CAAC;IACxB;;;;;;;;;;OAUG;IACH,KAAY,KAAK,CAAC,MAAM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AG,CAAC,SAAS,MAAM,GACxB,MAAM,CAAC,GAAG,CAAC,SAAS,KAAK,CAAC,MAAM,EAAE,SAAS,MAAM,CAAC,GAChD,MAAM,CAAC,GAAG,CAAC,SAAS,KAAK,CAAC,MAAM,EAAE,SAAS,MAAM,CAAC,GAChD,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,GACpB,KAAK,GACP,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,GACjC,MAAM,CAAC,GAAG,CAAC,GACb,MAAM,CAAC,GAAG,CAAC,GACb,MAAM,CAAC,GAAG,CAAC,GACb,KAAK;KACZ,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,eAAe,CAAC,MAAM,SAAS,MAAM,EAAE,MAAM,SAAS,MAAM,IACtE,MAAM,SAAS,KAAK,CAAC,MAAM,EAAE,SAAS,MAAM,CAAC,GACzC,MAAM,SAAS,KAAK,CAAC,MAAM,EAAE,SAAS,MAAM,CAAC,GAC3C,eAAe,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,GAC/B,KAAK,GACP,eAAe,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC"}
@@ -30,9 +30,10 @@ declare namespace DeepStrictObjectKeys {
30
30
  * type Example1 = DeepStrictObjectKeys<{ a: { b: 1; c: 2 } }>; // "a" | "a.b" | "a.c"
31
31
  * type Example2 = DeepStrictObjectKeys<{ a: { b: 1; c: { d: number }[] } }>; // "a" | "a.b" | "a.c" | "a.c[*].d"
32
32
  * ```
33
- * @template Target Destination type for which you want to pull a key
34
- * @template Joiner It means what symbol to connect when recursively spinning superimposed types.
35
- * @template IsSafe When a key is a combination type of a primitive type and an object, it means whether to perform a recursive search or not.
33
+ * @template Target - The object type to extract nested keys from
34
+ * @template Joiner - Defines the separator symbols for joining nested paths. `array` is used for array access (default `'[*]'`), `object` is used for object access (default `'.'`).
35
+ * @template IsSafe - When `true`, stops at union types that mix primitives and objects without recursing into them. When `false`, recursively explores all branches of such union types.
36
+ * @returns A union of all dot-notation key paths in `Target`
36
37
  */
37
38
  export type DeepStrictObjectKeys<Target extends object, Joiner extends {
38
39
  array: string;
@@ -1 +1 @@
1
- {"version":3,"file":"DeepStrictObjectKeys.d.ts","sourceRoot":"","sources":["../../../src/types/DeepStrictObjectKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,kBAAU,oBAAoB,CAAC;IAC7B;;;;;;OAMG;IACH,KAAY,KAAK,CACf,MAAM,SAAS,MAAM,EACrB,MAAM,SAAS;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,MAAM,EAAE,GAAG,CAAA;KAAE,EAChF,MAAM,SAAS,OAAO,GAAG,IAAI,EAC7B,CAAC,SAAS,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,MAAM,EAAE,MAAM,EAAE,CAAC,IACtD,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,GACxB,KAAK,GACL,CAAC,SAAS,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GAC7B,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,IAAI,GAC9B,CAAC,GAEC,CAAC,GACC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,GACtB,CAAC,SAAS,SAAS,GACjB,CAAC,GACD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MAAM,GAEpB,AADA,0EAA0E;AAC1E,MAAM,CAAC,OAAO,CAAC,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAEvF,MAAM,CAAC,OAAO,CAAC,GACnB,iBAAiB,CAAC,MAAM,CAAC,SAAS,SAAS,CAAC,MAAM,OAAO,CAAC,EAAE,GAC1D,KAAK,CAAC,OAAO,CAAC,SAAS,IAAI,GACzB,MAAM,CAAC,OAAO,CAAC,GACf,OAAO,SAAS,MAAM,GACpB,MAAM,CAAC,OAAO,CAAC,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GACvF,MAAM,CAAC,OAAO,CAAC,GAEnB,oBAAoB,CAAC,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC"}
@@ -3,6 +3,16 @@ import type { IsAny } from './IsAny';
3
3
  import type { IsUnion } from './IsUnion';
4
4
  import type { ValueType } from './ValueType';
5
5
  declare namespace DeepStrictObjectLastKeys {
6
+ /**
7
+ * @internal Recursively extracts only the leaf-level (last) keys from a nested object type.
8
+ *
9
+ * Unlike {@link DeepStrictObjectKeys.Infer}, this type skips intermediate keys and only
10
+ * returns the deepest reachable paths. Union-typed properties are treated as leaf keys.
11
+ *
12
+ * @template T - The object type to extract leaf keys from
13
+ * @template Joiner - Separator symbols for array and object paths
14
+ * @template P - The current property keys being processed
15
+ */
6
16
  type Infer<T extends object, Joiner extends {
7
17
  array: string;
8
18
  object: string;
@@ -20,10 +30,15 @@ declare namespace DeepStrictObjectLastKeys {
20
30
  * - For arrays, it appends array indices (`[*]`) followed by the key of the element.
21
31
  * - For objects, it recursively traverses the nested structure and appends the last level keys.
22
32
  *
23
- * Example Usage:
33
+ * @template T - The object type to extract leaf keys from
34
+ * @template Joiner - Defines the separator symbols for joining nested paths. `array` is used for array access (default `'[*]'`), `object` is used for object access (default `'.'`).
35
+ * @template P - The property keys of `T` to iterate over (defaults to `keyof T`)
36
+ * @returns A union of dot-notation strings representing only the deepest (leaf) keys in `T`
37
+ *
38
+ * @example
24
39
  * ```ts
25
- * type Example1 = DeepStrictObjectLastKeys<{ a: { b: { c: number[] } } }>; // "a.b.c"
26
- * type Example2 = DeepStrictObjectLastKeys<{ a: { b: number[]; c: { d: string }[] } }>; // "a.b" | "a.c" | "a.c[*].d"
40
+ * type Ex1 = DeepStrictObjectLastKeys<{ a: { b: { c: number[] } } }>; // "a.b.c"
41
+ * type Ex2 = DeepStrictObjectLastKeys<{ a: { b: number[]; c: { d: string }[] } }>; // "a.b" | "a.c[*].d"
27
42
  * ```
28
43
  */
29
44
  export type DeepStrictObjectLastKeys<T extends object, Joiner extends {
@@ -1 +1 @@
1
- {"version":3,"file":"DeepStrictObjectLastKeys.d.ts","sourceRoot":"","sources":["../../../src/types/DeepStrictObjectLastKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,kBAAU,wBAAwB,CAAC;IACjC,KAAY,KAAK,CACf,CAAC,SAAS,MAAM,EAChB,MAAM,SAAS;QACb,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG;QACF,KAAK,EAAE,KAAK,CAAC;QACb,MAAM,EAAE,GAAG,CAAC;KACb,EACD,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,CAAC,IACzB,CAAC,SAAS,MAAM,GAChB,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GACxB,CAAC,GACD,CAAC,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,CAAC,GAChC,CAAC,GACD,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAChC,KAAK,GACL,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,GACnD,KAAK,GACf,KAAK,CAAC;CACX;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,wBAAwB,CAClC,CAAC,SAAS,MAAM,EAChB,MAAM,SAAS;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG;IACjD,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,GAAG,CAAC;CACb,EACD,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,CAAC,IAE3B,iBAAiB,CAAC,CAAC,CAAC,SAAS,KAAK,CAAC,MAAM,OAAO,CAAC,GAC7C,OAAO,SAAS,MAAM,GACpB,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,wBAAwB,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,GACjE,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,GAC1B,wBAAwB,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,MAAM,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -1,6 +1,19 @@
1
1
  import type { DeepStrictObjectKeys } from './DeepStrictObjectKeys';
2
2
  import type { GetElementMember } from './GetMember';
3
3
  declare namespace DeepStrictOmit {
4
+ /**
5
+ * @internal Recursively omits keys from a non-array object type.
6
+ *
7
+ * Handles three cases for each property:
8
+ * - Array of objects: recurses into array elements using {@link GetElementMember} to extract sub-keys
9
+ * - Object (non-Date): recurses into the nested object
10
+ * - Primitive / Date / array of primitives: preserves as-is
11
+ *
12
+ * Top-level keys that exactly match `K` are removed via the `as` clause.
13
+ *
14
+ * @template T - The object type to omit keys from
15
+ * @template K - The dot-notation key paths to omit (must be valid keys of `T`)
16
+ */
4
17
  type Infer<T extends object, K extends DeepStrictObjectKeys<T>> = [K] extends [never] ? T : {
5
18
  [key in keyof T as key extends K ? never : key]: T[key] extends Array<infer Element extends object> ? key extends string ? Element extends Date ? Array<Element> : GetElementMember<K, key> extends DeepStrictObjectKeys<Element> ? Array<Infer<Element, GetElementMember<K, key>>> : Array<Element> : never : T[key] extends Array<infer Element> ? Array<Element> : T[key] extends object ? key extends string ? T[key] extends Date ? T[key] : GetElementMember<K, key> extends DeepStrictObjectKeys<T[key]> ? Infer<T[key], GetElementMember<K, key>> : T[key] : never : T[key];
6
19
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DeepStrictOmit.d.ts","sourceRoot":"","sources":["../../../src/types/DeepStrictOmit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,kBAAU,cAAc,CAAC;IACvB,KAAY,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GACxF,CAAC,GACD;SACG,GAAG,IAAI,MAAM,CAAC,IAAI,GAAG,SAAS,CAAC,GAAG,KAAK,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,SAAS,KAAK,CAAC,MAAM,OAAO,SAAS,MAAM,CAAC,GAC/F,GAAG,SAAS,MAAM,GAChB,OAAO,SAAS,IAAI,GAClB,KAAK,CAAC,OAAO,CAAC,GACd,gBAAgB,CAAC,CAAC,EAAE,GAAG,CAAC,SAAS,oBAAoB,CAAC,OAAO,CAAC,GAC5D,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC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,CAAC,CAAC,CAAC,IAC5E,CAAC,SAAS,KAAK,CAAC,MAAM,OAAO,SAAS,MAAM,CAAC,GACzC,KAAK,CACH,cAAc,CACZ,OAAO,EACP,gBAAgB,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,oBAAoB,CAAC,OAAO,CAAC,GAAG,gBAAgB,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,CAChG,CACF,GACD,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC"}
@@ -1,5 +1,18 @@
1
1
  declare namespace DeepStrictUnbrand {
2
+ /**
3
+ * @internal Union of all JavaScript primitive types.
4
+ * Used to detect branded primitives (primitives intersected with `Record<any, any>`).
5
+ */
2
6
  type Primitive = string | number | boolean | symbol | null | undefined;
7
+ /**
8
+ * @internal Strips branding from a single branded primitive type.
9
+ *
10
+ * A "branded primitive" is a type like `string & { __brand: 'email' }`.
11
+ * This type pattern-matches the base primitive and returns it without the brand.
12
+ *
13
+ * @template T - A branded primitive type (must extend both `Primitive` and `Record<any, any>`)
14
+ * @returns The underlying primitive type with branding removed
15
+ */
3
16
  type Infer<T extends Primitive & Record<any, any>> = T extends string & Record<any, any> ? string : T extends number & Record<any, any> ? number : T extends boolean & Record<any, any> ? boolean : T extends symbol & Record<any, any> ? symbol : T extends null & Record<any, any> ? null : T extends undefined & Record<any, any> ? undefined : T;
4
17
  }
5
18
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"DeepStrictUnbrand.d.ts","sourceRoot":"","sources":["../../../src/types/DeepStrictUnbrand.ts"],"names":[],"mappings":"AAAA,kBAAU,iBAAiB,CAAC;IAC1B,KAAY,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC9E,KAAY,KAAK,CAAC,CAAC,SAAS,SAAS,GAAG,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,MAAM,C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performs a strict equality check that distinguishes between:
16
- * - `any` vs other types
17
- * - `unknown` vs other types
18
16
  * - Union types with different members
19
17
  * - Branded types vs their base types
18
+ * - Optional vs required properties
19
+ *
20
+ * **Known limitation:** Due to how TypeScript resolves `any` in generic function signatures,
21
+ * `Equal<any, T>` returns `true` for any `T`. This means `any` cannot be distinguished
22
+ * from specific types using this approach.
20
23
  *
21
24
  * @template X - The first type to compare
22
25
  * @template Y - The second type to compare
@@ -30,8 +33,8 @@ type Expression<X> = <T>() => T extends X ? 1 : 2;
30
33
  * type Test4 = Equal<string | number, number | string>; // true (order doesn't matter)
31
34
  * type Test5 = Equal<{ a: string }, { a: string }>; // true
32
35
  * type Test6 = Equal<{ a: string }, { a: string; b?: string }>; // false
33
- * type Test7 = Equal<any, string>; // false
34
- * type Test8 = Equal<unknown, any>; // false
36
+ * type Test7 = Equal<any, string>; // true (known limitation)
37
+ * type Test8 = Equal<unknown, any>; // true (known limitation)
35
38
  * type Test9 = Equal<string & { __brand: 'ID' }, string>; // false (branded types)
36
39
  * ```
37
40
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Equal.d.ts","sourceRoot":"","sources":["../../../src/types/Equal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC"}
1
+ {"version":3,"file":"Equal.d.ts","sourceRoot":"","sources":["../../../src/types/Equal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC"}
@@ -1,14 +1,19 @@
1
1
  /**
2
- * @title Type for checking if a type is `any`.
2
+ * @title Type for Checking if a Type is `any`.
3
3
  *
4
- * This type uses a conditional check to determine if the provided type `T` is `any`.
5
- * - It works by checking if the type `T` extends from a condition that results in `true` when `T` is `any`, and `false` otherwise.
6
- * - If `T` is `any`, it resolves to `true`, otherwise it resolves to `false`.
4
+ * Determines whether the provided type `T` is `any`. It leverages the fact that `any`
5
+ * is the only type where `0 extends 1 & T` evaluates to `true`, because `1 & any` collapses
6
+ * to `any`, and `0 extends any` is always true.
7
7
  *
8
- * Example usage:
9
- * ```ts
8
+ * @template T - The type to check
9
+ * @returns `true` if `T` is `any`, `false` otherwise
10
+ *
11
+ * @example
12
+ * ```typescript
10
13
  * type Test1 = IsAny<any>; // true
11
14
  * type Test2 = IsAny<string>; // false
15
+ * type Test3 = IsAny<unknown>; // false
16
+ * type Test4 = IsAny<never>; // false
12
17
  * ```
13
18
  */
14
19
  export type IsAny<T> = 0 extends 1 & T ? true : false;
@@ -1 +1 @@
1
- {"version":3,"file":"IsAny.d.ts","sourceRoot":"","sources":["../../../src/types/IsAny.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC"}
1
+ {"version":3,"file":"IsAny.d.ts","sourceRoot":"","sources":["../../../src/types/IsAny.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC"}
@@ -1,3 +1,25 @@
1
1
  import { ElementOf } from './ElementOf';
2
+ /**
3
+ * @title Type for Generating Wildcard Patterns for Descendant Keys.
4
+ *
5
+ * A helper type used by {@link DeepStrictPick} to generate string patterns that match
6
+ * all keys below a given path in a nested object. This allows `DeepStrictPick` to preserve
7
+ * child properties when selecting a parent key.
8
+ *
9
+ * For object properties, it produces `"key.${string}"` patterns.
10
+ * For array properties, it produces `"key[*].${string}"` patterns.
11
+ * The type recurses through the object structure following the key path `K`.
12
+ *
13
+ * @template T - The object type to traverse
14
+ * @template K - The key path to generate descendant patterns for
15
+ * @returns A template literal type matching all descendant keys, or `never` if the path is invalid
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * type Ex1 = RemoveAfterDot<{ a: { b: number } }, "a">; // `a.${string}`
20
+ * type Ex2 = RemoveAfterDot<{ items: { name: string }[] }, "items">; // `items[*].${string}`
21
+ * type Ex3 = RemoveAfterDot<{ a: { b: { c: number } } }, "a.b">; // `a.b.${string}`
22
+ * ```
23
+ */
2
24
  export type RemoveAfterDot<T extends object, K extends string> = K extends `${infer First}.${infer Last}` ? First extends keyof T ? T[First] extends Array<any> ? `${First}[*].${string}` : T[First] extends object ? `${First}.${RemoveAfterDot<T[First], Last>}` : never : First extends '[*]' ? T extends Array<any> ? RemoveAfterDot<ElementOf<T>, Last> : never : First extends `${infer Second extends string}[*]` ? Second extends keyof T ? T[Second] extends object ? `${First}.${RemoveAfterDot<T[Second], Last>}` : never : never : never : K extends keyof T ? T[K] extends Array<any> ? `${K}[*].${string}` : `${K}.${string}` : T extends Array<any> ? RemoveAfterDot<ElementOf<T>, K> : never;
3
25
  //# sourceMappingURL=RemoveAfterDot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RemoveAfterDot.d.ts","sourceRoot":"","sources":["../../../src/types/RemoveAfterDot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAA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H,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,KAAK,IAAI,MAAM,IAAI,EAAE,GACrG,KAAK,SAAS,MAAM,CAAC,GACnB,CAAC,CAAC,KAAK,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,GACzB,GAAG,KAAK,OAAO,MAAM,EAAE,GACvB,CAAC,CAAC,KAAK,CAAC,SAAS,MAAM,GACrB,GAAG,KAAK,IAAI,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,EAAE,GAC5C,KAAK,GACT,KAAK,SAAS,KAAK,GACjB,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,GAClB,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAClC,KAAK,GACP,KAAK,SAAS,GAAG,MAAM,MAAM,SAAS,MAAM,KAAK,GAC/C,MAAM,SAAS,MAAM,CAAC,GACpB,CAAC,CAAC,MAAM,CAAC,SAAS,MAAM,GACtB,GAAG,KAAK,IAAI,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,GAC7C,KAAK,GACP,KAAK,GACP,KAAK,GACX,CAAC,SAAS,MAAM,CAAC,GACf,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,GACrB,GAAG,CAAC,OAAO,MAAM,EAAE,GACnB,GAAG,CAAC,IAAI,MAAM,EAAE,GAClB,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,GAClB,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAC/B,KAAK,CAAC"}
@@ -1,10 +1,22 @@
1
1
  /**
2
- * @title The type that draws only objects from key names that infer members.
2
+ * @title Type for Stripping the Array Symbol Suffix from a Key String.
3
3
  *
4
- * It is a helper type for use in other types, a type that cuts the back string to infer objects among keys inferred as {@link DeepStrictObjectKeys}.
4
+ * A helper type that removes the trailing array symbol (default `[*]`) from a key string.
5
+ * Used internally by {@link GetType} and other types to extract the base property name
6
+ * from keys that include array notation.
5
7
  *
6
- * ```ts
7
- * type Example = RemoveArraySymbol<"a[]">; // a
8
+ * If the string does not end with the array symbol, it is returned unchanged.
9
+ *
10
+ * @template T - The key string to process
11
+ * @template ArraySymbol - The array symbol to strip (defaults to `[*]`)
12
+ * @returns The key string with the trailing array symbol removed, or the original string if no match
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * type Ex1 = RemoveArraySymbol<"items[*]">; // "items"
17
+ * type Ex2 = RemoveArraySymbol<"items">; // "items"
18
+ * type Ex3 = RemoveArraySymbol<"[*]">; // ""
19
+ * type Ex4 = RemoveArraySymbol<"data[]", "[]">; // "data"
8
20
  * ```
9
21
  */
10
22
  export type RemoveArraySymbol<T extends string, ArraySymbol extends string = '[*]'> = T extends `${infer P}${ArraySymbol}` ? P : T;
@@ -1 +1 @@
1
- {"version":3,"file":"RemoveArraySymbol.d.ts","sourceRoot":"","sources":["../../../src/types/RemoveArraySymbol.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,CAC3B,CAAC,SAAS,MAAM,EAChB,WAAW,SAAS,MAAM,GAAG,KAAK,IAChC,CAAC,SAAS,GAAG,MAAM,CAAC,GAAG,WAAW,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"RemoveArraySymbol.d.ts","sourceRoot":"","sources":["../../../src/types/RemoveArraySymbol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,iBAAiB,CAC3B,CAAC,SAAS,MAAM,EAChB,WAAW,SAAS,MAAM,GAAG,KAAK,IAChC,CAAC,SAAS,GAAG,MAAM,CAAC,GAAG,WAAW,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC"}
@@ -1,2 +1,23 @@
1
+ /**
2
+ * @title Type for Extracting All Parent Path Segments from a Dot-Notation Key.
3
+ *
4
+ * A helper type used by {@link DeepStrictPick} to extract all intermediate (parent) paths
5
+ * from a dot-notation key string. When picking a nested key like `"a.b.c"`, the parent
6
+ * paths `"a"` and `"a.b"` must be preserved in the result. This type generates those paths.
7
+ *
8
+ * For paths containing array notation (`[*]`), both the array path and the base key
9
+ * without `[*]` are included.
10
+ *
11
+ * @template S - The dot-notation key string to extract parent paths from
12
+ * @returns A union of all parent path segments, or `never` if the key has no dots
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * type Ex1 = RemoveLastProperty<"a.b">; // "a"
17
+ * type Ex2 = RemoveLastProperty<"a.b.c">; // "a" | "a.b"
18
+ * type Ex3 = RemoveLastProperty<"a[*].b">; // "a[*]" | "a"
19
+ * type Ex4 = RemoveLastProperty<"a">; // never
20
+ * ```
21
+ */
1
22
  export type RemoveLastProperty<S extends string> = S extends `${infer First}.${infer Last}` ? First extends `${infer ObjectPart}[*]` ? First | ObjectPart | `${First}.${RemoveLastProperty<Last>}` : `${First}` | `${First}.${RemoveLastProperty<Last>}` : never;
2
23
  //# sourceMappingURL=RemoveLastProperty.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RemoveLastProperty.d.ts","sourceRoot":"","sources":["../../../src/types/RemoveLastProperty.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,KAAK,IAAI,MAAM,IAAI,EAAE,GACvF,KAAK,SAAS,GAAG,MAAM,UAAU,KAAK,GACpC,KAAK,GAAG,UAAU,GAAG,GAAG,KAAK,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE,GAC3D,GAAG,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE,GACrD,KAAK,CAAC"}
1
+ {"version":3,"file":"RemoveLastProperty.d.ts","sourceRoot":"","sources":["../../../src/types/RemoveLastProperty.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,KAAK,IAAI,MAAM,IAAI,EAAE,GACvF,KAAK,SAAS,GAAG,MAAM,UAAU,KAAK,GACpC,KAAK,GAAG,UAAU,GAAG,GAAG,KAAK,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE,GAC3D,GAAG,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE,GACrD,KAAK,CAAC"}
@@ -1,9 +1,34 @@
1
1
  import { StringType } from '@kakasoo/proto-typescript';
2
+ /** @internal Converts a union type to an intersection type. */
2
3
  type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
4
+ /** @internal Extracts the portion before the first dot in a string. */
3
5
  type BeforeDot<T extends string> = T extends `${infer Before}.${infer _}` ? Before : never;
6
+ /** @internal Extracts the portion after the first dot in a string. */
4
7
  type AfterDot<T extends string> = T extends `${infer _}.${infer After}` ? After : never;
8
+ /** @internal Extracts a union of all property value types from an object. */
5
9
  type ValueOf<T> = T[keyof T];
10
+ /** @internal Converts a string or number type to its string literal representation. */
6
11
  type ToString<T> = T extends string ? T : T extends number ? `${T}` : never;
12
+ /**
13
+ * @title Type for Converting a Comma-Separated Dot-Notation String to a Nested Object Type.
14
+ *
15
+ * Converts a string like `"a.b,c"` into a nested object type `{ a: { b: any }; c: any }`.
16
+ * Comma-separated segments produce an intersection of records, and dot-separated segments
17
+ * produce nested `Record` types. Leaf values are typed as `any`.
18
+ *
19
+ * @template T - The comma-separated dot-notation string to convert
20
+ * @template P - The split string segments (defaults to splitting T by comma)
21
+ * @returns A nested object type representing the string structure
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * type Ex1 = StringToDeepObject<"a">; // { a: any }
26
+ * type Ex2 = StringToDeepObject<"a.b">; // { a: { b: any } }
27
+ * type Ex3 = StringToDeepObject<"a,b">; // { a: any; b: any }
28
+ * type Ex4 = StringToDeepObject<"a.b,c">; // { a: { b: any }; c: any }
29
+ * type Ex5 = StringToDeepObject<"a.b.c">; // { a: { b: { c: any } } }
30
+ * ```
31
+ */
7
32
  export type StringToDeepObject<T extends string, P extends string[] = StringType.Split<T, ','>> = UnionToIntersection<ValueOf<{
8
33
  [key in P[number]]: StringType.Includes<key, '.'> extends true ? Record<BeforeDot<key>, StringToDeepObject<ToString<AfterDot<key>>>> : Record<key, any>;
9
34
  }>>;
@@ -1 +1 @@
1
- {"version":3,"file":"StringToDeepObject.d.ts","sourceRoot":"","sources":["../../../src/types/StringToDeepObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD,KAAK,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC;AAChH,KAAK,SAAS,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,MAAM,IAAI,MAAM,CAAC,EAAE,GAAG,MAAM,GAAG,KAAK,CAAC;AAC3F,KAAK,QAAQ,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,IAAI,MAAM,KAAK,EAAE,GAAG,KAAK,GAAG,KAAK,CAAC;AACxF,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAC7B,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,CAAC,SAAS,MAAM,GAAG,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC;AAE5E,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAA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MAAM,GAAG,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,mBAAmB,CACnH,OAAO,CAAC;KACL,GAAG,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,SAAS,IAAI,GAC1D,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GACnE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC;CACrB,CAAC,CACH,CAAC"}
@@ -1,2 +1,19 @@
1
+ /**
2
+ * @title Union Type of All Primitive and Date Types.
3
+ *
4
+ * A union of all JavaScript primitive types and `Date`. This type is used internally
5
+ * by {@link DeepStrictObjectKeys} and other recursive types to determine when to stop
6
+ * recursion. Properties whose type extends `ValueType` are treated as leaf nodes
7
+ * and are not recursively traversed.
8
+ *
9
+ * Note that `Date` is included because, although it is technically an object,
10
+ * it should not be recursively explored for nested keys.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * type IsValue = number extends ValueType ? true : false; // true
15
+ * type IsNotValue = { a: 1 } extends ValueType ? true : false; // false
16
+ * ```
17
+ */
1
18
  export type ValueType = number | boolean | string | null | undefined | symbol | bigint | Date;
2
19
  //# sourceMappingURL=ValueType.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ValueType.d.ts","sourceRoot":"","sources":["../../../src/types/ValueType.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC"}
1
+ {"version":3,"file":"ValueType.d.ts","sourceRoot":"","sources":["../../../src/types/ValueType.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kakasoo/deep-strict-types",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "typescript utility types including deep-strict-omit and pick type",
5
5
  "private": false,
6
6
  "publishConfig": {