I just found something in the TypeScript language specification, it’s fairly easy. I was pretty close.
the syntax is the following:
public myCallback: (name: type) => returntype;
In my example, it would be
class CallbackTest
{
public myCallback: () => void;
public doWork(): void
{
//doing some work...
this.myCallback(); //calling callback
}
}
As a type alias:
type MyCallback = (name: type) => returntype;