type-fest
type-fest copied to clipboard
Request: `Slice` or `Rest`
Use case: writing a facade for a function, that supplies the first function parameter:
import { getVehicleFeatures } from './vehicle-utils';
declare const vehicle;
function getFeatures (...args: Slice<1, Parameters<typeof getVehicleFeatures>) {
return getVehicleFeatures(vehicle, ...args);
}
So the getFeatures
function has all of the parameters of getVehicleFeatures
except for the first, which is the vehicle itself. This is a form of currying. It allows getFeatures
to reference the parameter array type of getVehicleFeatures
and get a type with all the params except the first.
Alternate suggestions welcome :slightly_smiling_face:
Upvote & Fund
- We're using Polar.sh so you can upvote and help fund this issue.
- The funding will be given to active contributors.
- Thank you in advance for helping prioritize & fund our backlog.
Related #734
#734 completed