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 typing when attribute are not nullable #465

Open
LouisPinsard opened this issue Apr 6, 2023 · 1 comment
Open

Improve typing when attribute are not nullable #465

LouisPinsard opened this issue Apr 6, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@LouisPinsard
Copy link

Hello again!

Currently even with the nulls attribute set to false, the return type of all model methods indicates that non-nullable attribute is: AttributeType | undefined | null.

Would be great to have AttributeType | undefined in those cases.

The idea would be to have :
type Entity<T extends OneModel> = Flatten<Merge<Required<T>, Optional<T>>> instead of type Entity<T extends OneModel> = Flatten<Merge<Required<T>, OptionalOrNull<T>>>

wdyt? happy to help if I can!

@mobsense
Copy link
Contributor

mobsense commented Apr 7, 2023

Sounds good.

Again, a PR would be great.

I'm looking for someone with stronger TS skills than mine to help contribute on these tasks.

Soon, I'd actually like to rewrite the code into TS directly also -- but that is a separate task.

@mobsense mobsense added the enhancement New feature or request label Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants