@ls-stack/utils 3.36.0 → 3.38.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/dist/asyncQueue.cjs +2 -2
- package/dist/asyncQueue.js +2 -2
- package/dist/testUtils.cjs +44 -0
- package/dist/testUtils.d.cts +5 -1
- package/dist/testUtils.d.ts +5 -1
- package/dist/testUtils.js +44 -0
- package/dist/typeUtils.d.cts +8 -1
- package/dist/typeUtils.d.ts +8 -1
- package/dist/typedStrings.cjs +90 -0
- package/dist/typedStrings.d.cts +152 -0
- package/dist/typedStrings.d.ts +152 -0
- package/dist/typedStrings.js +57 -0
- package/dist/typingFnUtils.cjs +5 -0
- package/dist/typingFnUtils.d.cts +3 -1
- package/dist/typingFnUtils.d.ts +3 -1
- package/dist/typingFnUtils.js +4 -0
- package/docs/_media/modules.md +1 -0
- package/docs/modules.md +1 -0
- package/docs/testUtils.md +1 -1
- package/docs/typeUtils/README.md +18 -0
- package/docs/typedStrings.md +458 -0
- package/docs/typingFnUtils/-internal-.md +17 -1
- package/docs/typingFnUtils/README.md +35 -9
- package/package.json +7 -3
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
const isSubTypeOf: <BaseType, SubType>() => unknown = typeOnRightExtendsLeftType;
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
Defined in: [packages/utils/src/typingFnUtils.ts:
|
|
21
|
+
Defined in: [packages/utils/src/typingFnUtils.ts:79](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingFnUtils.ts#L79)
|
|
22
22
|
|
|
23
23
|
Type helper to check if a type is a subtype of another type.
|
|
24
24
|
|
|
@@ -54,7 +54,7 @@ use typeOnRightExtendsLeftType instead
|
|
|
54
54
|
function asNonPartial<T>(obj): NonPartial<T>;
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
Defined in: [packages/utils/src/typingFnUtils.ts:
|
|
57
|
+
Defined in: [packages/utils/src/typingFnUtils.ts:4](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingFnUtils.ts#L4)
|
|
58
58
|
|
|
59
59
|
#### Type Parameters
|
|
60
60
|
|
|
@@ -74,13 +74,39 @@ Defined in: [packages/utils/src/typingFnUtils.ts:3](https://github.com/lucasols/
|
|
|
74
74
|
|
|
75
75
|
***
|
|
76
76
|
|
|
77
|
+
### asPartialUndefinedValues()
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
function asPartialUndefinedValues<T>(value): T;
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Defined in: [packages/utils/src/typingFnUtils.ts:110](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingFnUtils.ts#L110)
|
|
84
|
+
|
|
85
|
+
#### Type Parameters
|
|
86
|
+
|
|
87
|
+
##### T
|
|
88
|
+
|
|
89
|
+
`T` *extends* `Record`\<`string`, `unknown`\>
|
|
90
|
+
|
|
91
|
+
#### Parameters
|
|
92
|
+
|
|
93
|
+
##### value
|
|
94
|
+
|
|
95
|
+
\{ \[P in string \| number \| symbol\]: (Partial\<Pick\<T, KeysWithUndefinedValues\<T\>\>\> & Omit\<T, KeysWithUndefinedValues\<T\>\>)\[P\] \}
|
|
96
|
+
|
|
97
|
+
#### Returns
|
|
98
|
+
|
|
99
|
+
`T`
|
|
100
|
+
|
|
101
|
+
***
|
|
102
|
+
|
|
77
103
|
### asType()
|
|
78
104
|
|
|
79
105
|
```ts
|
|
80
106
|
function asType<T>(value): T;
|
|
81
107
|
```
|
|
82
108
|
|
|
83
|
-
Defined in: [packages/utils/src/typingFnUtils.ts:
|
|
109
|
+
Defined in: [packages/utils/src/typingFnUtils.ts:38](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingFnUtils.ts#L38)
|
|
84
110
|
|
|
85
111
|
a safe way to cast types, use to substitute the `as Type`
|
|
86
112
|
|
|
@@ -108,7 +134,7 @@ a safe way to cast types, use to substitute the `as Type`
|
|
|
108
134
|
function isObjKey<T>(key, obj): key is keyof T;
|
|
109
135
|
```
|
|
110
136
|
|
|
111
|
-
Defined in: [packages/utils/src/typingFnUtils.ts:
|
|
137
|
+
Defined in: [packages/utils/src/typingFnUtils.ts:86](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingFnUtils.ts#L86)
|
|
112
138
|
|
|
113
139
|
Type helper to narrow a string to a key of an object.
|
|
114
140
|
|
|
@@ -140,7 +166,7 @@ Type helper to narrow a string to a key of an object.
|
|
|
140
166
|
function narrowStringToUnion<T>(key, union): undefined | T;
|
|
141
167
|
```
|
|
142
168
|
|
|
143
|
-
Defined in: [packages/utils/src/typingFnUtils.ts:
|
|
169
|
+
Defined in: [packages/utils/src/typingFnUtils.ts:47](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingFnUtils.ts#L47)
|
|
144
170
|
|
|
145
171
|
narrow a string to a union of strings
|
|
146
172
|
|
|
@@ -172,7 +198,7 @@ narrow a string to a union of strings
|
|
|
172
198
|
function typedObjectEntries<T>(obj): NonNullable<{ [K in string | number | symbol]: [K, T[K]] }[keyof T]>[];
|
|
173
199
|
```
|
|
174
200
|
|
|
175
|
-
Defined in: [packages/utils/src/typingFnUtils.ts:
|
|
201
|
+
Defined in: [packages/utils/src/typingFnUtils.ts:14](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingFnUtils.ts#L14)
|
|
176
202
|
|
|
177
203
|
a wrapper to Object.entries with a better typing inference
|
|
178
204
|
|
|
@@ -200,7 +226,7 @@ a wrapper to Object.entries with a better typing inference
|
|
|
200
226
|
function typedObjectKeys<T>(obj): keyof T[];
|
|
201
227
|
```
|
|
202
228
|
|
|
203
|
-
Defined in: [packages/utils/src/typingFnUtils.ts:
|
|
229
|
+
Defined in: [packages/utils/src/typingFnUtils.ts:28](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingFnUtils.ts#L28)
|
|
204
230
|
|
|
205
231
|
a wrapper to Object.keys with a better typing inference
|
|
206
232
|
|
|
@@ -228,7 +254,7 @@ keyof `T`[]
|
|
|
228
254
|
function typeOnRightExtendsLeftType<BaseType, SubType>(): unknown;
|
|
229
255
|
```
|
|
230
256
|
|
|
231
|
-
Defined in: [packages/utils/src/typingFnUtils.ts:
|
|
257
|
+
Defined in: [packages/utils/src/typingFnUtils.ts:71](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingFnUtils.ts#L71)
|
|
232
258
|
|
|
233
259
|
Type helper to check if a type is a subtype of another type.
|
|
234
260
|
|
|
@@ -260,7 +286,7 @@ Returns undefined, only used for type checking
|
|
|
260
286
|
function unionsAreTheSame<T, U>(_diff): void;
|
|
261
287
|
```
|
|
262
288
|
|
|
263
|
-
Defined in: [packages/utils/src/typingFnUtils.ts:
|
|
289
|
+
Defined in: [packages/utils/src/typingFnUtils.ts:108](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingFnUtils.ts#L108)
|
|
264
290
|
|
|
265
291
|
Type helper to compare two union types and determine their relationship.
|
|
266
292
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ls-stack/utils",
|
|
3
3
|
"description": "Universal TypeScript utilities for browser and Node.js",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.38.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
@@ -200,6 +200,10 @@
|
|
|
200
200
|
"import": "./dist/typeUtils.typesTest.js",
|
|
201
201
|
"require": "./dist/typeUtils.typesTest.cjs"
|
|
202
202
|
},
|
|
203
|
+
"./typedStrings": {
|
|
204
|
+
"import": "./dist/typedStrings.js",
|
|
205
|
+
"require": "./dist/typedStrings.cjs"
|
|
206
|
+
},
|
|
203
207
|
"./typingFnUtils": {
|
|
204
208
|
"import": "./dist/typingFnUtils.js",
|
|
205
209
|
"require": "./dist/typingFnUtils.cjs"
|
|
@@ -222,7 +226,7 @@
|
|
|
222
226
|
},
|
|
223
227
|
"devDependencies": {
|
|
224
228
|
"@eslint/js": "^9.18.0",
|
|
225
|
-
"@ls-stack/extended-lint": "^0.
|
|
229
|
+
"@ls-stack/extended-lint": "^0.67.2",
|
|
226
230
|
"@types/eslint": "^9.6.1",
|
|
227
231
|
"@types/eslint__js": "^8.42.3",
|
|
228
232
|
"@types/node": "^22.10.9",
|
|
@@ -247,7 +251,7 @@
|
|
|
247
251
|
"vitest": "^3.0.4"
|
|
248
252
|
},
|
|
249
253
|
"dependencies": {
|
|
250
|
-
"evtmitter": "^0.
|
|
254
|
+
"evtmitter": "^1.0.2",
|
|
251
255
|
"t-result": "^0.3.0"
|
|
252
256
|
},
|
|
253
257
|
"scripts": {
|