Skip to content

Instantly share code, notes, and snippets.

@smeijer
Created August 2, 2019 17:27
Show Gist options
  • Save smeijer/b720db1f15f24a5e9759ae4566431580 to your computer and use it in GitHub Desktop.
Save smeijer/b720db1f15f24a5e9759ae4566431580 to your computer and use it in GitHub Desktop.
medium-costs-of-optional-chaining-5
var can = user?.can || {};
var canEdit = can.edit;
var canDelete = can.delete;
// transpiles to:
"use strict";
var _user;
var can =
((_user = user) === null || _user === void 0 ? void 0 : _user.can) || {};
var canEdit = can.edit;
var canDelete = can.delete;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment