You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For both input and input types, typescript generation of SQL functions is invalid in some cases :
Primitive types are generated as non-nullable (type instead of type | null) even though the function may accept NULL as input or output
Domain types are generated as unknown
I think that this bug is not caused by a PostgreSQL limitation as views produce the correct typing : primitives are nullable, domains generate as their underlying type and when domains are marked NOT NULL they are even non-nullable in typescript.
To Reproduce
CREATEDOMAINstrict_textAStextNOT NULL;
CREATEFUNCTIONsome_function(arg strict_text)
RETURNS table (nulltext text, stricttext strict_text)
LANGUAGE SQL AS $$
SELECTNULL::uuid, arg
$$;
Generated type with supabase gen types typescript --local
I ❤️ the work being done and the mindset at Supabase. I believe strict typing is crucial to the success of a "backend in the DB" and I could help with a PR if I'm being given some pointers to the code responsible of the TS generation 👋
The text was updated successfully, but these errors were encountered:
Bug report
Describe the bug
For both input and input types, typescript generation of SQL functions is invalid in some cases :
type
instead oftype | null
) even though the function may accept NULL as input or outputunknown
I think that this bug is not caused by a PostgreSQL limitation as views produce the correct typing : primitives are nullable, domains generate as their underlying type and when domains are marked
NOT NULL
they are even non-nullable in typescript.To Reproduce
Generated type with
supabase gen types typescript --local
Expected behavior
Generated types should be
System information
Additional context
I ❤️ the work being done and the mindset at Supabase. I believe strict typing is crucial to the success of a "backend in the DB" and I could help with a PR if I'm being given some pointers to the code responsible of the TS generation 👋
The text was updated successfully, but these errors were encountered: