-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
Has PRSpec: Optional Chainingarea: typescriptoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: parser
Description
Bug Report
- I would like to work on a fix!
Input Code
- REPL or Repo link if applicable:
a?.b.c()
a?.b!.c()Actual behavior
"use strict";
var _a, _a2;
(_a = a) === null || _a === void 0 ? void 0 : _a.b.c();
((_a2 = a) === null || _a2 === void 0 ? void 0 : _a2.b).c();Expected behavior/code
The ! should have no effect on the produced code.
Problem: Suppose a is null, then the second line can be reduced to:
((_a2 = a) === null || _a2 === void 0 ? void 0 : _a2.b).c()
=> ((a2 = null) === null || _a2 === void 0 ? void 0 : _a2.b).c()
=> (null === null || _a2 === void 0 ? void 0 : _a2.b).c()
=> (true ? void 0 : _a2.b).c()
=> undefined.c()Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)
- Filename:
babel.config.js
{
"presets": ["@babel/preset-typescript", "@babel/preset-stage-3"]
}Environment
- Babel version(s): 7.7.7
- How you are using Babel: https://babeljs.io/repl
Possible Solution
¯\_(ツ)_/
Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.
Metadata
Metadata
Assignees
Labels
Has PRSpec: Optional Chainingarea: typescriptoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: parser