Description
In the same way that current CLI works, it would be great to be able to consume Typescript files.
My current project heavily uses aliases paths in development, runtime and testing using:
- Dev: tsconfig paths
- Test: Jest moduleNameMapper
- Production: tsnode and tsconfigpaths
It's extremely pleasant.The amount of different solutions there are (which can also be a nightmare to get configured in all three execution contexts) give an indication to the importance and popularity of aliased paths.
Currently, to reuse existing code, I write my migrations, seeders and models all in Typescript, then transpile the migrations and seeders to JS so the sequelize cli can work its magic.
However, the pain comes when the transpiles JS has not converted the aliased paths to relative paths and understandably, the Sequelize migrator cannot find these aliased paths.
It would be so good to be able to natively run the Typescript migrations and seeders, perhaps via ts-node and tsconfig-paths so that a user can reuse code in the same way the do in the rest of their project with no extra work.
I expect it would require the migration code to be converted to Typescript and then be executed as:
ts-node -r tsconfig-paths/register migrator.ts
OR
node --require ts-node/register -r tsconfig-paths/register migrator.ts