Closed Latent-Labs-Inc closed 8 months ago
I have the same issue on the latest version (1.82.2
) as of writing.
I also tried creating a domain out of the type array like below, but it resulted in no difference.
CREATE TYPE inner_type ( ... );
CREATE DOMAIN inner_type_array AS inner_type[];
CREATE TYPE outer_type (
property inner_type_array,
...
);
As the inner composit type is generated correctly, running the following command after generating the types will insert the correct type.
sed -i s/'<PROPERTY_NAME>: unknown'/'<PROPERTY_NAME>: Database["public"]["CompositeTypes"]["<TYPE_NAME>"][]'/ ./<DESTINATION_FILE>
My full command to generate and replace types looks like this:
npx supabase gen types typescript \
--project-id "<PROJECT_ID>" \
--schema public > <DESTINATION_FILE> \
&& sed -i \
s/'<PROPERTY_NAME>: unknown'/'<PROPERTY_NAME>: Database["public"]["CompositeTypes"]["<TYPE_NAME>"][]'/ \
<DESTINATION_FILE>
_You need to replace <PROJECT_ID>
, <DESTINATION_FILE>
, <PROPERTY_NAME>
and <TYPE_NAME>
_
I faced the same issue in my project, and I'm wondering if there are any plans to address it. Could you please provide an update on the status or any potential timelines for a fix? I'm eager to see this resolved. Thank you!
I'm using the supabase gen types command to generate types for my Supabase database. However, I've noticed that the command is not correctly generating types for arrays of composite types. Instead of the expected type, it's generating unknown for these types.
Here's the command I'm using:
And here's how the types are being generated:
The dependents is just the same responsemember type but an array.
I have provided the plpgsql code as well below
create type medicalinsuranceplan as ( payer_id text, subscriber responsemember, dependents responsemember[], payer payer, plan_information planinformation, plan_date_information plandateinformation, benefits_information benefitsinformation[], status text );
As you can see, the dependents and benefits_information fields, which are arrays of composite types, are being generated as unknown.
I've tried updating to the latest version of the Supabase CLI, but the issue persists. I would appreciate any help or guidance on how to resolve this issue.
Thank you,