supabase / postgrest-js

Isomorphic JavaScript client for PostgREST.
https://supabase.com
MIT License
967 stars 130 forks source link

Return typings for RPCs with the JavaScript-client #374

Closed steve-chavez closed 1 year ago

steve-chavez commented 1 year ago

Discussed in https://github.com/supabase/supabase/discussions/10464

Originally posted by **ameesme** November 22, 2022 We are using Supabase with a couple of RPCs and noticed that TypeScript return-types are defined as `Record[]` instead of the actual return-values described in the Postgres function-definition. Is this expected behavior? ## Example ### Postgres Function ```sql CREATE OR REPLACE FUNCTION public.job_get_recommendations( skills bigint[], weekly_hours integer, location_geo json, travel_distance_kilometers integer ) RETURNS TABLE( id integer, title character varying, description character varying, skills bigint[], travel_distance_kilometers integer, location_geo json, score integer, reason recommendation_reasons[] ) ``` ### Generated Typescript-definition ```js job_get_recommendations: { Args: { skills: unknown weekly_hours: number location_geo: Json travel_distance_kilometers: number } Returns: Record[] } ```
soedirgo commented 1 year ago

Closing in favor of https://github.com/supabase/cli/issues/635