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

Generated type for JSONB NOT NULL column allows null #585

Open
2 tasks done
nicksiscoe opened this issue Nov 21, 2024 · 0 comments
Open
2 tasks done

Generated type for JSONB NOT NULL column allows null #585

nicksiscoe opened this issue Nov 21, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@nicksiscoe
Copy link

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

When I create a JSONB column that is explicitly NOT NULL, I can see that null values are not allowed according to Supabase Studio (it understands the Postgres restriction exists).

image

When I generate Typescript types for this database, however, the Json type for this column allows null.

image image

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Create a non-nullable JSONB column
  2. Run supabase gen types --lang=typescript
  3. View the generated type for the column, which is Json

Expected behavior

I would expect the Typescript type for this column to be NonNullable<Json>.

Screenshots

(See above)

System information

  • OS: macOS
  • supabase: ^1.200.3
  • Node: v20
@nicksiscoe nicksiscoe added the bug Something isn't working label Nov 21, 2024
@saltcod saltcod transferred this issue from supabase/supabase Dec 10, 2024
@saltcod saltcod transferred this issue from supabase/postgrest-js Dec 10, 2024
@steve-chavez steve-chavez transferred this issue from supabase/supabase Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant