fix: update generated types to adhere to ElectroDB's types#29
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the generated ElectroDB entity types to properly adhere to ElectroDB's type signatures, specifically fixing validation function types and behavior. The main change converts validation functions from throwing-only to the ElectroDB-expected pattern of returning true for valid values and throwing errors for invalid values.
Key changes:
- Updated validation function generation to return
truefor valid values and throw errors for invalid values, matching ElectroDB's expected signature - Modified type declarations to use
(value: unknown) => booleaninstead of inferred literal return types - Updated all test assertions from
assert.doesNotThrow()toassert.equal(validate(...), true)to verify the new return behavior
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/emitter.ts | Modified validation function generation to match ElectroDB's signature; added regex post-processing to fix type declarations; refactored imports handling |
| test/entities.test.ts | Updated validation test assertions to check for true return values; changed property existence checks from undefined to in operator; added formatting improvements |
| test/electrodb.test.ts | Added new integration tests that instantiate ElectroDB entities to verify schema compatibility |
| package.json | Updated electrodb from 3.4.3 to 3.5.0; updated tsx from 4.20.3 to 4.21.0; changed test command to use TypeScript files with tsx loader |
| package-lock.json | Lock file updates for dependency version changes and transitive dependencies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fbb98c4 to
426e6ba
Compare
|
🎉 This PR is included in version 3.2.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
No description provided.