From 9c6ee410c074675cdeb1e368f1d21842d8a32056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Og=C3=B3rek?= Date: Tue, 13 Feb 2024 12:03:42 +0100 Subject: [PATCH] fix: Use class methods instead of bound arrow functions for rest calls --- src/SupabaseClient.ts | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/SupabaseClient.ts b/src/SupabaseClient.ts index d520d2bca..971cb8945 100644 --- a/src/SupabaseClient.ts +++ b/src/SupabaseClient.ts @@ -130,7 +130,7 @@ export default class SupabaseClient< * * @param relation - The table or view name to query */ - from: PostgrestClient['from'] = (relation: string) => { + from(relation: string) { return this.rest.from(relation) } @@ -142,11 +142,7 @@ export default class SupabaseClient< * * @param schema - The name of the schema to query */ - schema: PostgrestClient['schema'] = < - DynamicSchema extends string & keyof Database - >( - schema: DynamicSchema - ) => { + schema(schema: DynamicSchema) { return this.rest.schema(schema) } @@ -171,17 +167,14 @@ export default class SupabaseClient< * `"estimated"`: Uses exact count for low numbers and planned count for high * numbers. */ - rpc: PostgrestClient['rpc'] = < - FunctionName extends string & keyof Schema['Functions'], - Function_ extends Schema['Functions'][FunctionName] - >( - fn: FunctionName, - args: Function_['Args'] = {}, + rpc( + fn: FnName, + args: Fn['Args'] = {}, options?: { head?: boolean count?: 'exact' | 'planned' | 'estimated' } - ) => { + ) { return this.rest.rpc(fn, args, options) }