From 11e64ea8fb9a60513941a2b2e16ce4c021940334 Mon Sep 17 00:00:00 2001 From: Mark Erikson Date: Thu, 4 Nov 2021 21:07:39 -0400 Subject: [PATCH] Move return types to casts to work around Reselect update issues --- packages/toolkit/src/query/core/buildSelectors.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/packages/toolkit/src/query/core/buildSelectors.ts b/packages/toolkit/src/query/core/buildSelectors.ts index 733c752bad..a73e9be54e 100644 --- a/packages/toolkit/src/query/core/buildSelectors.ts +++ b/packages/toolkit/src/query/core/buildSelectors.ts @@ -157,8 +157,8 @@ export function buildSelectors< function buildQuerySelector( endpointName: string, endpointDefinition: QueryDefinition - ): QueryResultSelectorFactory { - return (queryArgs) => { + ) { + return ((queryArgs: any) => { const selectQuerySubState = createSelector( selectInternalState, (internalState) => @@ -173,14 +173,11 @@ export function buildSelectors< ]) ?? defaultQuerySubState ) return createSelector(selectQuerySubState, withRequestFlags) - } + }) as QueryResultSelectorFactory } - function buildMutationSelector(): MutationResultSelectorFactory< - any, - RootState - > { - return (id) => { + function buildMutationSelector() { + return ((id) => { let mutationId: string | typeof skipToken if (typeof id === 'object') { mutationId = getMutationCacheKey(id) ?? skipToken @@ -195,7 +192,7 @@ export function buildSelectors< : internalState?.mutations?.[mutationId]) ?? defaultMutationSubState ) return createSelector(selectMutationSubstate, withRequestFlags) - } + }) as MutationResultSelectorFactory } function selectInvalidatedBy(