I have this enum
enum methods {
DELETE = 1,
POST,
PUT,
GET
}
I want to have a function accepting a parameter that can be one of the keys of the methods enum.
const getMethodPriority = (method /* how do I type this? */) => {
return methods[method];
};
so, for example getMethodPriority("DELETE") would return 1.
How do I type the method parameter?
(method: keyof typeof methods)