Skip to content

Commit

Permalink
feat(Stream): implement Success, Error, Context type accessors (#2959)
Browse files Browse the repository at this point in the history
  • Loading branch information
dilame authored and gcanti committed Jun 14, 2024
1 parent 46225a6 commit 1f17378
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/strong-pumpkins-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": minor
---

feat(Stream): implement Success, Error, Context type accessors
18 changes: 18 additions & 0 deletions packages/effect/src/Stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,24 @@ export declare namespace Stream {
}
}

/**
* @since 3.4.0
* @category type-level
*/
export type Success<T extends Stream<any, any, any>> = [T] extends [Stream<infer _A, infer _E, infer _R>] ? _A : never

/**
* @since 3.4.0
* @category type-level
*/
export type Error<T extends Stream<any, any, any>> = [T] extends [Stream<infer _A, infer _E, infer _R>] ? _E : never

/**
* @since 3.4.0
* @category type-level
*/
export type Context<T extends Stream<any, any, any>> = [T] extends [Stream<infer _A, infer _E, infer _R>] ? _R : never

/**
* @since 2.0.0
* @category models
Expand Down

0 comments on commit 1f17378

Please sign in to comment.