Skip to content

Commit

Permalink
Improve DX of type errors from inside pipe and flow (#3731)
Browse files Browse the repository at this point in the history
Co-authored-by: Oliver Joseph Ash <[email protected]>
  • Loading branch information
patroza and OliverJAsh authored Oct 5, 2024
1 parent b00f7a0 commit 5266b6c
Show file tree
Hide file tree
Showing 4 changed files with 556 additions and 52 deletions.
5 changes: 5 additions & 0 deletions .changeset/rare-beds-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": patch
---

Improve DX of type errors from inside `pipe` and `flow`
27 changes: 27 additions & 0 deletions packages/effect/dtslint/Function.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { identity, Option } from "effect"
import { flow, pipe } from "effect/Function"

// We should only have one error for the missing definition.
const _x = (): number =>
pipe(
1,
// @ts-expect-error
add(1),
identity
)

// We should only have one error for the missing definition.
const _y = (): (n: number) => number =>
flow(
// @ts-expect-error
add(1),
identity
)

// We should only have one error for the missing definition.
const _z = (): number =>
Option.some(1).pipe(
// @ts-expect-error
add(1),
identity
)
Loading

0 comments on commit 5266b6c

Please sign in to comment.