Use the Optional Chaining Operator in TypeScript

Marius Schulz
InstructorMarius Schulz

Share this video with your friends

Send Tweet

This lesson introduces the ?. operator which is known as optional chaining. We're going to look at how we can use ?. to safely descend into an object with properties which potentially hold the values null or undefined. We're also going to learn how to access properties with an expression using the ?.[] bracket notation and how to call functions which may not exist using the ?.() syntax.

BTT
BTT
~ a month ago

How can I configure VS code to change all the occurrences, like how it got changed with _a and _b?

Marius Schulz
Marius Schulzinstructor
~ a month ago

@BTT: You can use the “Rename Symbol” command from the command palette in VS Code (see https://code.visualstudio.com/docs/editor/refactoring#_rename-symbol) to rename a variable, function, or other symbol. I use this command quite frequently which is why I’ve assigned it the shortcut ⌘+R.