Skip to content

Commit

Permalink
feat(effect/Micro): add isMicroCause (#3501)
Browse files Browse the repository at this point in the history
Co-authored-by: Tim <hello@timsmart.co>
  • Loading branch information
juliusmarminge and tim-smart committed Aug 30, 2024
1 parent 718cb70 commit db89601
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/chilled-toys-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": patch
---

add `Micro.isMicroCause` guard
9 changes: 8 additions & 1 deletion packages/effect/src/Micro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { StructuralPrototype } from "./internal/effectable.js"
import { SingleShotGen } from "./internal/singleShotGen.js"
import * as Option from "./Option.js"
import { type Pipeable, pipeArguments } from "./Pipeable.js"
import { isIterable, isTagged, type Predicate, type Refinement } from "./Predicate.js"
import { hasProperty, isIterable, isTagged, type Predicate, type Refinement } from "./Predicate.js"
import type { ReadonlyRecord } from "./Record.js"
import type { Sink, SinkTypeId } from "./Sink.js"
import type { Stream, StreamTypeId } from "./Stream.js"
Expand Down Expand Up @@ -171,6 +171,13 @@ export type MicroCauseTypeId = typeof MicroCauseTypeId
*/
export type MicroCause<E> = MicroCause.Die | MicroCause.Fail<E> | MicroCause.Interrupt

/**
* @since 3.6.6
* @experimental
* @category guards
*/
export const isMicroCause = (self: unknown): self is MicroCause<unknown> => hasProperty(self, MicroCauseTypeId)

/**
* @since 3.4.6
* @experimental
Expand Down

0 comments on commit db89601

Please sign in to comment.