In TypeScript 3.7.2 I can use Optional Chaining.
requests?.requestsCount
Can you explain how it works?
// before
requests ? requests.requestsCount : 0
// after
requests?.requestsCount || 0
I see compiled version of my code.
"use strict";
var _a;
return {
requests: ((_a = requests) === null || _a === void 0 ? void 0 : _a.requestsCount) || 0
};
Can you explain void 0
? In release docs it should be undefined.
let x = (foo === null || foo === undefined) ? undefined : foo.bar.baz();
May I use this syntactic sugar safely?