Skip to content

Commit 3fb8c98

Browse files
committed
Fix logSelectorRecomputations type issue
1 parent ff674cb commit 3fb8c98

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

test/testUtils.ts

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
import type { PayloadAction } from '@reduxjs/toolkit'
22
import { combineReducers, configureStore, createSlice } from '@reduxjs/toolkit'
33
import { test } from 'vitest'
4-
import type { lruMemoize } from '../src/lruMemoize'
5-
import type {
6-
AnyFunction,
7-
OutputSelector,
8-
SelectorArray,
9-
Simplify
10-
} from '../src/types'
4+
import type { AnyFunction, OutputSelector, Simplify } from '../src/types'
115

126
export interface Todo {
137
id: number
@@ -437,22 +431,17 @@ export const logRecomputations = <S extends OutputSelector>(selector: S) => {
437431
)
438432
}
439433

440-
export const logSelectorRecomputations = <
441-
S extends OutputSelector<SelectorArray, unknown, typeof lruMemoize, any>
442-
>(
434+
export const logSelectorRecomputations = <S extends OutputSelector>(
443435
selector: S
444436
) => {
445-
console.log(
446-
`\x1B[32m\x1B[1m${selector.name}\x1B[0m result function recalculated:`,
447-
{
448-
resultFunc: selector.recomputations(),
449-
inputSelectors: selector.dependencyRecomputations(),
450-
newResults:
451-
typeof selector.memoizedResultFunc.resultsCount === 'function'
452-
? selector.memoizedResultFunc.resultsCount()
453-
: undefined
454-
}
455-
)
437+
console.log(`\x1B[32m\x1B[1m${selector.name}\x1B[0m:`, {
438+
resultFunc: selector.recomputations(),
439+
inputSelectors: selector.dependencyRecomputations(),
440+
newResults:
441+
typeof selector.memoizedResultFunc.resultsCount === 'function'
442+
? selector.memoizedResultFunc.resultsCount()
443+
: undefined
444+
})
456445
// console.log(
457446
// `\x1B[32m\x1B[1m${selector.name}\x1B[0m result function recalculated:`,
458447
// `\x1B[33m${selector.recomputations().toLocaleString('en-US')}\x1B[0m`,

0 commit comments

Comments
 (0)