3 ms·
Really glad to see this. I encountered the use-before-declaration "feature" of TS, and I just assumed it was a bug, which I filed. I was flabbergasted when I wa
by ridiculous_fish 11y ago
Really glad to see this. I encountered the use-before-declaration "feature" of TS, and I just assumed it was a bug, which I filed. I was flabbergasted when I was told it was by design, to match JavaScript.
The issue: https://github.com/Microsoft/TypeScript/issues/5822 https://github.com/Microsoft/TypeScript/issues/5822
- knocte 11y agoWow what a bunch of pedants! I completely agree with the issue you raised, I had a better consideration of the TS team.
- masklinn 11y agoI can only disagree and that thread gave me an excellent impression of the TS team[0]. They cleanly noted that this was expected behaviour, the reasoning behind it (which calls back to one of the underlying roles of typescript) and how to mitigate it. Can't say the same of your vote-spamming of every comment though. [0] as someone mostly uninterested in TS
- tom-lord 11y agoFunny how the conclusion is basically "Don't use `var`, use `let` instead" - even though almost all documentation/examples exclusively use the `var` keyword!
- egeozcan 11y agoFrom Ryan Cavanaugh's comment[1]: > (...) there's already the let keyword available for those who want saner scoping rules. We should definitely update the docs to use let everywhere, though. [1]: https://github.com/Microsoft/TypeScript/issues/5822#issuecomment-161079139 https://github.com/Microsoft/TypeScript/issues/5822#issuecom...
- tom-lord 11y agoYes, however that was 3 and a half months ago -- and as far as I can tell, there's been no movement towards doing so.
- RyanCavanaugh 11y agoIt's been fixed for a few months in the Handbook repo (https://github.com/Microsoft/TypeScript-Handbook/pull/119/files https://github.com/Microsoft/TypeScript-Handbook/pull/119/fi...), but the new updated Handbook hasn't been pushed to the website yet.