utilium 0.4.0 → 0.4.2
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/struct.js +1 -1
- package/dist/types.d.ts +7 -0
- package/package.json +1 -1
- package/src/struct.ts +1 -1
- package/src/types.ts +6 -0
package/dist/struct.js
CHANGED
@@ -135,7 +135,7 @@ export function deserialize(instance, _buffer) {
|
|
135
135
|
if (object[key] === null || object[key] === undefined) {
|
136
136
|
continue;
|
137
137
|
}
|
138
|
-
deserialize(object[key], new Uint8Array(buffer.slice(iOff, sizeof(type))));
|
138
|
+
deserialize(object[key], new Uint8Array(buffer.slice(iOff, iOff + sizeof(type))));
|
139
139
|
continue;
|
140
140
|
}
|
141
141
|
if (length > 0) {
|
package/dist/types.d.ts
CHANGED
@@ -181,4 +181,11 @@ export type LastOfUnion<T> = UnionToIntersection<T extends any ? () => T : never
|
|
181
181
|
* @see https://stackoverflow.com/a/55128956/17637456
|
182
182
|
*/
|
183
183
|
export type UnionToTuple<T, L = LastOfUnion<T>, N = [T] extends [never] ? true : false> = true extends N ? [] : Push<UnionToTuple<Exclude<T, L>>, L>;
|
184
|
+
/**
|
185
|
+
* Makes properties with keys assignable to K in T required
|
186
|
+
* @see https://stackoverflow.com/a/69328045/17637456
|
187
|
+
*/
|
188
|
+
export type WithRequired<T, K extends keyof T> = T & {
|
189
|
+
[P in K]-?: T[P];
|
190
|
+
};
|
184
191
|
export {};
|
package/package.json
CHANGED
package/src/struct.ts
CHANGED
@@ -166,7 +166,7 @@ export function deserialize(instance: unknown, _buffer: ArrayBuffer | ArrayBuffe
|
|
166
166
|
if (object[key] === null || object[key] === undefined) {
|
167
167
|
continue;
|
168
168
|
}
|
169
|
-
deserialize(object[key], new Uint8Array(buffer.slice(iOff, sizeof(type))));
|
169
|
+
deserialize(object[key], new Uint8Array(buffer.slice(iOff, iOff + sizeof(type))));
|
170
170
|
continue;
|
171
171
|
}
|
172
172
|
|
package/src/types.ts
CHANGED
@@ -220,3 +220,9 @@ export type LastOfUnion<T> = UnionToIntersection<T extends any ? () => T : never
|
|
220
220
|
* @see https://stackoverflow.com/a/55128956/17637456
|
221
221
|
*/
|
222
222
|
export type UnionToTuple<T, L = LastOfUnion<T>, N = [T] extends [never] ? true : false> = true extends N ? [] : Push<UnionToTuple<Exclude<T, L>>, L>;
|
223
|
+
|
224
|
+
/**
|
225
|
+
* Makes properties with keys assignable to K in T required
|
226
|
+
* @see https://stackoverflow.com/a/69328045/17637456
|
227
|
+
*/
|
228
|
+
export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
|