In interfaces:
interface IRunner {
runSafe<T extends IRunnable>(runnable: T): void;
}
In classes:
class Runner implements IRunner {
public runSafe<T extends IRunnable>(runnable: T): void {
try {
runnable.run();
} catch(e) {
}
}
}
Simple functions:
function runSafe<T extends IRunnable>(runnable: T): void {
try {
runnable.run();
} catch(e) {
}
}