Re:Ask HN: Which TypeScript codebase should I study to get b...
by nblavoie on Thursday November 09, 2017 @11:46AM
(#15663847)
What strikes me first is the comment above the function :
// Keep the class inside a function so it doesn't get compiled if it's not used.
I didn't know it was possible.
Re:Ask HN: Which TypeScript codebase should I study to get b...
by wwwigham on Thursday November 09, 2017 @12:39PM
(#15664250)
We do use classes in the test harness, services layer, and to polyfill es6 Map. We just don't use them in the design of any compiler subsystems.
Re:Ask HN: Which TypeScript codebase should I study to get b...
by chamakits on Thursday November 09, 2017 @01:20PM
(#15664551)
This is very interesting to me.
Is the reasoning behind this documented anywhere?
I could only find instructions the coding guideline indicating as much (here: https://github.com/Microsoft/TypeScript/wiki/Coding-guidelin...) but couldn't find why. I'd love to know why, may better inform my usage of typescript.
Re:Ask HN: Which TypeScript codebase should I study to get b...
by vdnkh on Thursday November 09, 2017 @04:51PM
(#15666130)
For better or worse? I've avoided classes in our codebase because I don't like the lack of privates via closure (revealing module pattern) and it's transpiler overhead, but it's a very powerful organization tool. I've found code to be much neater in the class format.
Re:Ask HN: Which TypeScript codebase should I study to get b...
by sillysaurus3 on Thursday November 09, 2017 @05:18PM
(#15666283)
Looks like C++ circa 2008. Careful with those abstractions. That seems a stone's throw away from template metaprogramming.
Looks like a class to me: https://github.com/Microsoft/TypeScript/blob/master/src/comp...