thefrontside / thefrontside/effection
Narrow `Coroutine['data']['exit']` resolver from `Result<unknown>` to `Result<void>`
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>:
noopExitresolves withOk()(which isResult<void>per the overload inlib/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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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