Skip to content

Add Effect v4 support for diagnostics, refactors, and piping#641

Merged
mattiamanzati merged 16 commits intomainfrom
more-v4
Feb 13, 2026
Merged

Add Effect v4 support for diagnostics, refactors, and piping#641
mattiamanzati merged 16 commits intomainfrom
more-v4

Conversation

@mattiamanzati
Copy link
Contributor

Summary

  • Adds comprehensive Effect v4 support across diagnostics, refactors, and piping features
  • Introduces new diagnostics: multipleEffectProvide, strictEffectProvide, missingLayerContext
  • Extends existing diagnostics (deterministicKeys, leakingRequirements, schemaSyncInEffect) for v4's ServiceMap.Service patterns and updated API surface
  • Adds new refactors: layerMagic (automatic layer composition) and structuralTypeToSchema (interface/type alias to Schema class conversion)
  • Enhances makeSchemaOpaque and typeToEffectSchema for v4's Codec, DecodingServices, and EncodingServices types
  • Adds pipe transformation support for v4 including Effect.fn, nested pipes, and function call conversions

New Diagnostics

multipleEffectProvide — Warns when multiple Effect.provide calls are chained consecutively, suggesting consolidation:

// Before (warns)
program.pipe(Effect.provide(layerA), Effect.provide(layerB))

// After (suggested fix)
program.pipe(Effect.provide(Layer.mergeAll(layerA, layerB)))

strictEffectProvide — Warns when using Effect.provide with a Layer outside of application entry points.

missingLayerContext — Detects missing Layer context requirements in Effect.Service declarations.

New Refactors

layerMagic — Automatically compose and build layers based on service dependencies:

// "Prepare layer" refactor on a Layer expression
// "Build layer" refactor to compose multiple layers

structuralTypeToSchema — Converts TypeScript interfaces and type aliases to Effect Schema classes:

// Before
interface User { name: string; age: number }

// After
class User extends Schema.Class<User>()({ name: Schema.String, age: Schema.Number }) {}

Test plan

  • pnpm lint-fix passes
  • pnpm check passes (no type errors)
  • pnpm test passes (493/493 tests)
  • Snapshot tests cover all new diagnostics, refactors, and piping features for v4

🤖 Generated with Claude Code

@changeset-bot
Copy link

changeset-bot bot commented Feb 13, 2026

🦋 Changeset detected

Latest commit: e99f63b

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

This PR includes changesets to release 1 package
Name Type
@effect/language-service Minor

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

@mattiamanzati mattiamanzati merged commit 693e5a5 into main Feb 13, 2026
6 checks passed
@mattiamanzati mattiamanzati deleted the more-v4 branch February 13, 2026 19:45
@github-actions github-actions bot mentioned this pull request Feb 13, 2026
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.

1 participant