I want to create an interface for components that generate JSON. I want to force each implementing component to accept a type as Input and produce an Output:
import { EventEmitter, Output, Input } from '@angular/core';
import { Foo, FooConfiguration } from '../../interfaces';
interface FooConfigurator {
@Output() fooWasConfigured: EventEmitter<FooConfiguration>;
@Input() fooInstance: Foo;
}
Then, components implementing FooConfigurator would ensure the following:
import { EventEmitter, Output, Input } from '@angular/core';
import { Foo, FooConfiguration, FooConfigurator } from '../../interfaces';
class ConcreteFooConfigurator implements FooConfigurator {
@Output() fooWasConfigured: EventEmitter<FooConfiguration>;
@Input() fooInstance: Foo;
}
This interface definition fails because it is invalid syntax. How can I do it, or better approach the problem?