File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
packages/core/postgrest-js/src Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,14 @@ export type GetRpcFunctionFilterBuilderByArgs<
4040 : // Otherwise, we attempt to match with one of the function definition in the union based
4141 // on the function arguments provided
4242 Args extends GenericFunction [ 'Args' ]
43- ? LastOf < FindMatchingFunctionByArgs < Schema [ 'Functions' ] [ FnName ] , Args > >
43+ ? // This is for retro compatibility, if the funcition is defined with an single return and an union of Args
44+ // we fallback to the last function definition matched by name
45+ IsNever <
46+ LastOf < FindMatchingFunctionByArgs < Schema [ 'Functions' ] [ FnName ] , Args > >
47+ > extends true
48+ ? LastOf < Schema [ 'Functions' ] [ FnName ] >
49+ : // Otherwise, we use the arguments based function definition narrowing to get the right value
50+ LastOf < FindMatchingFunctionByArgs < Schema [ 'Functions' ] [ FnName ] , Args > >
4451 : // If we can't find a matching function by args, we try to find one by function name
4552 ExtractExactFunction < Schema [ 'Functions' ] [ FnName ] , Args > extends GenericFunction
4653 ? ExtractExactFunction < Schema [ 'Functions' ] [ FnName ] , Args >
You can’t perform that action at this time.
0 commit comments