supabase / postgres-meta

A RESTful API for managing your Postgres. Fetch tables, add roles, and run queries
https://supabase.com
Apache License 2.0
863 stars 112 forks source link

fix(typegen): array types are `unknown` in computed fields & composite types #703

Closed gulfaraz closed 4 months ago

gulfaraz commented 6 months ago

What kind of change does this PR introduce?

This PR changes gen:types:typescript to generate types for array types instead of unknown.

What is the current behavior?

// todos
Row: {
    details_words: unknown | null
}

// Functions
details_words: {
    Args: {
        "": unknown
    }
    Returns: unknown
}

Example from #581

CompositeTypes: {
    array_type: {
        my_text_array: unknown
    }
}

What is the new behavior?

// todos
Row: {
    details_words: string[] | null
}

// Functions
details_words: {
    Args: {
        "": unknown
    }
    Returns: string[]
}

CompositeTypes: {
    array_type: {
        my_text_array: string[]
    }
}
kamilogorek commented 5 months ago

LGTM, nice update, thanks! cc @soedirgo

kamilogorek commented 5 months ago

@gulfaraz you don't need to keep the branch up to date. Once person responsible for this repo is back, they'll handle it :)

gulfaraz commented 5 months ago

@kamilogorek Good to know. Thank you.