3 ms·
I think it can make it easier to keep track of the work that needs to be done when explicit any (noImplicitAny) is used. I use them to monitor percentage of pro
by triyambakam 3y ago
I think it can make it easier to keep track of the work that needs to be done when explicit any (noImplicitAny) is used. I use them to monitor percentage of progress
- scotty79 3y agoHow do you measure how many any's you got in your code? How do you track where you have them? Just \bany\b regexp?
- eyelidlessness 3y agotypescript-eslint has a rule targeting explicit any annotations, and even several rules about assignments etc which are inferred as any. If you really want to include any in a strict-gradual migration strategy (I’m skeptical but could be persuaded depending on the baseline), you can use those rules as warnings or whatever makes the most sense. It’s definitely statically analyzable without a ton of bespoke effort.
- nicoburns 3y ago"rg -w any", with an optional --count if want to count them rather than list their locations. It functions quite similarly to "unsafe" in Rust, and like "unsafe" I think ideally each "any" would come with a comment explaining why it's use is justified in that case (which is hard to enforce if the "any"s are implicit)
- scotty79 3y agoI agree completely that each any should be justified. That's why I'm against sprinkling it to silence errors. noImplicitAny with each manual any clearly justified is the desired end state of the migration.