-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature request - null-conditional operator '?' #15098
Comments
Suggest that you refer to the operator as the |
I think |
another case can be this: let dictionary: { [key:string]: Function } = {};
function myfunc(p: string): Function | undefined {
return dictionary[p];
}
let a = myfunc(p1)?(p2); |
Fair enough. Probably worth including in the proposal then, though. And I guess To me, if you have |
A null propagation operator is a proposed Ecmascript feature. Fortunately, it looks like it advanced to Stage 1 at the January meeting. Typescript tries not to propose new syntax. It implements Ecmascript standard features when they reach stage 3. In the meantime, discussion of how to type this operator happens at #16. |
Scenario
I have an Invoice Class with a property Customer like this:
To get the Invoice.Customer.MainContact.Name I need to write something like this:
Proposal:
c# like null-conditional operator
?
:the translated javascript can be something like this:
The text was updated successfully, but these errors were encountered: