I have the following scenario:
interface Foo<GenericA, GenericB> {}
I want to declare a variable of type Foo, but only specify the second generic, e.g.:
const foo: Foo<GenericBType>;
I can only do that if I write
const foo: Foo<unknown, GenericBType>;
It is not really that bad, but it doesn't feel right either, as I just want to make use of the second type, and I am not interested in the first at all.
Is there any other way I can write this in a more succinct way?
PS: This is about the expressjs types. I want to type the Request object, but I only want to consider the type of the Query params, which is the fourth generic in the type of the Request:
interface Request<
P = core.ParamsDictionary,
ResBody = any,
ReqBody = any,
ReqQuery = core.Query,
Locals extends Record<string, any> = Record<string, any>
> extends core.Request<P, ResBody, ReqBody, ReqQuery, Locals> {}
so I would have to write something like:
req: Request<unknown, unknown, unknown, Foo>
and it's really not beautiful...