From 9b4b7acaf1ca0703e66410f198642e50d76bfd4a Mon Sep 17 00:00:00 2001 From: Arya Emami Date: Thu, 4 Jan 2024 19:12:25 -0600 Subject: [PATCH] Add todo comments to remove certain test blocks - Added todo comments to remove certain test blocks after removal of `TypedStructuredSelectorCreator`. --- src/createStructuredSelector.ts | 2 +- type-tests/createStructuredSelector.test-d.ts | 3 +++ ...eateStructuredSelector.withTypes.test-d.ts | 1 + typescript_test/test.ts | 25 ++++--------------- 4 files changed, 10 insertions(+), 21 deletions(-) diff --git a/src/createStructuredSelector.ts b/src/createStructuredSelector.ts index 2f8535f20..794f311c9 100644 --- a/src/createStructuredSelector.ts +++ b/src/createStructuredSelector.ts @@ -41,11 +41,11 @@ export type RootStateSelectors = { } /** + * @deprecated Please use {@linkcode StructuredSelectorCreator.withTypes createStructuredSelector.withTypes()} instead. This type will be removed in the future. * @template RootState - The type of the root state object. * * @since 5.0.0 * @public - * @deprecated Please use {@linkcode StructuredSelectorCreator.withTypes createStructuredSelector.withTypes()} instead. This type will be removed in the future. */ export type TypedStructuredSelectorCreator = /** diff --git a/type-tests/createStructuredSelector.test-d.ts b/type-tests/createStructuredSelector.test-d.ts index 99833a8f2..864cb44f2 100644 --- a/type-tests/createStructuredSelector.test-d.ts +++ b/type-tests/createStructuredSelector.test-d.ts @@ -35,6 +35,8 @@ const rootState: RootState = { } describe('createStructuredSelector', () => { + + // TODO: Remove this test block once `TypedStructuredSelectorCreator` is removed. test('TypedStructuredSelectorCreator should lock down state type', () => { const createStructuredAppSelector: TypedStructuredSelectorCreator = createStructuredSelector @@ -112,6 +114,7 @@ describe('createStructuredSelector', () => { >(structuredSelector.lastResult()) }) + // TODO: Remove this test block once `TypedStructuredSelectorCreator` is removed. test('TypedStructuredSelectorCreator should correctly infer memoize and argsMemoize', () => { const createSelectorLru = createSelectorCreator({ memoize: lruMemoize, diff --git a/type-tests/createStructuredSelector.withTypes.test-d.ts b/type-tests/createStructuredSelector.withTypes.test-d.ts index 17586bbfe..9bb5b1ff7 100644 --- a/type-tests/createStructuredSelector.withTypes.test-d.ts +++ b/type-tests/createStructuredSelector.withTypes.test-d.ts @@ -294,6 +294,7 @@ describe('createStructuredSelector.withTypes()', () => { >(structuredAppSelector.lastResult()) }) + // TODO: Remove this test block once `TypedStructuredSelectorCreator` is removed. test('should work alongside TypedStructuredSelectorCreator', () => { const createStructuredAppSelector: TypedStructuredSelectorCreator = createStructuredSelector.withTypes() diff --git a/typescript_test/test.ts b/typescript_test/test.ts index c58547228..0795f2e70 100644 --- a/typescript_test/test.ts +++ b/typescript_test/test.ts @@ -17,8 +17,8 @@ import { createSelector, createSelectorCreator, createStructuredSelector, - referenceEqualityCheck, - lruMemoize + lruMemoize, + referenceEqualityCheck } from 'reselect' import { expectExactType } from './typesTestUtils' @@ -748,8 +748,8 @@ function testCreateStructuredSelector() { bar: number } - const typedStructuredSelectorCreator: TypedStructuredSelectorCreator = - createStructuredSelector + const typedStructuredSelectorCreator = + createStructuredSelector.withTypes() const selector = typedStructuredSelectorCreator({ foo: state => state.foo, @@ -772,12 +772,10 @@ function testCreateStructuredSelector() { }) typedStructuredSelectorCreator({ - // @ts-expect-error bar: state => state.foo }) typedStructuredSelectorCreator({ - // @ts-expect-error baz: state => state.foo }) @@ -820,6 +818,7 @@ function testCreateStructuredSelector() { selectorGenerics({ bar: '42' }) } +// TODO: Remove this function once `TypedStructuredSelectorCreator` is removed. function testTypedCreateStructuredSelector() { type RootState = { foo: string @@ -921,20 +920,6 @@ function testStructuredSelectorTypeParams() { // bar: selectBar, // ^^^ because this is missing, an error is thrown }) - - const typedStructuredSelectorCreator: TypedStructuredSelectorCreator = - createStructuredSelector - - // This works - typedStructuredSelectorCreator({ - foo: selectFoo, - bar: selectBar - }) - - // // So does this - // typedStructuredSelectorCreator>({ - // foo: selectFoo - // }) } function multiArgMemoize any>(