Arrow functions don't bind the same this
that you're expecting. In your cases, this
refers to the global object. You can test this easily by changing your second line to:
Object.defineProperty(obj, 'alias1', { get: () => { console.log(this) } }); // ==> Window
You'll need to change it to something like these:
Object.defineProperty(obj, 'alias1', { get: () => obj.src });
Object.defineProperty(obj, 'alias2', { get: function () { return this.src } });
Live Example:
let obj = {};
Object.defineProperty(obj, 'src', {get: () => 'hello'});
Object.defineProperty(obj, 'alias1', {get: () => obj['src']});
Object.defineProperty(obj, 'alias2', {get: function () { return this.src }});
console.log(obj.src);
console.log(obj.alias1);
console.log(obj.alias2);