@@ -32,11 +32,6 @@ export default class PostgrestFilterBuilder<
32
32
RelationName = unknown ,
33
33
Relationships = unknown
34
34
> extends PostgrestTransformBuilder < Schema , Row , Result , RelationName , Relationships > {
35
- eq < ColumnName extends string & keyof Row > (
36
- column : ColumnName ,
37
- value : NonNullable < Row [ ColumnName ] >
38
- ) : this
39
- eq < Value extends unknown > ( column : string , value : NonNullable < Value > ) : this
40
35
/**
41
36
* Match only rows where `column` is equal to `value`.
42
37
*
@@ -45,20 +40,24 @@ export default class PostgrestFilterBuilder<
45
40
* @param column - The column to filter on
46
41
* @param value - The value to filter with
47
42
*/
48
- eq ( column : string , value : unknown ) : this {
43
+ eq < ColumnName extends string > (
44
+ column : ColumnName ,
45
+ value : ColumnName extends keyof Row ? NonNullable < Row [ ColumnName ] > : NonNullable < unknown >
46
+ ) : this {
49
47
this . url . searchParams . append ( column , `eq.${ value } ` )
50
48
return this
51
49
}
52
50
53
- neq < ColumnName extends string & keyof Row > ( column : ColumnName , value : Row [ ColumnName ] ) : this
54
- neq ( column : string , value : unknown ) : this
55
51
/**
56
52
* Match only rows where `column` is not equal to `value`.
57
53
*
58
54
* @param column - The column to filter on
59
55
* @param value - The value to filter with
60
56
*/
61
- neq ( column : string , value : unknown ) : this {
57
+ neq < ColumnName extends string > (
58
+ column : ColumnName ,
59
+ value : ColumnName extends keyof Row ? Row [ ColumnName ] : unknown
60
+ ) : this {
62
61
this . url . searchParams . append ( column , `neq.${ value } ` )
63
62
return this
64
63
}
@@ -227,18 +226,16 @@ export default class PostgrestFilterBuilder<
227
226
return this
228
227
}
229
228
230
- in < ColumnName extends string & keyof Row > (
231
- column : ColumnName ,
232
- values : ReadonlyArray < Row [ ColumnName ] >
233
- ) : this
234
- in ( column : string , values : readonly unknown [ ] ) : this
235
229
/**
236
230
* Match only rows where `column` is included in the `values` array.
237
231
*
238
232
* @param column - The column to filter on
239
233
* @param values - The values array to filter with
240
234
*/
241
- in ( column : string , values : readonly unknown [ ] ) : this {
235
+ in < ColumnName extends string > (
236
+ column : ColumnName ,
237
+ values : ColumnName extends keyof Row ? ReadonlyArray < Row [ ColumnName ] > : unknown [ ]
238
+ ) : this {
242
239
const cleanedValues = Array . from ( new Set ( values ) )
243
240
. map ( ( s ) => {
244
241
// handle postgrest reserved characters
0 commit comments