machty / ember-concurrency

ember-concurrency is an Ember Addon that enables you to write concise, worry-free, cancelable, restartable, asynchronous tasks.
http://ember-concurrency.com
MIT License
691 stars 155 forks source link

`dropTask` not properly typed #485

Closed mydea closed 1 year ago

mydea commented 1 year ago

I am currently trying to migrate decorator-based tasks to the new (really cool!) async-based tasks.

However, in our TS app it seems that while this works and is nicely typed:

myTask = task(async () => {});

This triggers type errors:

myTask = dropTask(async () => {});
myTask = enqueueTask(async () => {});

Are these "shortcut" task definitions not supported anymore? Or is this a bug? :sweat_smile:

machty commented 1 year ago

Fixed in 2.3.3, thank you for the report!

Techn1x commented 1 year ago

I was very confused when the codemod refactored to dropTask etc. and I got errors, so I refactored them all to the general style with task({ drop: true }, ... :laughing: well there was a bunch of work I didn't need to do :)

Techn1x commented 1 year ago

(thanks for the fix, of course!)