Is it possible to define both a class and an interface in the same file and export the class directly without any issues? I have encountered problems when using export default Foo
, as it exports as { default: Foo }
instead of the actual class object.
I am looking to achieve something like this:
interface IFoo { bar():boolean; }
class Foo implements IFoo { bar():boolean { return true } }
export = Foo;
However, when trying this approach, I encounter the error message
Extends clause of exported class 'Foo' has or is using private name 'IFoo'.
What would be the correct way to export the class directly while still ensuring it extends an interface defined within the same file?