Open
Description
Following up on the now closed #163 , there is still a type issue with wrap
when trying to test v2 functions.
For example, if we just want to call the function:
await wrap(fnsmyV2Function)({ data: { whatever: "mydatais" } })
...this creates the following Typescript error:
Typescript error with V2 `wrap` Type '{ data: WhatEverTypeMyParameterTypeIs; }' is missing the following properties from type 'CallableRequest<any>': rawRequest, acceptsStreaming
It is indeed a usecase to set rawRequest
sometimes in the wrapped request, e.g. if you want to fake some parameters of the request.
So I think that the wrapped function parameter should be typed Partial<CallableRequest<any>>
.
Ideally, it should infer the request object any
from the original CallableFunction
definition so it is typed Partial<CallableRequest<WhatEverTypeMyParameterTypeIs>>
.
Even better, the then optional rawRequest
property should also be a Partial<Request>
so we can only provide the values we need for a test.