Skip to content

Commit

Permalink
fix type error when .pipe() has no arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Aug 20, 2024
1 parent f2a851f commit c42fac8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/itchy-moons-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": patch
---

fix type error when .pipe() has no arguments
3 changes: 3 additions & 0 deletions packages/effect/src/Pipeable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @category models
*/
export interface Pipeable {
pipe<A>(this: A): A
pipe<A, B>(this: A, ab: (_: A) => B): B
pipe<A, B, C>(this: A, ab: (_: A) => B, bc: (_: B) => C): C
pipe<A, B, C, D>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D
Expand Down Expand Up @@ -289,6 +290,8 @@ export interface Pipeable {
*/
export const pipeArguments = <A>(self: A, args: IArguments): unknown => {
switch (args.length) {
case 0:
return self
case 1:
return args[0](self)
case 2:
Expand Down

0 comments on commit c42fac8

Please sign in to comment.