Skip to content

feat: add promise success diagnostic - #460

Merged
mattiamanzati merged 1 commit into
mainfrom
feat/promise-in-effect-success
Jul 28, 2026
Merged

feat: add promise success diagnostic#460
mattiamanzati merged 1 commit into
mainfrom
feat/promise-in-effect-success

Conversation

@mattiamanzati

Copy link
Copy Markdown
Contributor

Summary

  • add the promiseInEffectSuccess correctness diagnostic for Effect v3 and v4
  • inspect strict Effect<A, E, R> success channels across runtime expressions and report native Promise members, including unions
  • use resolved call return types and innermost-expression deduplication so custom factories, generators, property access, and Effect combinators are covered
  • preserve explicitly intentional Effect<Promise<...>> annotations, return types, assertions, and success-producing generic arguments

Example

declare const save: (value: number) => Promise<void>

const program = Effect.succeed(1).pipe(
  Effect.map(save)
)
//                ^ Effect success channel contains an unawaited Promise

The diagnostic recommends representing the asynchronous work with Effect.promise or Effect.tryPromise. Strict Promise identity intentionally excludes PromiseLike and arbitrary thenables.

Validation

  • pnpm setup-repo
  • pnpm lint
  • pnpm check
  • pnpm test

Closes #405

@mattiamanzati
mattiamanzati merged commit 7af1a90 into main Jul 28, 2026
4 checks passed
@mattiamanzati
mattiamanzati deleted the feat/promise-in-effect-success branch July 28, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rule proposal: Promise ends up in an Effect success channel, silently wrapped and never awaited

1 participant