-
-
Notifications
You must be signed in to change notification settings - Fork 114
Description
TS 1.6 introduces more strict type checking on object literals:
microsoft/TypeScript#3823
If an API is commonly meant to be extended, it's good that it adds a generic indexer to its definition for easier consumption.
I think it's the case for RouteConfig.
I had this in my code and it now fails in TS 1.6:
config.map([
{ route: 'test', name: 'test', moduleId: './Views/test', auth: 'admin' },
// and many more routes like this
]);The thing to notice is that I use auth to manage authentication and access rights for my routes (which I think is a recommended practice?).
Because auth is not declared in RouteConfig TS raised an error.
There are several ways to remove the error, but in this case I thought that it just made more sense to add [x: string]: any inside the RouteConfig declaration.
The consequence is that we still get intellisense for declared RouteConfig properties, but we may freely extend it with undeclared properties.