From fc343d4b4b9c90da0860987ee63166ea45bf8c04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Thu, 2 Jun 2022 14:04:25 +0100 Subject: [PATCH] Remove typed-rememo.ts --- packages/core-data/src/selectors.ts | 2 +- packages/core-data/src/typed-rememo.ts | 31 -------------------------- 2 files changed, 1 insertion(+), 32 deletions(-) delete mode 100644 packages/core-data/src/typed-rememo.ts diff --git a/packages/core-data/src/selectors.ts b/packages/core-data/src/selectors.ts index 5c44728b10faae..52f31a8d2a73d7 100644 --- a/packages/core-data/src/selectors.ts +++ b/packages/core-data/src/selectors.ts @@ -1,6 +1,7 @@ /** * External dependencies */ +import createSelector from 'rememo'; import { set, map, find, get, filter, compact } from 'lodash'; /** @@ -27,7 +28,6 @@ import { Name, NameOf, } from './entity-types'; -import createSelector from './typed-rememo'; // This is an incomplete, high-level approximation of the State type. // It makes the selectors slightly more safe, but is intended to evolve diff --git a/packages/core-data/src/typed-rememo.ts b/packages/core-data/src/typed-rememo.ts deleted file mode 100644 index 2f11f41fdf4d9d..00000000000000 --- a/packages/core-data/src/typed-rememo.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * External dependencies - */ -import originalCreateSelector from 'rememo'; - -/** - * The same as the original rememo createSelector, only with a more complete - * TypeScript signature. A fix has been proposed in the following pull request: - * https://github.com/aduth/rememo/pull/7 - * Once it's merged, this file can be safely removed. - * - * And here's the original documentation: - * - * Returns a memoized selector function. The getDependants function argument is - * called before the memoized selector and is expected to return an immutable - * reference or array of references on which the selector depends for computing - * its own return value. The memoize cache is preserved only as long as those - * dependant references remain the same. If getDependants returns a different - * reference(s), the cache is cleared and the selector value regenerated. - * - * @param selector Selector function. - * @param getDependants Dependant getter returning an array of - * references used in cache bust consideration. - * @return Memoized selector function. - */ -export default function createSelector< T extends ( ...args: any[] ) => any >( - selector: T, - getDependants: ( ...args: any[] ) => any -): T { - return originalCreateSelector( selector, getDependants ) as T; -}