Open
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_posts
table 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_at
field indata
is still typed as nullable.
const data: {
id: string;
title: string;
created_at: string;
published_at: string | null; // <-- why is this nullable?
}[] | null
Expected behavior
Inferred type for published_at
should not be nullable.
System information
- Version of supabase-js: 2.48.0