Open LanceStasinski opened 1 year ago
Hello, I've added a custom task modifier to restore the functionality of waitFor from @ember/test-waiters. Do you have any suggestions for improving the types for this custom modifier? Thank you in advance!
waitFor
@ember/test-waiters
import { TaskFactory, registerModifier } from 'ember-concurrency' import { waitFor } from '@ember/test-waiters' declare module 'ember-concurrency' { interface TaskFactory<T, Args> { taskDefinition: Function & TaskDefinition<T, Args> } } function waitForTask<T, Args extends unknown[]>(taskFactory: TaskFactory<T, Args>, option: boolean) { if (!option) { return } const { taskDefinition } = taskFactory const waitForTaskDefinition = waitFor(function* (this: unknown, ...args: Args) { yield* taskDefinition.apply(this, args) }) taskFactory.setTaskDefinition(waitForTaskDefinition) } export function initialize() { registerModifier('waitFor', waitForTask) } export default { initialize, }
that will be great to bring this functionality back. I wonder if it's worth to built into ember-concurrency itself
ember-concurrency
Hello, I've added a custom task modifier to restore the functionality of
waitFor
from@ember/test-waiters
. Do you have any suggestions for improving the types for this custom modifier? Thank you in advance!