tj / node-migrate

Abstract migration framework for node
MIT License
1.55k stars 225 forks source link

TypeScript support? #204

Open imkane opened 10 months ago

imkane commented 10 months ago

From reading past issues, it sounds like there's not much progress on this. Any timeline for it being introduced?

We've been using migrate for years, but recently started moving to TypeScript, and are getting errors like:

error : Error: Cannot find module '../models/payment_plan'

muhammadyusuf-kurbonov commented 10 months ago

Check this #108

wesleytodd commented 10 months ago

Happy to accept a PR to make this better. I am not sure I remember the status of #108 clearly, but I think we need more than the above error report to know specifically what needs to happen to fix it. Can you open a PR with a failing test which illustrates the problem?

andyw88 commented 6 months ago

Not sure where to add this, but for my project I was able to get Typescript running by using ts-node.

If your project is ESM only: then this is the command that worked for me:

TS_NODE_TRANSPILE_ONLY=true NODE_OPTIONS="--loader=ts-node/esm" npx migrate up