@@ -32,11 +32,6 @@ export default class PostgrestFilterBuilder<
3232 RelationName = unknown ,
3333 Relationships = unknown
3434> 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
4035 /**
4136 * Match only rows where `column` is equal to `value`.
4237 *
@@ -45,20 +40,24 @@ export default class PostgrestFilterBuilder<
4540 * @param column - The column to filter on
4641 * @param value - The value to filter with
4742 */
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 {
4947 this . url . searchParams . append ( column , `eq.${ value } ` )
5048 return this
5149 }
5250
53- neq < ColumnName extends string & keyof Row > ( column : ColumnName , value : Row [ ColumnName ] ) : this
54- neq ( column : string , value : unknown ) : this
5551 /**
5652 * Match only rows where `column` is not equal to `value`.
5753 *
5854 * @param column - The column to filter on
5955 * @param value - The value to filter with
6056 */
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 {
6261 this . url . searchParams . append ( column , `neq.${ value } ` )
6362 return this
6463 }
@@ -227,18 +226,16 @@ export default class PostgrestFilterBuilder<
227226 return this
228227 }
229228
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
235229 /**
236230 * Match only rows where `column` is included in the `values` array.
237231 *
238232 * @param column - The column to filter on
239233 * @param values - The values array to filter with
240234 */
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 {
242239 const cleanedValues = Array . from ( new Set ( values ) )
243240 . map ( ( s ) => {
244241 // handle postgrest reserved characters
0 commit comments