Adding unused types into the directives property of Component has any consequences?


Adding several unused types to the directives property of the Component decorator in Angular2 is the same as adding the correct directives?
I mean, is the compiler smart enough to output the exact same result within the JS file?

I made a tiny test. I added a COMMON_DIRECTIVES and some of my own directives to a component that didn’t use all of them. Got both js and used FileMerge to compare. Both are equal. But I will leave this open, maybe someone has more to add.


I have a longer engineering-centric answer here:

tl;dr, as filiph mentioned, we are very conservative. We are looking to address this in a future version of AngularDart, but it will likely be a breaking change.

Answered By – matanlurey

Answer Checked By – Terry (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.