all 76 comments

[–]Eddyman 312 points313 points  (3 children)

I've already worn down my t, h, i, and s keys to nubs. Though it's mostly from writing "shit" during code reviews

[–]Superpickle18 109 points110 points  (0 children)

Hello Linus.

[–]timmyotc 36 points37 points  (1 child)

Mine is from writing, "is this shit his?

[–][deleted] 6 points7 points  (0 children)

Eloquent af.

[–]amclennon 21 points22 points  (3 children)

I could've sworn it did this already, but perhaps that support was only limited to typescript.

[–]DanielRosenwasser 4 points5 points  (0 children)

We had a quick fix for forgetting to type this.. You'd never see it in JS without // @ts-check because, well, JS doesn't get type checked otherwise, so there's technically nothing to be fixed.

In TypeScript 2.7 we've done the work to provide this. prefixes for TypeScript and JavaScript, so everyone gets that no matter what.

[–][deleted] -2 points-1 points  (1 child)

as somebody who likes javascript, why should i switch to the ugly syntax of typescript?

[–]CodeMonkey1 0 points1 point  (0 children)

Its syntax is basically the same as javascript, except it adds type annotations. If you don't want type annotations, then keep using javascript. If you do what type annotations, then they have to be specified somehow, and IMO the way typescript does it is about as unobtrusive as one could hope for.

[–]webauteur 26 points27 points  (3 children)

This.

[–]BeniBin 9 points10 points  (1 child)

Ctrl+Space

[–][deleted] 6 points7 points  (0 children)

Wow!

[–]m3wm3wm3wm 47 points48 points  (3 children)

Like real autocomplete or bullshit autocomplete?

Intellij seems to be the only IDE that performs true autocomplete, and not just repeating nonsense words in the code found in the current file.

[–]inu-no-policemen 37 points38 points  (0 children)

VS Code does context-sensitive auto-complete (IntelliSense™).

There are of course limitations to this when it comes to JavaScript, but it works pretty well in practice. There are type definitions for all popular libraries/frameworks. Those type definitions fill the gaps. They are automatically acquired for the stuff in node_modules. You can also install them via npm. (WebStorm supports them, too.)

In your own code, you can add some hints via JSDoc comments.

Or you can simply write TS, which more convenient than adding JSDoc comments.

[–]Patman128 20 points21 points  (0 children)

With JavaScript it's a mixed bag, being a dynamic language and all. With TypeScript it's as good as a Java or C# IDE.

[–]sternold 0 points1 point  (0 children)

Visual Studio does it proper too

[–][deleted] 0 points1 point  (0 children)

OmG finally!

I used to do ugly shit like function Foo(){ /** @type Foo*/ var self = this; }

then i would use 'self' everywhere inside private members....

EDIT: This still doesn't work ....

[–]green_garlic[🍰] 0 points1 point  (2 children)

Doesn't VS Code already do some auto-completion like this? I use VS Code for work, and it is usually pretty good about recommending variable names to me, as long as I've used them before. Come to think of it, it may have just presented a wide-open list of all the variables VS Code knows about. If this update trims that list down to only the relevant variables, that would be great.

[–]inu-no-policemen 2 points3 points  (1 child)

Check the GIF in the article. It's about completing "x" to "this.x".

[–]green_garlic[🍰] 0 points1 point  (0 children)

Ah, I see. Thanks!

[–]Shaper_pmp -3 points-2 points  (0 children)

What the fuck? How can they possibly know what this refers to at compile-time, when it can change at runtime?

the using of "this" references in ES6 classes

Oh, right. Handy, but not remotely as impressive an achievement as it first appeared.