Also, I believe TypeScript uses these to transpile classes with public and private properties/methods (can't verify that's still case atm).
It's a really neat pattern imo, I remember it fondly from my JS heavy days :)
It's a really neat pattern imo, I remember it fondly from my JS heavy days :)
According to this[1] exchange on Stack Overflow, the IIFE is used by TypeScript because of other scoping issues (specifically protecting class properties before instantiation and defining interfaces).
[0] https://yakovfain.com/2015/06/30/the-private-in-typescript-i...
[1] https://stackoverflow.com/questions/56086411/why-does-typesc...