(...args: Args)
| 186 | Impl extends (this: UserEventInstance, ...args: Args) => Promise<unknown>, |
| 187 | >(instance: UserEventInstance, impl: Impl) { |
| 188 | function method(...args: Args) { |
| 189 | return wrapAsync(() => |
| 190 | // eslint-disable-next-line promise/prefer-await-to-then |
| 191 | impl.apply(instance, args).then(async (result) => { |
| 192 | await wait(instance.config); |
| 193 | return result; |
| 194 | }), |
| 195 | ); |
| 196 | } |
| 197 | |
| 198 | // Copy implementation name to the returned function |
| 199 | Object.defineProperty(method, 'name', { get: () => impl.name }); |