Return list of attributes from a Sequelize model

Viewed 14

I am using Sequelize Typescript v6. I already have a model with a lot of features and I want to get a list of those features.

const attrs = attributes(MyModel)
console.log(attrs)
// [col0Name, col1Name, col2Name,...]

I see that Sequelize Typescript has a way to Type a list as a set of parameters for a model Getting a models attributes. But I cannot use this as a function.

const modelAttributes = Attributes<MyModel>
//'Attributes' only refers to a type, but is being used as a value here.

I tried MyModel.attributes but that doesn't exist either. Thank you in advance for your time and help.

1 Answers
Related