Effect CommunityEC
Effect Community4w ago
16 replies
Storm

Issue with Pipe vs Flow in TypeScript

Can anyone tell me why this manual piping version works but the flow version doesn't? Am I misunderstanding pipe/flow or is this just a limitation of the type system?
(expression) =>
    pipe(
      Match.value(expression),
      Match.when(Array.isEmptyReadonlyArray, () => []),
      Match.when(Array.isNonEmptyReadonlyArray, Array.unprepend)
    )

// vs

flow(
      Match.value,
      Match.when(Array.isEmptyReadonlyArray, () => []),
      Match.when(Array.isNonEmptyReadonlyArray, Array.unprepend)
    )
Was this page helpful?