Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 6, 2024

Conversation

gulfaraz
Copy link
Contributor

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[]
    }
}

@gulfaraz gulfaraz requested review from a team as code owners January 31, 2024 17:09
@kamilogorek
Copy link
Member

LGTM, nice update, thanks! cc @soedirgo

@kamilogorek
Copy link
Member

@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
Copy link
Contributor Author

@kamilogorek Good to know. Thank you.

@soedirgo soedirgo changed the title fix(typegen): include array types instead of unknown fix(typegen): array types are unknown in computed fields & composite types Mar 6, 2024
gulfaraz and others added 3 commits March 6, 2024 17:04
@soedirgo soedirgo linked an issue Mar 6, 2024 that may be closed by this pull request
2 tasks
@soedirgo soedirgo enabled auto-merge (squash) March 6, 2024 09:11
@soedirgo soedirgo merged commit 4364d40 into supabase:master Mar 6, 2024
@gulfaraz gulfaraz deleted the fix.array-types branch March 6, 2024 10:11
avallete pushed a commit that referenced this pull request May 13, 2025
…e types (#703)

* fix: array types should not unknown fixes #581

* chore: update test random ids

* chore: keep pgType arg non-undefined

It should be the resposibility of the caller to make sure the argument
is defined

* chore: clarify type name

---------

Co-authored-by: Bobbie Soedirgo <bobbie@soedirgo.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generating types for a postgresql array results in Typescript unknown property
3 participants