Closed
Description
I have to target ES3/ES5 and I quite often find myself writing something like this:
for (let roleType of this.RoleTypes) {
((roleType) => {
//roleType is of type any, but should be typeof "outer" roleType
observable.subscribe((nv) => {//Do something with it in a function
this.afunction(nv, roleType2.RoleTypeID);
});
})(roleType); //Protect variable scope
}
or something like this:
(($) => {
//Why not infer $ as typeof jQuery?
})(jQuery);
I think it was reasonable to infer the parameter type from its only usage here