2

I am dealing with a situation in which i need to use sequelize with an existing MySQL database, hence i figured it'd be better if I could generate the Models for sequelize with some kind of generator,

Found sequelize-auto and successfully generated Models into my code.

Reading their documentation they provide many optional flags to the generator command, one of them is -z or --typescript in order to generate the Models as typescript files, unfortunately, the generated code is still in js format and the file are .js suffix.

Tried searching for others experiencing the same issues, found nothing :/

Any idea what am i missing?

My command:

sequelize-auto -h myDb -d database_name -u some_user -x some_password -p 3306 -e mysql -o src/models -C --typescript

Thank you

1 Answer 1

2

My guess is that the version of sequelize-auto you currently use isn't the latest version. You can for instance check if .node_modules/sequelize-auto/lib/ts-helper.js is present or not. In case it isn't, it clearly means your version of sequelize-auto doesn't match the current version on the repo.

A quick workaround to solve this is to do yarn add https://github.com/sequelize/sequelize-auto which will basically use version currently present on the repo as a node module (instead of the latest stable release).

People are merging PRs concerning typescript in sequelize-auto as I write this, make sure to switch back to a stable release as soon as there is one with the changes you are looking for.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.