hevy-shared 1.0.757 → 1.0.759
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/built/typeUtils.d.ts +7 -0
- package/built/typeUtils.js +11 -1
- package/package.json +1 -1
package/built/typeUtils.d.ts
CHANGED
|
@@ -30,8 +30,15 @@ export type Some<T> = {
|
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
32
|
export declare const dangerousUncheckedTypeCast: <T = void, U extends T = T>(value: unknown) => U;
|
|
33
|
+
/**
|
|
34
|
+
* Safer alternative to `JSON.parse`. Returns `unknown` instead of `any`.
|
|
35
|
+
*
|
|
36
|
+
* @see JSON.parse
|
|
37
|
+
*/
|
|
38
|
+
export declare const parseJSON: (...args: Parameters<typeof JSON.parse>) => unknown;
|
|
33
39
|
/**
|
|
34
40
|
* Same as `array[index]`, but adds `undefined` to the return type. Maybe some
|
|
35
41
|
* fine day we will enable `noUncheckedIndexedAccess` in all our projects. 🤞
|
|
36
42
|
*/
|
|
37
43
|
export declare const typeSafeIndex: <T>(array: T[], index: number) => T | undefined;
|
|
44
|
+
export declare const TODO: (message?: string) => never;
|
package/built/typeUtils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.typeSafeIndex = exports.dangerousUncheckedTypeCast = exports.exhaustiveTypeException = exports.exhaustiveTypeCheck = exports.isInArray = void 0;
|
|
3
|
+
exports.TODO = exports.typeSafeIndex = exports.parseJSON = exports.dangerousUncheckedTypeCast = exports.exhaustiveTypeException = exports.exhaustiveTypeCheck = exports.isInArray = void 0;
|
|
4
4
|
const isInArray = (value, array) => array.includes(value);
|
|
5
5
|
exports.isInArray = isInArray;
|
|
6
6
|
const exhaustiveTypeCheck = (_) => void _;
|
|
@@ -30,9 +30,19 @@ exports.exhaustiveTypeException = exhaustiveTypeException;
|
|
|
30
30
|
*/
|
|
31
31
|
const dangerousUncheckedTypeCast = (value) => value;
|
|
32
32
|
exports.dangerousUncheckedTypeCast = dangerousUncheckedTypeCast;
|
|
33
|
+
/**
|
|
34
|
+
* Safer alternative to `JSON.parse`. Returns `unknown` instead of `any`.
|
|
35
|
+
*
|
|
36
|
+
* @see JSON.parse
|
|
37
|
+
*/
|
|
38
|
+
exports.parseJSON = JSON.parse;
|
|
33
39
|
/**
|
|
34
40
|
* Same as `array[index]`, but adds `undefined` to the return type. Maybe some
|
|
35
41
|
* fine day we will enable `noUncheckedIndexedAccess` in all our projects. 🤞
|
|
36
42
|
*/
|
|
37
43
|
const typeSafeIndex = (array, index) => array[index];
|
|
38
44
|
exports.typeSafeIndex = typeSafeIndex;
|
|
45
|
+
const TODO = (message) => {
|
|
46
|
+
throw new Error(message !== null && message !== void 0 ? message : 'Not implemented');
|
|
47
|
+
};
|
|
48
|
+
exports.TODO = TODO;
|