Does Typescript support the ?. operator? (And, what's it called?)
@lebyy▲ 0 net votes
Problem: Does Typescript currently (or are there plans to) support the safe navigation operator of ?. ie: var thing = foo?.bar // same as: var thing = (foo) ? foo.bar : null; Also, is there a more common name for this operator (it's incedibly hard to google for). Fix (from the top answer): Yes. As of TypeScript 3.7 (released on November 5, 2019 ), this feature is supported and is called Optional Chaining : At its core, optional chaining lets us write code where TypeScript can immediately stop running some expressions if we run into a null or undefined . The star of the show in optional chaining is the…