Skip to content

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

Add usage with TypeScript section.

Thorsten Schaeff68aeedc1d364
diff --git a/web/docs/library/getting-started.mdx b/web/docs/library/getting-started.mdx
index c93fbea0833..d300e9c4bf6 100755
--- a/web/docs/library/getting-started.mdx
+++ b/web/docs/library/getting-started.mdx
@@ -25,6 +25,39 @@ const supabase = createClient("https://xyzcompany.supabase.co", "1a2b-3c4d-5e6f-
+## Usage with TypeScript
+
+Supabase-js ships with type definitions for usage with TypeScript and for convenient IntelliSense autocomplete and documentation in your editor.
+
+When using TypeScript, you can pass the type of database row as a type parameter to the `from` method to get better autocompletion support down the chain.
+If you don't provide a type for the row you need to explicitly pass `from<any>('tableName')`.
+
+```ts
+type Message = {
+ id: number;
+ inserted_at: string;
+ message: string;
+ user_id: string;
+ channel_id: number;
+ author: { username: string };
+};
+
+const response = await supabase
+ .from<Message>('messages') // Message maps to the type of the row in your database.
+ .select('*, author:user_id(username)')
+ .match({ channel_id: 2 }); // Your IDE will be able to help with automcompletion.
+response.body // Response body will be of type Array<Message>.
+
+// If you don't provide a type for the row you need to explicitly pass `from<any>('tableName')`.
+const response = await supabase
+ .from<any>('messages')
+ .select('*, author:user_id(username)')
+ .match({ channel_id: 2 });
+response.body // Response body will be of type Array<any>.
+```
+
+
+
## Reference
### `createClient()`