-
Notifications
You must be signed in to change notification settings - Fork 505
Open
Labels
bugSomething isn't workingSomething isn't working
Description
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
For nullable columns, even if the query includes a not null check (e.g. .not("column_name", "is", null)), the inferred return type for that column is still nullable.
To Reproduce
- Create a
blog_poststable with a nullable column,published_at.
create table blog_posts(
id uuid primary key default uuid_generate_v4(),
title text not null,
created_at timestamptz not null default now(),
published_at timestamptz
);- Query this table to retrieve all published blog posts.
const { data } = await supabase
.from("blog_posts")
.select("*")
.not("published_at", "is", null);- Observe that the
published_atfield indatais still typed as nullable.
const data: {
id: string;
title: string;
created_at: string;
published_at: string | null; // <-- why is this nullable?
}[] | nullExpected behavior
Inferred type for published_at should not be nullable.
System information
- Version of supabase-js: 2.48.0
atsixian, liaujianjie, ckcherry23, ibnuh and raky291
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working