Skip to content

use NoInfer on predicate parameter in recurWhile, recurUntil, collectWhile, collectUntil#6262

Open
harsha-cpp wants to merge 1 commit into
Effect-TS:mainfrom
harsha-cpp:fix/schedule-recurwhile-noinfer-predicate
Open

use NoInfer on predicate parameter in recurWhile, recurUntil, collectWhile, collectUntil#6262
harsha-cpp wants to merge 1 commit into
Effect-TS:mainfrom
harsha-cpp:fix/schedule-recurwhile-noinfer-predicate

Conversation

@harsha-cpp
Copy link
Copy Markdown

fixes #6251.

problem: Schedule.recurWhile((data) => data === "foo"`` infers dataasunknowninstead of the success type when used insideEffect.repeat. TypeScript eagerly resolves Afromf: Predicate` at the call site where there's no contextual type for the predicate parameter.

fix: wrap the predicate with NoInfer<A> on the four public signatures with this shape. TypeScript stops inferring A from the predicate and picks it up from the In channel of the surrounding repeat instead.

type test added in dtslint/Schedule.tst.ts.

@harsha-cpp harsha-cpp requested a review from mikearnaldi as a code owner June 6, 2026 20:33
@github-project-automation github-project-automation Bot moved this to Discussion Ongoing in PR Backlog Jun 6, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 6, 2026

🦋 Changeset detected

Latest commit: 9fe7d8c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
effect Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Discussion Ongoing

Development

Successfully merging this pull request may close these issues.

Schedule.recurWhile not inferring types with Effect.repeat

1 participant