Skip to content

Commit a5a70db

Browse files
authored
fix: Use class methods instead of bound arrow functions for rest calls (#973)
1 parent 4362b3f commit a5a70db

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

src/SupabaseClient.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export default class SupabaseClient<
130130
*
131131
* @param relation - The table or view name to query
132132
*/
133-
from: PostgrestClient<Database, SchemaName>['from'] = (relation: string) => {
133+
from(relation: string) {
134134
return this.rest.from(relation)
135135
}
136136

@@ -142,11 +142,7 @@ export default class SupabaseClient<
142142
*
143143
* @param schema - The name of the schema to query
144144
*/
145-
schema: PostgrestClient<Database, SchemaName>['schema'] = <
146-
DynamicSchema extends string & keyof Database
147-
>(
148-
schema: DynamicSchema
149-
) => {
145+
schema<DynamicSchema extends string & keyof Database>(schema: DynamicSchema) {
150146
return this.rest.schema<DynamicSchema>(schema)
151147
}
152148

@@ -171,17 +167,14 @@ export default class SupabaseClient<
171167
* `"estimated"`: Uses exact count for low numbers and planned count for high
172168
* numbers.
173169
*/
174-
rpc: PostgrestClient<Database, SchemaName>['rpc'] = <
175-
FunctionName extends string & keyof Schema['Functions'],
176-
Function_ extends Schema['Functions'][FunctionName]
177-
>(
178-
fn: FunctionName,
179-
args: Function_['Args'] = {},
170+
rpc<FnName extends string & keyof Schema['Functions'], Fn extends Schema['Functions'][FnName]>(
171+
fn: FnName,
172+
args: Fn['Args'] = {},
180173
options?: {
181174
head?: boolean
182175
count?: 'exact' | 'planned' | 'estimated'
183176
}
184-
) => {
177+
) {
185178
return this.rest.rpc(fn, args, options)
186179
}
187180

0 commit comments

Comments
 (0)