Repository: exadel-inc/esl
Pull request #1654 (2023-05-15 22:29:57)

fix(esl-utils): fix unwrap method signature types


Patch:
diff --git a/package-lock.json b/package-lock.json
index 34a4c9ede..1c00f8c83 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -20808,9 +20808,9 @@
       }
     },
     "node_modules/vm2": {
-      "version": "3.9.18",
-      "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.18.tgz",
-      "integrity": "sha512-iM7PchOElv6Uv6Q+0Hq7dcgDtWWT6SizYqVcvol+1WQc+E9HlgTCnPozbQNSP3yDV9oXHQOEQu530w2q/BCVZg==",
+      "version": "3.9.17",
+      "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.17.tgz",
+      "integrity": "sha512-AqwtCnZ/ERcX+AVj9vUsphY56YANXxRuqMb7GsDtAr0m0PcQX3u0Aj3KWiXM0YAHy7i6JEeHrwOnwXbGYgRpAw==",
       "dev": true,
       "dependencies": {
         "acorn": "^8.7.0",
@@ -36820,9 +36820,9 @@
       }
     },
     "vm2": {
-      "version": "3.9.18",
-      "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.18.tgz",
-      "integrity": "sha512-iM7PchOElv6Uv6Q+0Hq7dcgDtWWT6SizYqVcvol+1WQc+E9HlgTCnPozbQNSP3yDV9oXHQOEQu530w2q/BCVZg==",
+      "version": "3.9.17",
+      "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.17.tgz",
+      "integrity": "sha512-AqwtCnZ/ERcX+AVj9vUsphY56YANXxRuqMb7GsDtAr0m0PcQX3u0Aj3KWiXM0YAHy7i6JEeHrwOnwXbGYgRpAw==",
       "dev": true,
       "requires": {
         "acorn": "^8.7.0",
diff --git a/src/modules/esl-utils/misc.ts b/src/modules/esl-utils/misc.ts
index e1bfe5e29..d6a035d4b 100644
--- a/src/modules/esl-utils/misc.ts
+++ b/src/modules/esl-utils/misc.ts
@@ -1,13 +1,19 @@
-export * from './misc/memoize';
+export * as SetUtils from './misc/set';
 
+/** @deprecated `misc/uid` is going to be exported as it is without wrapper object */
 export * as UID from './misc/uid';
-export * as SetUtils from './misc/set';
+/** @deprecated `misc/array` is going to be exported as it is without wrapper object */
 export * as ArrayUtils from './misc/array';
+/** @deprecated `misc/object` is going to be exported as it is without wrapper object */
 export * as ObjectUtils from './misc/object';
+/** @deprecated `misc/format` is going to be exported as it is without wrapper object */
 export * as FormatUtils from './misc/format';
+/** @deprecated `misc/functions` is going to be exported as it is without wrapper object */
 export * as FunctionUtils from './misc/functions';
 
-export {sequentialUID, randUID} from './misc/uid';
-export {range, tuple, wrap, uniq} from './misc/array';
-export {isEqual, deepMerge, defined, copyDefinedKeys} from './misc/object';
-export {evaluate, format, parseNumber, unwrapParenthesis, parseAspectRatio} from './misc/format';
+export * from './misc/uid';
+export * from './misc/array';
+export * from './misc/object';
+export * from './misc/format';
+export * from './misc/functions';
+export * from './misc/memoize';
diff --git a/src/modules/esl-utils/misc/array.ts b/src/modules/esl-utils/misc/array.ts
index d1f49c17b..4662ed428 100644
--- a/src/modules/esl-utils/misc/array.ts
+++ b/src/modules/esl-utils/misc/array.ts
@@ -21,11 +21,16 @@ export const wrap = <T>(arr: undefined | null | T | T[]): T[] => {
   return [arr];
 };
 
-/** Unwraps and returns the first element if passed object is array-like, returns original object otherwise */
+/** Unwraps empty collection to `undefined` */
 export function unwrap(value: []): undefined;
-export function unwrap<T>(value: (ArrayLike<T> & {0: T}) | T): T;
+/** Unwraps and returns the first element of array-like object */
+export function unwrap<T>(value: (ArrayLike<T> & {0: T})): T;
+/** Unwraps and returns the first element if array-like object */
+export function unwrap<T>(value: ArrayLike<T>): T | undefined;
+/** Unwraps and returns the first element Node of passed NodeList object */
 export function unwrap<T extends Node>(value: NodeListOf<T>): T | undefined;
-export function unwrap(value: any): any;
+/** Unwraps and returns the first element if passed object is array-like, returns an original object otherwise */
+export function unwrap<T>(value: T): T;
 export function unwrap(value: any): any {
   return isArrayLike(value) ? value[0] : value;
 }
diff --git a/src/modules/esl-utils/misc/object.ts b/src/modules/esl-utils/misc/object.ts
index cba04cfa8..92c19aa5d 100644
--- a/src/modules/esl-utils/misc/object.ts
+++ b/src/modules/esl-utils/misc/object.ts
@@ -1,6 +1,6 @@
-export * from './object/utils';
 export * from './object/types';
-export * from './object/path';
-export * from './object/merge';
-export * from './object/copy';
-export * from './object/compare';
+export {defined, getPropertyDescriptor} from './object/utils';
+export {deepMerge} from './object/merge';
+export {copy, omit, copyDefinedKeys} from './object/copy';
+export {isEqual, isSimilar} from './object/compare';
+export {get, getByPath, set, setByPath} from './object/path';


Test patch:
diff --git a/src/modules/esl-utils/misc/test/object.test.ts b/src/modules/esl-utils/misc/test/object.test.ts
index 2e9b739fa..d3cd3f7c9 100644
--- a/src/modules/esl-utils/misc/test/object.test.ts
+++ b/src/modules/esl-utils/misc/test/object.test.ts
@@ -12,7 +12,6 @@ import {
   getByPath,
   set,
   setByPath,
-  parseKeys,
   deepMerge,
   omit,
   getPropertyDescriptor
@@ -34,7 +33,6 @@ describe('misc/object: availability', () => {
     getByPath,
     set,
     setByPath,
-    parseKeys,
     deepMerge,
     omit,
     getPropertyDescriptor