Skip to content

fix: update generated types to adhere to ElectroDB's types#29

Merged
mvhenten merged 1 commit intomainfrom
feat-fix-validate
Dec 17, 2025
Merged

fix: update generated types to adhere to ElectroDB's types#29
mvhenten merged 1 commit intomainfrom
feat-fix-validate

Conversation

@mvhenten
Copy link
Owner

No description provided.

Copilot AI review requested due to automatic review settings December 17, 2025 16:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 true for valid values and throw errors for invalid values, matching ElectroDB's expected signature
  • Modified type declarations to use (value: unknown) => boolean instead of inferred literal return types
  • Updated all test assertions from assert.doesNotThrow() to assert.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.

@mvhenten mvhenten merged commit 411d030 into main Dec 17, 2025
3 checks passed
@mvhenten mvhenten deleted the feat-fix-validate branch December 17, 2025 17:10
@github-actions
Copy link

🎉 This PR is included in version 3.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants