4 ms·
You're mistaken. Optional chaining is a JavaScript feature[1]. The stated goal of TypeScript is to be valid JavaScript when the types are stripped away. That's
by mcluck 4y ago
You're mistaken. Optional chaining is a JavaScript feature[1]. The stated goal of TypeScript is to be valid JavaScript when the types are stripped away. That's why they have functionally removed namespaces and they want to remove enums. They're the only language features that are actually compiled instead of just stripped.
[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- nine_k 4y agoIndeed I'm mistaken; this only happens when the target JS version is old enough not to support that.