Possible to generate precise types for postgres functions?

Using the CLI's type generation workflow, I can see the result includes some return type for postgres functions, but the generated types aren't that useful when it comes to cases of functions using json_build_object(...) as it looks like it's not parsing the inner contents of the query and simply outputs a basic Record type:

some_postgres_function: {
    Args: Record<PropertyKey, never>;
    Returns: Json;
};


Is there any way to generate more precise types or do I need to manually define some interface/type and make sure to keep it in sync with the function's content?
Was this page helpful?