-
Notifications
You must be signed in to change notification settings - Fork 0
Add explicit nullability to replace boolean #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 introduces explicit nullability options for entity field definitions, allowing developers to use 'NULLABLE' and 'NOT NULL' string literals instead of boolean values for better code readability. The change maintains backward compatibility with existing boolean values.
Key changes:
- Adds new
Nullabletype that accepts string literals or legacy boolean values - Introduces
isNullable()helper function to handle both old and new nullability formats - Refactors type definitions into separate modules for better organization
Reviewed Changes
Copilot reviewed 18 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/entities/Nullable.ts | Defines new nullability types and helper function |
| src/entities/BaseEntity.ts | Updates field and relation types to use new Nullable type |
| src/main.ts | Major refactor moving types to separate modules and updating nullability checks |
| src/types/*.ts | New type definition modules extracted from main.ts |
| src/helpers/sql.ts | Adds mergeSql function extracted from main.ts |
| src/relations/ormRelationGetter.ts | Extracts ORM relation getter logic into separate module |
| src/tools/validateSchema.ts | Updates import paths |
| tests/testHelpers.ts | Updates import path for relation getter function |
| .changeset/fair-knives-notice.md | Documents the feature addition |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
6e28658 to
666ed7c
Compare
666ed7c to
986174d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 18 out of 21 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Merge #6 first
This adds explicit nullability, the ability to provide 'NULLABLE' and 'NOT NULL' instead of true and false. This makes it clearer what is going on at a glance. In the future we'll probably deprecate passing the booleans and remove it in the next major release.