-
-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to import helper types since 1.15.6 #551
Comments
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. |
I'm also using |
If I understand correctly, there were three way to get result types:
1 wasn't supported and was somewhat painful. 2 doesn't give much flexibility for creating helper functions etc. 3 is heavy. Could we please get a supported way of creating query result types that doesn't require running or wrapping a query? |
This is a major breaking change for us, making developer experience much worse. Any kind of higher order abstractions that pass through types become much more difficult to build. |
Internal or not, since there's no other good alternative, the community has been forced to use it, as you can see below: |
@lauri865 that's some really nice evidence there - didn't know soo many others had to "hack" their way into the lib to find that GetResult type and figure out how to use it etc. If I had some time at hand I would love to make a PR myself on this, but currently that's not possible for me. |
Also would like to +1 this, it makes it extremely easy to be able to type the results from a query. I was inspired by the Supabase Cache Helpers library which uses this method heavily too. Would really appreciate if this was provided externally 🙏 |
Thanks all, seems like a proper support is needed here. I'll see if this can be accomplished with the already exported QueryResult or, failing that, we'll reexport GetResult |
That's wonderful news! btw @soedirgo: Isn't |
Hey, is there any progress on this or is there anything we could help with? |
Hi all, in an attempt to help move things along I made a simple PR. Let me know if this can be improved :) |
As an additional +1 here, I also want to mention that this is used by |
Hey, sorry to bother you @soedirgo, but think this might be implemented? |
Yea this is holding me up on upgrading as well, we have as PR #560 at your convenience |
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.
The text was updated successfully, but these errors were encountered: