I want to do currying with typescript and have:
const findValueInDb = (value: number, dbSpec: string) => `found it, it's here: ${dbSpec}!`
const createFindValue = (dbSpec: string) =>
(...params: Omit<Parameters<typeof findValueInDb>, "1">) => findValueInDb(...params, dbSpec)
const theResult = createFindValue("theDb")(10)
This does not work, and it would not be very flexible if arguments are added to the source function. How can I define a currying contract? One that removes the last argument, but keeps the others?