I recommend declaring interfaces as:
interface IHello { hello: string; } interface IRouteDataHello extends RouteData, IHello { } let route = <IRouteDataHello>new RouteData(<IHello>{ hello: "test" }) console.log(route.hello);
This allows the compiler to perform static validation and makes it easy to convert code (as for TypeScript). Of course, this is not important for a small project.
For example, instead of IHello this may be a more complex object:
interface IRouteData<T> { path: string; component: { new () }; as?: string; data?: T; }
source share