Skip to content

Allow insertion of custom types for 'Json' type with the 'gen types typescript' command #590

@codewriter73

Description

@codewriter73

Feature request

After having to manually change the JSON values of my types file every time I generate a new ones, it gets repetitive. It seems like it should possible to have those types replace automatically when the supabase gen types typescript is run.

Describe the solution you'd like

I'm not exactly sure how this would be approached, but it seems one possible solution would be to pass in a file path to a json file that mimics the organization of the generated types file, such as
{
[schemaName]: {
.. "Tables": {
.... [tableName]: {
....... [rowname]: string | number | boolean | null | {
............. ...typeJsonStructure
.......... } | {
............. ...typeJsonStructure
.......... }[]
...... }
.. },
.. "Views": {},
.. "Functions": {},
}

An example file would be like
{ public: { Tables: { user: { myJsonColumn: { customParamOne: string customParamTwo: number } } }, Views: { userView: { viewJsonColumn: { viewColOne: string: viewColTwo: { nestedOne: boolean; nestedTwo: number | string' } } } } }

Describe alternatives you've considered

I have not seen anything related to JSON specifically, but @magick93 suggested support for Custom PostgreSQL types in this issue supabase/postgres-meta#840

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions