-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueES NextNew featurers for ECMAScript (a.k.a. ESNext)New featurers for ECMAScript (a.k.a. ESNext)SuggestionAn idea for TypeScriptAn idea for TypeScriptUpdate Docs on Next ReleaseIndicates that this PR affects docsIndicates that this PR affects docs
Milestone
Description
Current Status
- The TC39 proposal is now at stage 3 (🎉🎉🎉🎉🎉)
- Implementation is in progress
- You can expect this feature in TypeScript 3.7
- We'll update here when it's available in a nightly build
- Holding off on Optional Call until its semantics are clarified at committee
Open questions
- What special-casing, if any, should
document.all
get?
C# and other languages have syntax sugar for accessing property chains where null
(or in our case, undefined
) might be encountered at any point in the object hierarchy.
var x = { y: { z: null, q: undefined } };
console.log(x?.y?.z?.foo); // Should print 'null'
console.log(x?.baz); // Still an error
console.log(x.y.q?.bar); // Should print 'undefined'
Need proposal on what exactly we should codegen, keeping in mind side effects of accessors.
Edit by @DanielRosenwasser February 27, 2018: This proposal is also called the "null propagation" operator.
AndersDJohnson, pulkit110, svekl, eaigner, Arcitectus and 743 moremind0n, musicm122, kgtkr, PatrickShaw, iygnay and 32 moresaeedtabrizi, eestein, iygnay, danieloprado, EtherTyper and 68 moreeaigner, Robinson7D, oocx, hcgatewood, hulucc and 207 moreExE-Boss, derekdowling, joshuaobrien, migeorge, isbasex and 23 moremigeorge, isbasex, noway, igor-pavlichenko, jcalz and 13 more
Metadata
Metadata
Assignees
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueES NextNew featurers for ECMAScript (a.k.a. ESNext)New featurers for ECMAScript (a.k.a. ESNext)SuggestionAn idea for TypeScriptAn idea for TypeScriptUpdate Docs on Next ReleaseIndicates that this PR affects docsIndicates that this PR affects docs