Skip to content

Commit 0586002

Browse files
authored
fix: decorator calling with array of array (#5)
1 parent 187580c commit 0586002

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "inbatches",
3-
"version": "0.0.8",
3+
"version": "0.0.9",
44
"private": false,
55
"license": "MIT",
66
"repository": {

src/decorator.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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:
3636
export 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

Comments
 (0)