Skip to content
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

Improve types #25

Merged
merged 7 commits into from
Jan 21, 2025
Merged

Improve types #25

merged 7 commits into from
Jan 21, 2025

Conversation

pawcoding
Copy link
Owner

@pawcoding pawcoding commented Jan 19, 2025

Changes

  • Add option to improve types
    This improveTypes option removes undefined from number and boolean values. PocketBase does return 0 and false automatically, but this is not reflected in the collection schema.

pawcoding and others added 3 commits January 19, 2025 19:30
This option removes `undefined` from number and boolean values and
provides default values with `0` and `false`, respectively. PocketBase
does this automatically under the hood, but this is not reflected in the
collection schema.
# [2.2.0-next.1](v2.1.0...v2.2.0-next.1) (2025-01-19)

### Features

* **schema:** add option to improve types ([d8c9780](d8c9780))
@pawcoding pawcoding added the released on @next [bot] This is available in a pre-release label Jan 19, 2025
@pawcoding pawcoding self-assigned this Jan 19, 2025
@pawcoding pawcoding requested a review from lujoho January 19, 2025 18:45
@pawcoding pawcoding marked this pull request as draft January 19, 2025 20:38
pawcoding and others added 3 commits January 20, 2025 19:59
Using `z.default` adds `undefined` to generated types. Not sure why,
since I explicitly provide a default value so that the property cannot
be `undefined` but well...

More info:
https://stackoverflow.com/questions/76396222/zod-using-optional-with-default-infers-the-wrong-type
# [2.2.0-next.2](v2.2.0-next.1...v2.2.0-next.2) (2025-01-20)

### Bug Fixes

* **schema:** remove default values from improved types ([82b6b70](82b6b70))
@pawcoding
Copy link
Owner Author

🎉 This PR is included in version 2.2.0-next.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@pawcoding pawcoding marked this pull request as ready for review January 20, 2025 19:04
README.md Outdated Show resolved Hide resolved
src/utils/parse-schema.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@lujoho lujoho left a comment

Choose a reason for hiding this comment

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

Just two small cosmetical suggestions in text/comments.
Aside from that nothing speaks against merging this PR from my side.
Nice that the default returns of the Pocketbase API can now also be used in the loader.

@pawcoding pawcoding merged commit 49fcf05 into master Jan 21, 2025
1 check passed
@pawcoding pawcoding deleted the next branch January 21, 2025 19:23
@pawcoding
Copy link
Owner Author

🎉 This PR is included in version 2.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@pawcoding pawcoding added the released [bot] This is available in a release label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released on @next [bot] This is available in a pre-release released [bot] This is available in a release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants