This repository was archived by the owner on Oct 9, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,10 @@ type FilterOperator =
2626 | 'phfts'
2727 | 'wfts'
2828
29+ export type IsStringOperator < Path extends string > = Path extends `${string } ->>${string } `
30+ ? true
31+ : false
32+
2933// Match relationship filters with `table.column` syntax and resolve underlying
3034// column value. If not matched, fallback to generic type.
3135// TODO: Validate the relationship itself ala select-query-parser. Currently we
@@ -41,9 +45,11 @@ type ResolveFilterValue<
4145 : ResolveFilterRelationshipValue < Schema , RelationshipTable , Remainder >
4246 : ColumnName extends keyof Row
4347 ? Row [ ColumnName ]
44- : // If the column selection is a jsonpath like `data->value` we attempt to match
48+ : // If the column selection is a jsonpath like `data->value` or `data->>value` we attempt to match
4549 // the expected type with the parsed custom json type
46- JsonPathToType < Row , JsonPathToAccessor < ColumnName > > extends infer JsonPathValue
50+ IsStringOperator < ColumnName > extends true
51+ ? string
52+ : JsonPathToType < Row , JsonPathToAccessor < ColumnName > > extends infer JsonPathValue
4753 ? JsonPathValue extends never
4854 ? never
4955 : JsonPathValue
Original file line number Diff line number Diff line change @@ -280,7 +280,13 @@ const postgrestOverrideTypes = new PostgrestClient<DatabaseOverride>('http://loc
280280 const resIn = await postgrestOverrideTypes
281281 . from ( 'foo' )
282282 . select ( 'id, bar, baz' )
283- . in ( 'bar->version' , [ 1 , 32 ] )
283+ . in ( 'bar->version' , [ 31 ] )
284+ . single ( )
285+ await postgrestOverrideTypes
286+ . from ( 'foo' )
287+ . select ( 'id, bar, baz' )
288+ // the type become a string when using the string json accessor operator
289+ . in ( 'bar->>version' , [ 'something' ] )
284290 . single ( )
285291
286292 if ( resIn . error ) {
You can’t perform that action at this time.
0 commit comments