6 ms·
This reads like knee-jerk reaction from someone who's never tried TypeScript.
by icholy 11y ago
This reads like knee-jerk reaction from someone who's never tried TypeScript.
- weego 11y agoCriticism of that statement kind of hinges on the source material being solid enough to be taken seriously. I mean, one of his main points is that everything written in JS should be written in typescript because it helps support typescript users. Another it is leads to better documentation, with no qualification of how that happens. It might make your intent more explicit to a reader of the source code, but that doesn't magically translate into documentation for an API user. I personally find nothing good about trying to coercing a language into something it isn't and then transpilling it back and that article has no strong argument to make me feel any different.
- icholy 11y ago> I mean, one of his main points is that everything written in JS should be written in typescript because it helps support typescript users. I agree, that wasn't a good point. > Another it is leads to better documentation, with no qualification of how that happens The type annotations make the source self documenting in a way that doesn't go out of sync. There's also http://typedoc.io/ http://typedoc.io/
- tlarkworthy 11y agoTypedoc doesn't keep up with TS versions. It's not really solid enough.
- BinaryIdiot 11y agoI've used it but never in a serious project. Like I said when it can be compiled into WebAssembly then count me in I'll certainly give it another shot. But until then I just don't want to deal with an, albiet probably rare but possible, transpiling bug. Plus there is huge value, in my opinion, in writing an API in the same language it's going to be consumed in. It lets me dogfood more effectively and write better, real world unit tests.
- nteon 11y agoCan you describe an example of a better, real-world unit test you have in mind? Do you also advocate against writing ES6 and using Babel?
- BinaryIdiot 11y ago> Can you describe an example of a better, real-world unit test you have in mind? Considering the output is a JavaScript library people will be using it in that context more than with TypeScript and many of the others. So I don't have a specific real-world unit test example but in general your unit tests have to test the various ways people are going to use your API from the target language. So you'll need to make sure it behaves in the expected ways with valid and invalid input. At the very least I'd expect unit tests to be written in JavaScript to hit a TypeScript library to help eliminate any weirdness that could have been missed. > Do you also advocate against writing ES6 and using Babel? Yup. ECMAScript 6 is great but the support is still not entirely there (especially in older browsers) and many of the transpilings are not quite equivalent. Granted Babel is pretty high quality (minus their whole decided not to ship any transpilers in the default package anymore) and I would expect it to be close enough. But after being bit by CoffeeScript so many years ago I'd rather not deal with transpilers and use the real thing when I can. Coding in ECMAScript 5 is guaranteed compatible with ECMAScript 6, most web browsers and most versions of node. So I look at it like this: why add the extra complexity just for a few extra, nice, syntax improvements?
- mythz 11y agoThis is a biased and uninformative opinion. You haven't seriously tried it, yet you're already strongly against it and your biases suggest there are obscure transpiling bugs when I've yet to see any in practice. Had you used it for any length of time you would've noticed it catches several bugs which you otherwise wouldn't discover until runtime. You're also waiting for the "magical" WebAssembly target that makes everything better, but instead WebAssembly would end up generating much more unreadable code that runs much slower for JavaScript which already benefits from highly optimized JS VM's in Browsers. It would also much larger in size as it would require embedding its own GC and be littered with numerous type-checks in order to support a highly dynamic language like JavaScript.
- lcfcjs 11y agoI've used it, sure if its your thing, go for it. But don't impose it on everyone, deja vu from the CoffeeScript fan boys, where are they all at now?