Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 0 additions & 52 deletions packages/ember-concurrency/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,58 +611,6 @@ export type AsyncTaskFunction<T, Args extends any[]> = (
...args: Args
) => Promise<T>;

/**
* Creates a task with the `drop` modifier applied.
*/
export function dropTask<
HostObject,
T extends AsyncArrowTaskFunction<HostObject, any, any[]>,
>(asyncArrowTaskFn: T): TaskForAsyncTaskFunction<HostObject, T>;
export function dropTask<
HostObject,
O extends TaskOptions,
T extends AsyncArrowTaskFunction<HostObject, any, any[]>,
>(baseOptions: O, asyncArrowTaskFn: T): TaskForAsyncTaskFunction<HostObject, T>;

/**
* Creates a task with the `enqueue` modifier applied.
*/
export function enqueueTask<
HostObject,
T extends AsyncArrowTaskFunction<HostObject, any, any[]>,
>(asyncArrowTaskFn: T): TaskForAsyncTaskFunction<HostObject, T>;
export function enqueueTask<
HostObject,
O extends TaskOptions,
T extends AsyncArrowTaskFunction<HostObject, any, any[]>,
>(baseOptions: O, asyncArrowTaskFn: T): TaskForAsyncTaskFunction<HostObject, T>;

/**
* Creates a task with the `keepLatest` modifier applied.
*/
export function keepLatestTask<
HostObject,
T extends AsyncArrowTaskFunction<HostObject, any, any[]>,
>(asyncArrowTaskFn: T): TaskForAsyncTaskFunction<HostObject, T>;
export function keepLatestTask<
HostObject,
O extends TaskOptions,
T extends AsyncArrowTaskFunction<HostObject, any, any[]>,
>(baseOptions: O, asyncArrowTaskFn: T): TaskForAsyncTaskFunction<HostObject, T>;

/**
* Creates a task with the `restartable` modifier applied.
*/
export function restartableTask<
HostObject,
T extends AsyncArrowTaskFunction<HostObject, any, any[]>,
>(asyncArrowTaskFn: T): TaskForAsyncTaskFunction<HostObject, T>;
export function restartableTask<
HostObject,
O extends TaskOptions,
T extends AsyncArrowTaskFunction<HostObject, any, any[]>,
>(baseOptions: O, asyncArrowTaskFn: T): TaskForAsyncTaskFunction<HostObject, T>;

/**
* A cancelation-aware variant of [Promise.all](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all).
* The normal version of a `Promise.all` just returns a regular, uncancelable
Expand Down
15 changes: 2 additions & 13 deletions packages/test-app/types-tests/ember-concurrency-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,14 @@ import {
allSettled,
animationFrame,
didCancel,
dropTask,
enqueueTask,
forever,
getModifier,
hasModifier,
hash,
hashSettled,
keepLatestTask,
race,
rawTimeout,
registerModifier,
restartableTask,
task,
timeout,
waitForEvent,
Expand Down Expand Up @@ -1608,7 +1604,8 @@ module('integration tests', () => {
test('classic ember', () => {
ClassicComponent.extend({
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
myTask: restartableTask(
myTask: task(
{ restartable: true },
async (immediately: boolean, ms: number = 500) => {
if (!immediately) {
await timeout(ms);
Expand Down Expand Up @@ -1939,14 +1936,6 @@ module('integration tests', () => {
return 'wow';
});

restartable = restartableTask(async () => {});
restartable2 = restartableTask({ maxConcurrency: 2 }, async () => {});
enqueue = enqueueTask(async () => {});
enqueue2 = enqueueTask({ maxConcurrency: 2 }, async () => {});
drop = dropTask(async () => {});
drop2 = dropTask({ maxConcurrency: 2 }, async () => {});
keepLatest = keepLatestTask(async () => {});
keepLatest2 = keepLatestTask({ maxConcurrency: 2 }, async () => {});
debug = task({ debug: true }, async () => {});
onState = task({ onState: () => {} }, async () => {});
onStateNull = task({ onState: null }, async () => {});
Expand Down