I am trying to assign interfaces as values within a config object:
export interface RouterConfig {
startEvents?: typeof RouterEvent[];
completeEvents?: typeof RouterEvent[];
}
The intended usage is as follows:
private config: RouterConfig = {
startEvents: [NavigationStart],
completeEvents: [NavigationEnd, NavigationCancel, NavigationError]
};
However, this approach is resulting in an error message:
The types of the 'completeEvents' property are incompatible. The type '(typeof NavigationEnd | typeof NavigationCancel | typeof NavigationError)[]' cannot be assigned to type 'RouterEvent[]'. The type 'typeof NavigationEnd | typeof NavigationCancel | typeof NavigationError' cannot be assigned to type 'RouterEvent'. The type 'typeof NavigationEnd' cannot be assigned to type 'RouterEvent'. The 'id' property is missing in the 'typeof NavigationEnd' type.
Any suggestions on how to resolve this issue?
You can find a reproduction of this issue on StackBlitz
Please note that RouterEvent refers to a class