Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork147
Typescript: safer nullability in functions, domain support#573
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Add support for domains and take their nullability into account.Centralize logic in `pgTypeToTsType`.
jumski commentedNov 21, 2024
Hey@ngasull Postgres domains have some troubles withNOT NULL constraint:
But there is definitely a problem with serializing domain types with "gen-types" - they default to undefined. |
@jumski This PR only aims to improvefunction generated types, no impact on tables. So the changes are still relevant. Domains add a layer of safety over types at PostgreSQL runtime. Primitive types are unsafe (nullable) and it makes sense generate them as nullable unless they are a domain defined as NOT NULL. |
Donnerstagnacht commentedApr 24, 2025
jumski commentedApr 24, 2025
@ngasull thanks for clarification, Everything looks fine! |
eugeneford commentedMay 4, 2025
It would be incredibly amazing if we could have this done. When could we have this available? |
Uh oh!
There was an error while loading.Please reload this page.
What kind of change does this PR introduce?
Fixes#842
What is the current behavior?
Generated type with
supabase gen types typescript --local
What is the new behavior?
Generated types should be:
Please review tests for more details on new expected behavior.
pgTypeToTsType
.Additional context
This is obviously abreaking change for most users using functions. It is however the safe way, exposing sound types.