postgrest-js icon indicating copy to clipboard operation
postgrest-js copied to clipboard

Typing is incorrect when filtering by embedded attributes

Open samtgarson opened this issue 4 years ago • 2 comments

Bug report

Describe the bug

Postgrest allows filtering by attributes on embedded resources, but the typings on the filter functions only support attributes on the selected table.

To Reproduce

This recreation would work when run with valid credentials, but the typings fail and cause a build error.

Expected behavior

Ideally, the function signatures would support type-safe paths in dot-notation, but it should at least not cause a build error.

Type safe paths are in theory possible with Typescript 4.1 (so would include a minor version bump for this project) as demonstrated here (broken down here).

I had a very brief go trying this but it didn't immediately work. Happy to give it more of a go if this is a desired approach by the team here.

Screenshots

image

System information

Not relevant

samtgarson avatar Mar 29 '21 21:03 samtgarson

Thanks for opening the issue @samtgarson!

Type safe paths are in theory possible with Typescript 4.1

That looks pretty neat! We're currently swamped with the launch, but I'd be happy to get this in.

soedirgo avatar Mar 31 '21 07:03 soedirgo

Just to update this for v2, this is still not implemented, although in the meantime we do fall back to generic string instead of giving a type error.

soedirgo avatar Sep 26 '22 08:09 soedirgo