Open PaulRBerg opened 3 years ago
Hey @PaulRBerg thanks for opening this! We're putting this on our backlog, but if you or anyone else wants to make an attempt at implementing it, please feel free!
trufflesuite/truffle#5222 was merged last week, and it will go out with the next Truffle release. That PR contains the core changes necessary to support TypeScript migrations, but I'd consider this as being an initial "beta" feature as of this upcoming release. We are still working on fleshing out the other details of the feature, including docs (trufflesuite/trufflesuite.com#1276), VSCode integration (#5368) and initial TypeScript migrations when running truffle init
(#5369), etc.
This issue also mentioned typing via TypeChain
. In trufflesuite/truffle#1242 we added type generation for our artifact schema, but neither that issue or trufflesuite/truffle#5222 address typing for truffle-contract
instances directly. I've raised trufflesuite/truffle#5370 to account for that. As a result this issue can be closed once a release containing trufflesuite/truffle#5222 ships.
This was released in Truffle v5.5.24.
Sorry for the confusing status @paulrberg. Truffle v5.5.24
did not completely implement this feature, but is an important first step towards this feature. Please follow trufflesuite/truffle#5381 for updates.
I think this issue can still be closed @cds-amal. The wider feature is tracked by ZenHub epic trufflesuite/truffle#5194, and as you mentioned, the bug in release v5.5.24 is tracked by trufflesuite/truffle#5381.
Note that until trufflesuite/truffle#5381 is fixed, the issue can be worked around by installing truffle@5.5.24
as a local dependency, and executing it using npx
or yarn exec
.
After a bit of internal discussion I too think this should remain open for the reasons @cds-amal mentioned. For others looking for this feature, please check related issues in ZenHub epic trufflesuite/truffle#5194 for progress updates. In the meantime this issue will remain open until those items are complete.
Issue
Truffle migrations cannot currently be written in TypeScript. The only workaround I found is with TypeChain, but the *.ts files need to be transpiled before they are run, so it's not ideal. I could also use ts-node (as explained in #717) , but I would prefer not having to fiddle with low-level tools when using Truffle.
Expected Behavior
Truffle should allow users to write the files under the "migrations" directory in TypeScript, parse them and execute them. If a
tsconfig.ts
doesn't exist, Truffle should throw an error and stop the execution.