Skip to content

Instantly share code, notes, and snippets.

@zemlanin
Created November 19, 2016 12:24
Show Gist options
  • Save zemlanin/a306e8498d05c923cac405c047014029 to your computer and use it in GitHub Desktop.
Save zemlanin/a306e8498d05c923cac405c047014029 to your computer and use it in GitHub Desktop.
this.ts
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var A = (function () {
function A(cb) {
this.cb = cb;
}
return A;
}());
var Greeter = (function (_super) {
__extends(Greeter, _super);
function Greeter() {
var _this = this;
// ^ there should be `var _this = this;`
_super.call(this, function () { _this; });
}
return Greeter;
}(A));
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var A = (function () {
function A(cb) {
this.cb = cb;
}
return A;
}());
var Greeter = (function (_super) {
__extends(Greeter, _super);
function Greeter() {
return
// ^ there should be `var _this = this;`
_super.call(this, function () { _this; }) || this;
}
return Greeter;
}(A));
class A {
constructor(protected cb: () => void) { }
}
class Greeter extends A {
constructor() {
// ^ there should be `var _this = this;`
super(() => { this })
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment