Integrated Development Environments Superpowers 13 exercises
Problem

Manually Triggering Autocomplete

Autocomplete is one of the coolest features of TypeScript. Once you get used to it, it's hard to believe you ever coded without it!

It can be a bit tricky though.

Here's an example of some code along with some places where autocomplete can be triggered:


type MyObj = {
foo: string;

Loading exercise

Transcript

00:00 Autocomplete is one of the coolest features of TypeScript. Sometimes I'm really not sure how I ever coded without it. Autocomplete can sometimes be a little bit tricky, though. For instance, when you have, let's say, an accept object function here, which basically takes in an object with foo, bar, and baz on it,

00:18 what I'd like you to do is go into this object here and autocomplete all of the elements there. You should be able to do it without typing in a single character. There is a keystroke you can do that I have just plugged into my brain that lets you just autocomplete all of your possible options on there.

00:37 Super duper important. Also, another situation where you're gonna wanna use it is on this add event listener when you're autocompleting based off kind of some possible string members here. So this is really important when you can't remember the exact capitalization of like DOM content loaded or blah, blah, blah, blah, blah. This means that you can actually sort of search

00:57 through a list of all possible events and just choose the one that you want. It's super duper useful. And I've, yeah, you have to get this just tattooed on your brain, this autocomplete keystroke. And I'm not quite gonna tell you what it is yet. You can skip to the solution if you really fancy it, but you should maybe just check out some docs or just have a little read around,

01:16 see if you can find it. Good luck.