“So what is optional chaining? Well at its core, optional chaining lets us write code where we can immediately stop running some expressions if we run into a null or undefined. The star of the show in optional chaining is the new ?. operator for optional property accesses,” explains Daniel Rosenwasser, a program manager with Microsoft’s TypeScript team.
Microsoft has announced an ECMAScript feature called “nullish coalescing” is coming to TypeScript.
“You can think of this feature – the ?? operator – as a way to ‘fall back’ to a default value when dealing with null or undefined,” writes Rosenwasser.
Microsoft’s TypeScript is becoming increasingly popular amongst developers. Analyst firm RedMonk revealed recently TypeScript is now the 12th most used programming language on GitHub and Stack Overflow.