Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

docs(ref/js): add db `.returns()` method

Bobbie Soedirgo52b9645d9e5a
diff --git a/spec/common-client-libs-sections.json b/spec/common-client-libs-sections.json
index ae606a8c005..b77ac83e9f2 100644
--- a/spec/common-client-libs-sections.json
+++ b/spec/common-client-libs-sections.json
@@ -358,6 +358,14 @@
"product": "database",
"parent": "modifiers",
"type": "function"
+ },
+ {
+ "id": "returns",
+ "title": "Override type of successful response",
+ "slug": "db-returns",
+ "product": "database",
+ "parent": "modifiers",
+ "type": "function"
}
]
}
diff --git a/spec/supabase_js_v2.yml b/spec/supabase_js_v2.yml
index be1fef2532e..2d9f55b79ac 100644
--- a/spec/supabase_js_v2.yml
+++ b/spec/supabase_js_v2.yml
@@ -3895,6 +3895,25 @@ functions:
By default, the data is returned in JSON format, but can also be returned as Comma Separated Values.
hideCodeBlock: true
isSpotlight: true
+ - id: returns
+ $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.returns'
+ title: returns()
+ examples:
+ - id: override-type-of-successful-response
+ name: Override type of successful response
+ code: |
+ ```ts
+ const { data } = await supabase
+ .from('countries')
+ .select()
+ .returns<MyType>()
+ ```
+ response: |
+ ```
+ let x: typeof data // MyType | null
+ ```
+ hideCodeBlock: true
+ isSpotlight: true
# NOTE: Not available on currently deployed PostgREST
# db.geojson():