I was working on a typescript project. Naturally f...
# random
j
I was working on a typescript project. Naturally for collections I named parameters like
collection.filter(it => it.age > 18)
^-- Was told that calling the parameter 'it' is 'weird' and that I must not do this! 😄
😆 2
m
this is actually weird… I remember
it
being a convention in CoffeeScript too! So what would be the accepted convention in TS?
j
I do use it on my own TS projects (like drivine.org) however this team was quite particular. In fact we didn't see eye-to-eye on a few matters regarding style, design patterns and etc so ended up parting ways.
They liked 'item' or to name the thing in the collection.
t
I use
it
everywhere now, even in Java. You could say "Sure,
it
is just short for `item`" 🙂
👏 2
😉 1
j
I did notice there irony regarding 'it' vs 'item' at the time, believe me 🙂
m
I’ve also started using
it
in TS because of Kotlin. Using long descriptive variable names when they are not needed usually make code even harder to read rather than easier.
🤘 1
💯 1
👍 3