From 91c8b2066de18c2b7ec4b204c3649c4956e63d49 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli Date: Sat, 4 Dec 2021 20:04:06 -0500 Subject: [PATCH] fix(types): better ember-concurrency@v1 support in typescript Issue: https://github.com/NullVoxPopuli/ember-resources/issues/297 Resolves this issue: ``` Argument of type 'TaskForAsyncTaskFunction<() => Promise>' is not assignable to parameter of type 'TaskIsh'. The types returned by 'perform(...).cancel(...)' are incompatible between these types. Type 'void' is not assignable to type 'Promise'. ``` --- .github/workflows/types.yml | 2 +- .../src/-private/resources/ember-concurrency-task.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/types.yml b/.github/workflows/types.yml index c3241f9f0..6c5f48730 100644 --- a/.github/workflows/types.yml +++ b/.github/workflows/types.yml @@ -64,5 +64,5 @@ jobs: - run: | cd ember-resources yarn build:types - cd ../testing/ember-concurrency-v1-tests/ + cd ../testing/ember-concurrency-v1/ tsc --build diff --git a/ember-resources/src/-private/resources/ember-concurrency-task.ts b/ember-resources/src/-private/resources/ember-concurrency-task.ts index 155f96460..d8c441e9c 100644 --- a/ember-resources/src/-private/resources/ember-concurrency-task.ts +++ b/ember-resources/src/-private/resources/ember-concurrency-task.ts @@ -34,7 +34,7 @@ export interface TaskInstance extends Promise { readonly isFinished: boolean; readonly isRunning: boolean; readonly isDropped: boolean; - cancel(reason?: string): Promise; + cancel(reason?: string): void | Promise; } // @private