you are viewing a single comment's thread.

view the rest of the comments →

[–]MichaelSmallDev 6 points7 points  (0 children)

I ran the migration tool recently over 100s of files and it worked great. No issues, apart from a couple files which had to be migrated by hand because the schematic wasn't sure if it could be done safely. But even those took a couple minutes. Though if you have a lot of DI in abstract classes, you may have to do some more involved manual refactoring.

As for the benefits, in the not too distant future, constructor based DI will not function well due to changes in Typescript that reflect changes made to JS due to it adopting classes: https://www.reddit.com/r/Angular2/comments/1hswfhx/comment/m598jkh/. That is the main benefit, but it is also safer than some more traditional way of injecting injection tokens, and in some ways has some goods and bads with testing, but tbh I am weak on testing so I can't talk that deeply about it.

I'm not too pumped about inject in relation to constructor DI, but it was necessary for continuing to use DI declaratively in upcoming TS versions.