Skip to content

Commit

Permalink
Expose Schedule.isSchedule (#4344)
Browse files Browse the repository at this point in the history
  • Loading branch information
IMax153 authored Jan 28, 2025
1 parent 62934fc commit 7b03057
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/shy-nails-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": patch
---

Expose `Schedule.isSchedule`
8 changes: 8 additions & 0 deletions packages/effect/src/Schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ export const makeWithState: <S, In, Out, R = never>(
) => Effect.Effect<readonly [S, Out, ScheduleDecision.ScheduleDecision], never, R>
) => Schedule<Out, In, R> = internal.makeWithState

/**
* Returns `true` if the specified value is a `Schedule`, `false` otherwise.
*
* @since 2.0.0
* @category guards
*/
export const isSchedule: (u: unknown) => u is Schedule<unknown, never, unknown> = internal.isSchedule

/**
* Returns a new schedule with the given delay added to every interval defined
* by this schedule.
Expand Down
3 changes: 2 additions & 1 deletion packages/effect/src/internal/schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export const ScheduleTypeId: Schedule.ScheduleTypeId = Symbol.for(
) as Schedule.ScheduleTypeId

/** @internal */
export const isSchedule = (u: unknown): u is Schedule.Schedule<any, any, any> => hasProperty(u, ScheduleTypeId)
export const isSchedule = (u: unknown): u is Schedule.Schedule<unknown, never, unknown> =>
hasProperty(u, ScheduleTypeId)

/** @internal */
const ScheduleDriverSymbolKey = "effect/ScheduleDriver"
Expand Down

0 comments on commit 7b03057

Please sign in to comment.