-
Notifications
You must be signed in to change notification settings - Fork 538
Open
Labels
bugSomething isn't workingSomething isn't workinghas workaroundIssue has a valid workaround.Issue has a valid workaround.postgrest-jsRelated to the postgrest-js library.Related to the postgrest-js library.
Description
- 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 use a json path in select() the type inference produces non nullable types even when the return type might be null.
To Reproduce
- Create a table with a column
json_colthat can be null and override the database type to be{ a: string } | null - Create a query with
.select('json_col->a') - Return type will be { a: string }
Expected behavior
This query will actually return `{ a: null } when the column is null. This should be reflected in the type.
This should be the case when the column is nullable or when one of the properties along the path is nullable.
I currently only have this type safety when I do
const { data } = ...select('json_col');
data!.json_col.a; // Object is possibly 'null'.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghas workaroundIssue has a valid workaround.Issue has a valid workaround.postgrest-jsRelated to the postgrest-js library.Related to the postgrest-js library.