firebase-functions-test
firebase-functions-test copied to clipboard
Update wrappedFunction return type can be promise
trafficstars
Following changes
- add WrappedFunction & WrappedScheduledFunction "generic"
- change WrappedFunction & WrappedScheduledFunction's return type "any | Promise<any>" to "T"
Problem
In the v0.3.3 wrap()() this function's return type will be any. so when I test promise function using by chai.should, Automatic completion doesn't work.

Solution
Return type any | Promise<any> must be any. So I use generic to "Promiseable"
https://github.com/firebase/firebase-functions-test/blob/c1dd82b84f5fe4126ca666577a04a7d72e96f2fc/src/main.ts#L96-L99
change to
export type WrappedFunction<T = any> = (
data: any,
options?: ContextOptions
) => T;
then I can use like that

Now I signed cla/google. Please rescan 🙏.