Skip to content

Issue 31 effect implementation#33

Draft
evermake wants to merge 2 commits into31/isolated-declarationsfrom
cursor/issue-31-effect-implementation-c06e
Draft

Issue 31 effect implementation#33
evermake wants to merge 2 commits into31/isolated-declarationsfrom
cursor/issue-31-effect-implementation-c06e

Conversation

@evermake
Copy link
Member

Resolve isolatedDeclarations TypeScript errors by refactoring Data.TaggedClass, Data.TaggedError, and Context.Tag usage.

The isolatedDeclarations compiler option caused errors (TS9021, TS9038) when Data.TaggedClass, Data.TaggedError, and Context.Tag expressions were used directly in extends clauses or had computed property names. This PR fixes these by extracting the expressions into explicitly typed const variables and using interface merging with Object.defineProperty for computed [TypeId] properties, mirroring patterns found in the official Effect-TS repository.


Open in Web Open in Cursor 

Extract Data.TaggedClass/TaggedError/Context.Tag expressions from
extends clauses into intermediate const variables with explicit type
annotations, following the same pattern used by Effect's own
declaration output.

For Data.TaggedClass: use ReturnType<typeof Data.TaggedClass<Tag>>
For Data.TaggedError: use ReturnType<typeof Data.TaggedError<Tag>>
For Context.Tag: use Context.TagClass<Self, Id, Shape>

For computed [TypeId] properties in BotApiError classes: use
interface merging + Object.defineProperty on prototype to satisfy
both isolatedDeclarations and runtime type-checking.

Closes #31

Co-authored-by: Vladislav Deryabkin <evermake@users.noreply.github.com>
@cursor
Copy link

cursor bot commented Feb 26, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

Replace class-based patterns with idiomatic Effect alternatives:

- Data.TaggedClass → interface + Data.tagged (Content, Dialog, File,
  Markup, Text modules)
- Context.Tag class → Context.GenericTag (Bot, BotApi, BotApiTransport,
  BotApiUrl, Send modules)
- Data.TaggedError classes use _base naming convention matching
  Effect's own declaration output (BotApiError)

Additional changes:
- Dialog peer methods (dialogId, topic, directMessages) converted to
  standalone functions following Effect's functional style
- File.isInputFile guard replaces instanceof checks
- Constructor calls changed from new Foo({}) to Foo({})

Co-authored-by: Vladislav Deryabkin <evermake@users.noreply.github.com>
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.

2 participants