I've been struggling to understand what it is about this code that is causing a problem. It'd be great if someone could explain what leads to the problem, and perhaps how it may be solved.
In my app I'm trying to use an enum to define the routes used by a router. This was working in certain places but for some reason, in the context I'm now using the enum, it isn't working.
Where it works, it may look something like this:
history.push(routes.testPage)
Where it doesn't work, it looks something like this:
const enum routes {
    index = '/',
    testPage = '/test',
}
const adminRoutes = [
    routes.testPage,
];
const routeIsAdmin = (route: string) => adminRoutes.indexOf(route) > -1;
The error I get in this instance is:
Argument of type 'string' is not assignable to parameter of type 'routes'
I've created an example of this code on the typescript playground.
Would someone be able to provide any insight on this?
Edit
For further clarity, adding any string to the array adminRoutes means that this works with no problems. This is not really a workaround which I'd like to use, but perhaps it helps to explain the problem.
