The following doesn't compile with error "a function whose declared type is neither void nor any must return a value or consist of a single throw statement".
Is there a way to make the compiler recognize that _notImplemented throws an exception?
function _notImplemented() {
throw new Error('not implemented');
}
class Foo {
bar() : boolean { _notImplemented(); }
The only woraround I can see is to use generics. But it seems kind of hacky. Is there a better way?
function _notImplemented<T>() : T {
throw new Error('not implemented');
}
class Foo {
bar() : boolean { return _notImplemented(); }