(target, prop, receiver)
| 49 | function trackMethods<T extends object>(repo: T, register: (promise: Promise<unknown>) => void): T { |
| 50 | return new Proxy(repo, { |
| 51 | get(target, prop, receiver) { |
| 52 | const value = Reflect.get(target, prop, receiver) |
| 53 | if (typeof value !== 'function') { |
| 54 | return value |
| 55 | } |
| 56 | return (...args: unknown[]) => { |
| 57 | const result = Reflect.apply(value, target, args) |
| 58 | if (result instanceof Promise) { |
| 59 | register(result) |
| 60 | } |
| 61 | return result |
| 62 | } |
| 63 | } |
| 64 | }) |
| 65 | } |
| 66 |
no test coverage detected