@@ -25,7 +25,7 @@ function getInstanceBatcher<I, K, V>(instance: I, property: string, descriptor:
2525 instance [ holder ] = instance [ holder ] ?? new Map < string , MethodBatcher < I , K , V > > ( ) ;
2626
2727 // check if the instance already has a method matcher for this specific method
28- if ( instance [ holder ] . has ( property ) ) return instance [ holder ] . get ( property ) ;
28+ if ( instance [ holder ] . has ( property ) ) return instance [ holder ] . get ( property ) as MethodBatcher < I , K , V > ;
2929
3030 // otherwise, create a new batcher and store it in the instance batchers holder
3131 const batcher = new MethodBatcher < I , K , V > ( instance , descriptor , options ) ;
@@ -36,9 +36,9 @@ function getInstanceBatcher<I, K, V>(instance: I, property: string, descriptor:
3636export function InBatches < K , V > ( options ?: BatcherOptions ) {
3737 return function ( _ : any , property : string , descriptor : PropertyDescriptor ) {
3838 const method = descriptor . value ;
39- descriptor . value = function ( ... args : any [ ] ) {
39+ descriptor . value = function ( key : K ) {
4040 const batcher = getInstanceBatcher < any , K , V > ( this , property , method , options ) ;
41- return batcher . enqueue ( args ) ;
41+ return batcher . enqueue ( key ) ;
4242 } ;
4343
4444 return descriptor ;
0 commit comments