Hi, Im working on update our Got instance from v8 to v11, in Typescript.
Initialy we had a option named traceId
who add a custom header x-trace-id
containing a unique string.
myGot(url, {traceId})
produce x-trace-id: a3c3d658e59fe2af86697c6d968f1b26
header
In JS no problem easy way with a handler
handlers: [
(options, next) => {
if (options.traceId) {
options.headers['x-trace-id'] = options.traceId;
return next(options);
}
options.headers['x-trace-id'] = uuidV4();
return next(options);
}
]
In TS the definition NormalizedOptions
does not allow to extends interface with additional option. Compilation throw Property 'traceId' does not exist on type 'NormalizedOptions'.
I admit my knowledge of Typescript is weak/young but I would expect a generic interface from Got.
If you have any ideas or suggests to help me, you are welcome.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too