Closed chrism closed 6 months ago
For anyone else that also stumbles on this issue, I looked into fixing it but unfortunately looks like a nuance with Postgres, all view columns are set as nullable, some discussion so doesn't seem anything can be done on Supabase side.
Closing as duplicate of https://github.com/supabase/cli/issues/577
Bug report
I was advised by silentworks to raise this as a bug here after posting on the Supabase discord https://discord.com/channels/839993398554656828/1086948087316086864
Describe the bug
The typescript types generated for a view don't seem to match the types for the columns on the table they are based on. They add the possibility for null as an alternative, even if the original column is explicitly set to not null.
To Reproduce
A table called
playlists
has a column calledfirst_play
which is a non nullable boolean.The generated typescript for this column is as expected
But with a view generated like this
The generated types file produces this
Expected behavior
I would expect that the generated typescript definition would match the column the view is based on and not add null as a possible option.
System information