Prevent Effect.updateService and Effect.updateServiceScoped supertype widening - #7027
Conversation
🦋 Changeset detectedLatest commit: d50993d The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
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 |
30ad40e to
d50993d
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
packages/effect/src/Effect.ts: AddedNoInfer<A>to the return type of the updater function inEffect.updateService(both overloads) andEffect.updateServiceScoped, preventing TypeScript from widening the inferred service type via the updater return value.packages/effect/typetest/Effect.tst.ts: Added three TSTyche type tests that assert returning a supertype (string) from the updater is rejected for a literal service ("LITERAL")..changeset/funny-ears-beam.md: Added a patch changeset foreffect.
This is a narrow, type-only fix analogous to #7025. The runtime implementation in internal/effect.ts is unchanged and correct; only the public type signatures are tightened.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|

Type
Description
Analogous to #7025 - some additional methods related to services that I've spotted.
Added tests failing without these changes:
Related
#7025