postgrest-js icon indicating copy to clipboard operation
postgrest-js copied to clipboard

Type checker for upsert/insert do not warn of nonexistent columns

Open wyozi opened this issue 1 year ago • 0 comments

Bug report

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

Describe the bug

.insert and .upsert do not warn if the object includes a nonexistent column, whereas TablesInsert type used directly does

To Reproduce

postgrest.from("users").insert({ name: "James", i_dont_exist: "xyz" })

does not error even if

const payload: TablesInsert<"users"> = {
  name: "James",
  i_dont_exist: "xyz",
};

would

Expected behavior

The insert/upsert methods would cause type errors when passing nonexistent columns

System information

  • "@supabase/supabase-js": "2.46.1",

wyozi avatar Nov 06 '24 07:11 wyozi