diff --git a/js/src/common/utils/extract.js b/js/src/common/utils/extract.js deleted file mode 100644 index a6b748210..000000000 --- a/js/src/common/utils/extract.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * The `extract` utility deletes a property from an object and returns its - * value. - * - * @param {Object} object The object that owns the property - * @param {String} property The name of the property to extract - * @return {*} The value of the property - */ -export default function extract(object, property) { - const value = object[property]; - - delete object[property]; - - return value; -} diff --git a/js/src/common/utils/extract.ts b/js/src/common/utils/extract.ts new file mode 100644 index 000000000..3e05da257 --- /dev/null +++ b/js/src/common/utils/extract.ts @@ -0,0 +1,15 @@ +/** + * The `extract` utility deletes a property from an object and returns its + * value. + * + * @param object The object that owns the property + * @param property The name of the property to extract + * @return The value of the property + */ +export default function extract(object: T, property: K): T[K] { + const value = object[property]; + + delete object[property]; + + return value; +}