-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
waitFor: #241
Comments
Hmm, I don't think we should change to returning any there. We could change it to |
🤔 |
I can poke at this and see what I can come up with. |
Should it be |
Now that ember-concurrency 2.3.x includes the async "taskFor" syntax for e-c tasks, this issue's probably going to come up a bit more as folks move to the new syntax For a task with the updated e-c syntax like this; // book-finder/service.ts
@waitFor
searchBooks = task({ drop: true }, async (search: string) => {
const booksResult = await this.store.query('book-library/book', { filter: { search } })
return booksResult
}) The typescript error looks like this
|
Actually, it turns out the types is the smaller problem now - the existing methods of using For simpler tasks I've been able to get away with this format, but anything with more than one await in it gets a bit ugly searchBooks = task({ drop: true }, async (search: string) => {
const booksResult = await waitFor(this.store.query('book-library/book', { filter: { search } }))
return booksResult
}) or waitForPromise(this.searchBooks.perform('abc')) |
@Techn1x Could you please check the following case ? Calling a
Looks like, the error is thrown if a Task is const PROMISE = waitForPromise(this.taskXYZ.perform());
PROMISE.catch((error) => {
console.info(error);
}); |
As long as waitFor() with ember-concurrency don't seem to work with the new syntax, I'm using this custom task modifier
and defining task as |
For anyone watching this issue, this PR when merged should resolve it. Is anyone here able to merge it? Will need e-c 3.1.0 and the syntax is queryStats = task(
{ restartable: true },
waitFor(async (query: typeof this.query) => {
// stuff
}),
) |
The Error
This is an code that looks like:
using:
I believe the fix would be to make this change:
This is with TypeScript 4.1.2
I've worked around this via:
The text was updated successfully, but these errors were encountered: