We have to talk about Arrow Functions...

Jonas Pfalzgraf - May 23 '23 - - Dev Community

Oh yes, isn't it beautiful? A TypeScript CodeBase, well maintained.... and then this. Somebody starts to use only named arrow functions in classes. Because it is "the new way". What a colossal bullshit. Of course arrow functions are cool. They offer a wide range of possible uses in the most diverse cases.

() => {

// some code

}
Enter fullscreen mode Exit fullscreen mode

Such a call can be perfectly used to describe return functions without overhead.
It can be perfectly adapted for various use cases without making the code confusing.
However, what makes absolutely no sense and creates confusion is the following:

public functionName = () => {

// some code

}
Enter fullscreen mode Exit fullscreen mode

Such a case is syntactically correct, but it is absolutely confusing and unpleasant, if it can be done this way, too:

public functionName() {

// some code

}
Enter fullscreen mode Exit fullscreen mode

Unfortunately, I see this kind of buck crap more and more often in the wild. I hope to reach and save at least a few lost souls with this little rant.

Kind regards,
Yours, Josun

. . . . . . . . . . . . . . . . . . . . .