Let's say I have method get as part of class
/** @type {Get<{ someCustomProperty: string }>} */
get({ headers, params, data, someCustomProperty }) {
this.get(path, headers, params, data, (data) => {
// some custom logic where I will use someCustomProperty
});
}
Then I have type Get.
import { ReqData, ReqHeaders, ReqParams, RespData } from "somewhere";
export type Clients = {
get<T extends { [key: string]: unknown } = {}>: (args: {
headers: ReqHeaders,
params: ReqParams,
data: ReqData,
} & T) => RespData;
}
Something like this, but this doesn't actually work. How can I make it so user, who imports my type (from my lib), would be able to use my type both as Get and Get<{ someCustomProperty: string }> ? E.g. extending my own type viac generic?