Imagine you have an interface structured like this:
interface endpoints {
"/api/user/{id}": {
get: operations["getUserGET"];
};
"/api/user/add": {
put: operations["addUsingPUT"];
};
...
}
Is it possible to create a subtype that filters by HTTP methods such as get, put, post, etc?
The desired outcome would look something along these lines:
type getEndpoints = CoolFilter<endpoints, 'get'>
/* equivalent to: */
interface getEndpoints {
"/api/user/{id}": {
get: operations["getUserGET"];
};
/* only including GET methods in the interface */
}