I have a simple auth middleware for express. It checks header and if all cool it calls next()
Now when i am in "DoSomething" "this" is equal to global and not the instance of "Test" and "this.DoSomeThingPrivate" is undefined.
I have tried the
DoSomeThingPrivate :() => void;
this.DoSomeThingPrivate = () => {
...
}
pattern. But also does not work.
import express = require('express');
var app = express();
class Test {
constructor() {
}
DoSomething(req:express.Request, res:express.Response, next:Function) :void {
this.DoSomeThingPrivate();
}
private DoSomeThingPrivate() :void
{
}
}
var test = new Test();
app.use(test.DoSomething);
Any Ideas...
thanks