You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From v5.0, Typescript is capable to analyze very complex types with string operations. It'll be convenient if the expanded relations can be typed effortlessly, i.e. not requiring any extra type annotations for each function call.
And this achieves strong types for arbitrary string queries as documented:
constcountriesWithCitiesQuery=supabase.from('countries').select(` id, name, cities ( id, name )`)typeCountriesWithCities=QueryData<typeofcountriesWithCitiesQuery>// well typed
BTW I don't take this as an urgent feature request. Would be nice-to-have after #152 got integrated into the official sdk. Just put it aside now.
And waiting for good news from the server refactorization 😋
Motivation
From v5.0, Typescript is capable to analyze very complex types with string operations. It'll be convenient if the expanded relations can be typed effortlessly, i.e. not requiring any extra type annotations for each function call.
Proof of concept
Typescript playground
Click to expand the long code
Preview screenshot:
Related issues
#152 Auto-generate record types
Since it's not about type generation, it can be coded into the repo instead of having a code generator to generate the types.
The text was updated successfully, but these errors were encountered: