@@ -6,8 +6,7 @@ import memoize from '../src';
66import type { EqualityFn , MemoizedFn } from '../src' ;
77
88it ( 'should maintain the types of the original function' , ( ) => {
9- // eslint-disable-next-line @typescript-eslint/no-unused-vars
10- function getLocation ( this : Window , value : number ) {
9+ function getLocation ( this : Window ) {
1110 return this . location ;
1211 }
1312 const memoized = memoize ( getLocation ) ;
@@ -47,7 +46,7 @@ it('should return a `MemoizedFn<T>`', () => {
4746} ) ;
4847
4948it ( 'should allow you to leverage the MemoizedFn generic to allow many memoized functions' , ( ) => {
50- function withDeepEqual < TFunc extends ( ...args : any [ ] ) => any > (
49+ function withDeepEqual < TFunc extends ( ...args : unknown [ ] ) => unknown > (
5150 fn : TFunc
5251 ) : MemoizedFn < TFunc > {
5352 return memoize ( fn , isEqual ) ;
@@ -223,49 +222,55 @@ it('should allow weaker equality function types', () => {
223222 expectTypeOf < typeof isEqual > ( ) . toMatchTypeOf < EqualityFn < typeof add > > ( ) ;
224223 }
225224
226- // ✅ tuple of 'any '
225+ // ✅ tuple of 'unknown '
227226 {
228- const isEqual = function ( first : [ any , any ] , second : [ any , any ] ) {
227+ const isEqual = function (
228+ first : [ unknown , unknown ] ,
229+ second : [ unknown , unknown ]
230+ ) {
229231 return true ;
230232 } ;
231233 expectTypeOf < typeof isEqual > ( ) . toMatchTypeOf < EqualityFn < typeof add > > ( ) ;
232234 }
233235
234- // ❌ tuple of 'any ' or incorrect size
236+ // ❌ tuple of 'unknown ' or incorrect size
235237 {
236- const isEqual = function ( first : [ any , any , any ] , second : [ any , any ] ) {
238+ const isEqual = function (
239+ first : [ unknown , unknown , unknown ] ,
240+ second : [ unknown , unknown ]
241+ ) {
237242 return true ;
238243 } ;
239244 expectTypeOf < typeof isEqual > ( ) . not . toMatchTypeOf < EqualityFn < typeof add > > ( ) ;
240245 }
241246
242- // ✅ array of 'any '
247+ // ✅ array of 'unknown '
243248 {
244- const isEqual = function ( first : any [ ] , second : any [ ] ) {
249+ const isEqual = function ( first : unknown [ ] , second : unknown [ ] ) {
245250 return true ;
246251 } ;
247252 expectTypeOf < typeof isEqual > ( ) . toMatchTypeOf < EqualityFn < typeof add > > ( ) ;
248253 }
249254
250- // ✅ two arguments of type any
255+ // ✅ two arguments of type unknown
251256 {
252- const isEqual = function ( first : any , second : any ) {
257+ const isEqual = function ( first : unknown , second : unknown ) {
253258 return true ;
254259 } ;
255260 expectTypeOf < typeof isEqual > ( ) . toMatchTypeOf < EqualityFn < typeof add > > ( ) ;
256261 }
257262
258- // ✅ a single argument of type any
263+ // ✅ a single argument of type unknown
259264 {
260- const isEqual = function ( first : any ) {
265+ const isEqual = function ( first : unknown ) {
261266 return true ;
262267 } ;
263268 expectTypeOf < typeof isEqual > ( ) . toMatchTypeOf < EqualityFn < typeof add > > ( ) ;
264269 }
265270
266- // ✅ spread of any type
271+ // ✅ spread of unknown type
267272 {
268- const isEqual = function ( ...first : any [ ] ) {
273+ const isEqual = function ( ...first : unknown [ ] ) {
269274 return true ;
270275 } ;
271276 expectTypeOf < typeof isEqual > ( ) . toMatchTypeOf < EqualityFn < typeof add > > ( ) ;
0 commit comments