Utilizing a function from a library with the following type:
type QueryFetcher = (query: string, variables?: Record<string, any>) => Promise<QueryResponse> | QueryResponse;
I aim to introduce an additional argument to this type without modifying the declaration in the source file.
My approach was to create:
type WithHeader = (header: string) => Promise<QueryResponse> | QueryResponse
type QueryFetcherWithHeader = QueryFetcher & WithHeader
However, this did not result in:
(query: string, variables?: Record<string, any>, header: string) => Promise<QueryResponse> | QueryResponse;
It seems there is a misunderstanding on my part, but I am unable to pinpoint it.