feat: make Instance.create optional to fix type compatibility#64
Open
feat: make Instance.create optional to fix type compatibility#64
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: wevm#43
This change addresses issue wevm#43 by making the `create` method optional on the Instance type. Previously, the Pool used an internal `Instance_` type (defined as `Omit<Instance, 'create'>`) which was incompatible with the public `Instance` type, causing type errors when users tried to type pool-returned instances as `Instance`. Changes: - Make `create` property optional in Instance type (`create?` instead of `create`) - Remove the internal `Instance_` type alias from Pool.ts - Update Pool to use `Instance` type directly - Add runtime check for create method in Pool.start() - Update create method return type to return full Instance 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This reverts commit 2b04d34.
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
Author
🔄 Auto-restart 1/3Detected uncommitted changes from previous run. Starting new session to review and commit them. Uncommitted files: Auto-restart will stop after changes are committed or after 2 more iterations. Please wait until working session will end and give your feedback. |
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes issue #43 by making the
createmethod optional on theInstancetype, which allows pool-returned instances to be properly typed asInstance.Problem
Previously, users couldn't type their code properly when using the Pool:
This error occurred because:
Poolinternally usedInstance_type (defined asOmit<Instance, 'create'>)start()returnedInstance_instead ofInstanceInstance_was not assignable toInstancedue to the missingcreatepropertySolution
Instead of using the internal
Instance_type, we:createoptional in theInstancetype definition (create?instead ofcreate)Instance_internal type from Pool.ts entirelyInstancetype directly for all its methodsPool.start()to ensure the instance has acreatemethod when creating new instancescreatemethod to returnInstance<_internal>instead ofOmit<Instance<_internal>, 'create'>After this change
The
Instancetype now properly represents both:createmethod)createmethod)Test plan
pnpm check:types)pnpm check)Fixes #43
🤖 Generated with Claude Code