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

Ember 4.8 types preview issue #510

Closed machty closed 1 year ago

machty commented 1 year ago

https://blog.emberjs.com/announcing-official-typescript-types-public-preview/

../node_modules/ember-concurrency/addon/index.d.ts:379:11 - error TS2315: Type 'ComputedProperty' is not generic.

379   extends ComputedProperty<T> {
              ~~~~~~~~~~~~~~~~~~~

../node_modules/ember-concurrency/addon/index.d.ts:558:47 - error TS2315: Type 'ComputedProperty' is not generic.

558 export interface TaskGroupProperty<T> extends ComputedProperty<TaskGroup<T>> {

Issue is due to ComputedProperty's Get type parameter being removed. We don't have a solution yet but see here for further discussion:

https://discord.com/channels/480462759797063690/484421406659182603/1062000162341396481

gitKrystan commented 1 year ago

I was tinkering with this today and came to the same conclusion as you did in https://discord.com/channels/480462759797063690/484421406659182603/1062000162341396481 : Trying to fix this within e-c's types breaks get's "unwrapping" of task properties into tasks.

Since the native types dropped support for the old object model, which I believe will break the unwrapping anyway, I'm wondering if there is any remaining benefit to inheriting from ComputedProperty anymore. AFAICT this is only done for get anyway: https://github.com/machty/ember-concurrency/blob/624d747f82db20691ab70724dabe89233f367601/tests/types/ember-concurrency-test.ts#L797-L798

I did a quick spike of what this might look like: https://github.com/machty/ember-concurrency/pull/512 This version of e-c resolves the issue reported above in my dogfood app.