Skip to content

Commit

Permalink
Fix Schedule option types
Browse files Browse the repository at this point in the history
  • Loading branch information
krispya committed Jun 3, 2024
1 parent 06dc5ef commit 10d4dc6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/scheduler/src/class/schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class Schedule<T extends Scheduler.Context = Scheduler.Context> {
this.symbols = new Map<symbol | string, Runnable<T>>();
}

add(runnable: Runnable<T>, options?: OptionsObject): Schedule<T> {
add(runnable: Runnable<T>, options?: OptionsObject<T>): Schedule<T> {
const optionsFns = createOptionsFns<T>(options);
add(this, runnable, ...optionsFns);

Expand All @@ -50,7 +50,7 @@ export class Schedule<T extends Scheduler.Context = Scheduler.Context> {
return this;
}

createTag(id: symbol | string, options?: OptionsObject): Schedule<T> {
createTag(id: symbol | string, options?: OptionsObject<T>): Schedule<T> {
const optionsFns = createOptionsFns<T>(options);
createTag(this, id, ...optionsFns);
return this;
Expand Down
6 changes: 3 additions & 3 deletions packages/scheduler/src/class/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Runnable } from '../scheduler-types';

export type OptionsObject = {
export type OptionsObject<T extends Scheduler.Context = Scheduler.Context> = {
id?: symbol | string;
before?: symbol | string | Runnable | (symbol | string | Runnable)[];
after?: symbol | string | Runnable | (symbol | string | Runnable)[];
before?: symbol | string | Runnable<T> | (symbol | string | Runnable<T>)[];
after?: symbol | string | Runnable<T> | (symbol | string | Runnable<T>)[];
tag?: symbol | string | (symbol | string)[];
};
2 changes: 1 addition & 1 deletion packages/scheduler/src/class/utils/create-options-fns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { OptionsObject } from '../types';

export function createOptionsFns<
T extends Scheduler.Context = Scheduler.Context
>(options: OptionsObject | undefined): OptionsFn<T>[] {
>(options: OptionsObject<any> | undefined): OptionsFn<T>[] {
const optionsFns: OptionsFn[] = [];

if (options?.id) {
Expand Down

0 comments on commit 10d4dc6

Please sign in to comment.