Typescript enum to pgEnum

I have this code
export enum field_types {
numeric = 'numeric',
text = 'text',
textarea = 'textarea',
select = 'select'
}

export const typeEnum = pgEnum('type', Object.values(field_types));
export enum field_types {
numeric = 'numeric',
text = 'text',
textarea = 'textarea',
select = 'select'
}

export const typeEnum = pgEnum('type', Object.values(field_types));
But it shows this error
1 Reply
tunisoft
tunisoftOP16mo ago
I change the code like this, just to test
export const typeEnum = pgEnum('type', ['abcd', ...Object.values(field_types)]);
export const typeEnum = pgEnum('type', ['abcd', ...Object.values(field_types)]);
Why doesn't it just accept a string array? How to work around this issue? Thank you
Want results from more Discord servers?
Add your server