-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Description
In the TypeScript design goal it writes Emit clean, idiomatic, recognizable JavaScript code
, but the optional chaining breaks this.
TypeScript Version: 3.7.0-beta
Search Terms: Optional chaining
Code
const a = globalThis?.browser?.runtime?.getBackgroundPage?.()?.location?.href ?? location.href
Expected behavior:
Generate a recognizable JavaScript code.
Actual behavior:
var _a, _b, _c, _d, _e, _f, _g, _h;
const a = (_h = (_g = (_f = (_e = (_c = (_b = (_a = globalThis) === null || _a === void 0 ? void 0 : _a.browser) === null || _b === void 0 ? void 0 : _b.runtime) === null || _c === void 0 ? void 0 : (_d = _c).getBackgroundPage) === null || _e === void 0 ? void 0 : _e.call(_d)) === null || _f === void 0 ? void 0 : _f.location) === null || _g === void 0 ? void 0 : _g.href, (_h !== null && _h !== void 0 ? _h : location.href));
septs
Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug