Open olee opened 1 month ago
Hi! These helper types have always been internal and subject to breaking changes - they're not part of the API. Can you share your use case and why you need them?
The use case is exactly as described above: To generate types for table selects.
For example to write a component that accepts some data which has been selected somewhere else:
function MyUser(props: { entity: TablesSelect<'users', 'id,first_name,last_name,avatar'> }) {
return (
<div>...render user here...</div>
);
}
// ... at some other location
await supabaseClient.from('users').select('id,first_name,last_name,avatar')....;
This is extremly useful and currently prevents us from upgrading supabase client as this is not possible anymore now.
It also makes sense, as the other helper types (Tables
, TablesInsert
, TablesUpdate
) are available, but no type is exported to get a subset of a table.
Instead of exposing the internal type like GetResult
, I would like even more for a TablesSelect
type to be exported for everyone to use as part of the public API because it is extremely useful.
I'm also using GetResult
extensively as the data fetched from my queries is passed around various places in my frontend and I want to correctly type all components and functions that process it.
Bug report
Describe the bug
Before 1.15.6 it was possible to import helper types from
@supabase/postgrest-js
to perform type mappings etc. like this:However, starting from version 1.15.6 with the change to the package build (package.json etc), it became impossible to import any files from subdirectories of the build because of the exports configuration.
Expected behavior
All types of the library which are publicly exposed as part of generics, function arguments and whatsoever should be properly exported imho so that it is possible to properly type code depending on postgrest-js.
The easiest solution would probably be to export helper types through some namespace from index.ts.