Re:Ask HN: Which TypeScript codebase should I study to get b...
by evmar on Thursday November 09, 2017 @10:59AM
(#15663444)
The TypeScript compiler is the canonical corpus of code written by TypeScript experts, and I learned a lot of interesting style from the time I've spent with it. (Fun fact: they don't use 'class' in the compiler at all, but instead have a different pattern for passing around interfaces+state that is much more TypeScript-y.)
[ Parent
| on HN ]
Re:Ask HN: Which TypeScript codebase should I study to get b...
by zengid on Thursday November 09, 2017 @12:03PM
(#15663977)
Could you cite an example of the interfaces+state pattern? You've piqued my interest.
Re:Ask HN: Which TypeScript codebase should I study to get b...
by HumanDrivenDev on Thursday November 09, 2017 @05:16PM
(#15666263)
Seconded, I'm also very interested.
Re:Ask HN: Which TypeScript codebase should I study to get b...
by olingern on Monday November 13, 2017 @01:12PM
(#15688547)
It looks like there is a lot of legacy code hanging out in the compiler [1], i.e. prefer module over namespaces.
[1] - https://github.com/Microsoft/TypeScript/blob/master/src/comp...
It's also strange to me why they inline their interfaces, rather than organizing them in a common folder / module.
Re:Ask HN: Which TypeScript codebase should I study to get b...
by Scarbutt on Thursday November 09, 2017 @11:43AM
(#15663827)
Fun fact: they don't use 'class' in the compiler at all
Looks like a class to me: https://github.com/Microsoft/TypeScript/blob/master/src/comp...
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.
Re:Ask HN: Which TypeScript codebase should I study to get b...
by bulldoa on Thursday November 09, 2017 @05:10PM
(#15666243)
does anyone have some recommendation on how to debug typescript compiler, it seems like console does not work there, I am trying to just step through tsc.ts, but gulp local always complains that console is not defined. Is there any alternative in stepping through the compiler?