thefrontside / thefrontside/effection

Narrow `Coroutine['data']['exit']` resolver from `Result<unknown>` to `Result<void>`

Open Beginner friendly
#1,191 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
856
Forks
39
Avg merge
2d 8h
Merged PRs (30d)
8

Description

What

In lib/types.ts:

export interface Coroutine<T = unknown> {
  data: {
    exit(resolve: Resolve<Result<unknown>>): void;
    ...
  };
}

The exit callback's resolver should be Resolve<Result<void>>, not Resolve<Result<unknown>>.

Why

The exit signal carries either "done OK" or "an error happened" — never a value. Every source of data.exit already produces Result<void>:

  • noopExit resolves with Ok() (which is Result<void> per the overload in lib/result.ts)
  • effect.enter() is declared to return (resolve: Resolve<Result<void>>) => void (types.ts:361)

The wider Result<unknown> type forces explicit casts at definition sites (e.g., custom Effect definitions whose exit returns Ok()), even though the value channel is unused.

Impact

The only read site is lib/coroutine.ts:51, which inspects exitResult.ok and assigns the Err variant to data.resumeWith (which is Result<unknown>). Result<void>'s Err variant is structurally identical to Result<unknown>'s Err variant, so narrowing the type is non-breaking.

Out of scope

Not blocking — the workaround is a cast at the call site.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/types.ts at the Coroutine data.exit resolver and compare its type with the Result sources described in the issue, including noopExit and effect.enter() at types.ts:361. Check lib/coroutine.ts:51 to confirm the read site still handles the Err variant; done means the resolver uses Resolve<Result> without requiring the noted casts.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.