-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Optional chaining obj?.[expr] #1801
Comments
@laggingreflex
Correct? Also, these do not cause syntax errors, they just look wrong. Correct? |
@bitwiseman Not sure I understand the question. Are you asking what the optional chaining operator var _obj, _arr;
var nestedProp = (_obj = obj) === null || _obj === void 0 ? void 0 : _obj['prop' + 'Name'];
var arrayItem = (_arr = arr) === null || _arr === void 0 ? void 0 : _arr[42];
Yes, they don't cause any errors, just look wrong. |
@laggingreflex I don't have time to work on this right now, but the change should be pretty easy. Adding another branch to this conditional is prably the right place: |
@bitwiseman |
The
obj?.[expr]
syntax of optional chaining don't work as expected:Input
Expected (no change)
Actual
Space between
.
and[
The text was updated successfully, but these errors were encountered: