hevy-shared 1.0.698 → 1.0.699

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.
@@ -30,3 +30,8 @@ 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
+ * Same as `array[index]`, but adds `undefined` to the return type. Maybe some
35
+ * fine day we will enable `noUncheckedIndexedAccess` in all our projects. 🤞
36
+ */
37
+ export declare const typeSafeIndex: <T>(array: T[], index: number) => T | undefined;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.dangerousUncheckedTypeCast = exports.exhaustiveTypeException = exports.exhaustiveTypeCheck = exports.isInArray = void 0;
3
+ exports.typeSafeIndex = 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,3 +30,9 @@ exports.exhaustiveTypeException = exhaustiveTypeException;
30
30
  */
31
31
  const dangerousUncheckedTypeCast = (value) => value;
32
32
  exports.dangerousUncheckedTypeCast = dangerousUncheckedTypeCast;
33
+ /**
34
+ * Same as `array[index]`, but adds `undefined` to the return type. Maybe some
35
+ * fine day we will enable `noUncheckedIndexedAccess` in all our projects. 🤞
36
+ */
37
+ const typeSafeIndex = (array, index) => array[index];
38
+ exports.typeSafeIndex = typeSafeIndex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hevy-shared",
3
- "version": "1.0.698",
3
+ "version": "1.0.699",
4
4
  "description": "",
5
5
  "main": "built/index.js",
6
6
  "types": "built/index.d.ts",