Using ember-concurrency with TypeScript

The documentation below covers how to use ember-concurrency v2.3+ with Ember Octane. For older versions of ember-concurrency (or pre-Octane Ember), please see the old guides.

ember-concurrency tasks play nicely with TypeScript and all of the APIs covered in these docs. Here is an example of a TypeScript component with an ember-concurrency task:

Typing Task objects

In most cases, you don't need to provide type annotations for your task, but when you do (such as when specifying the Args of a Glimmer component), you can use the Task type:

Version 2.2 and older

Support for TypeScript in ember-concurrency was recently greatly improved and simplified with the release of version 2.3, largely due to the introduction of the new async arrow task function syntax (e.g. myTask = task(async () => {})), which alleviated most / all of the prior challenges with getting ember-concurrency tasks to play nicely with TypeScript.

If you would like to see the TypeScript guides for older versions of ember-concurrency (or pre-Octane Ember), please see the old guides.