Skip to content

Commit

Permalink
feat: expose useful types
Browse files Browse the repository at this point in the history
  • Loading branch information
sheerlox committed Sep 26, 2023
1 parent 2b86223 commit 6a1816d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
7 changes: 7 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import { CronTime } from './time';
export { CronJob } from './job';
export { CronTime } from './time';

export {
CronCommand,
CronJobParams,
Ranges,
TimeUnit
} from './types/cron.types';

export const sendAt = (cronTime: string | Date | DateTime): DateTime =>
new CronTime(cronTime).sendAt();

Expand Down
12 changes: 6 additions & 6 deletions src/types/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
export type Enumerate<
export type IntRange<F extends number, T extends number> = Exclude<
Enumerate<T>,
Enumerate<F, false>
>;

type Enumerate<
N extends number,
WithTail extends boolean = true,
Acc extends number[] = []
Expand All @@ -7,8 +12,3 @@ export type Enumerate<
? [...Acc, Acc['length']][number]
: Acc[number]
: Enumerate<N, WithTail, [...Acc, Acc['length']]>;

export type IntRange<F extends number, T extends number> = Exclude<
Enumerate<T>,
Enumerate<F, false>
>;

0 comments on commit 6a1816d

Please sign in to comment.