firebase / firebase/firebase-functions-test

The wrap function doesn't accept type BlockingFunction

Open
#218 2 comments 0 reactions 0 assignees View on GitHub
triaged type: feature request
Dominant language
TypeScript
Stars
248
Forks
63
PR merge metrics
No merged PRs in 30d

Description

### Version info

**firebase-functions-test:**

**firebase-functions:**

**firebase-admin:**

### Test case

I am testing firebase blocking functions by `firebase-functions-test`, But the there is no overload on `wrap` function.

### Steps to reproduce

Production code:

export const beforeSignIn = auth.user().beforeSignIn(async (user, context) => {
if (user.phoneNumber == undefined) {
throw new HttpsError(
"permission-denied", "Invalid phone number");
}
return;
});

Test code(This throws error):

const wrapped = wrap(beforeSignIn);

### Expected behavior

`wrap` function should accept type `BlockingFunction`

### Actual behavior

```
No overload matches this call.
Overload 1 of 3, '(cloudFunction: HttpsFunction & Runnable): WrappedFunction>', gave the following error.
Argument of type 'BlockingFunction' is not assignable to parameter of type 'HttpsFunction & Runnable'.
Property 'run' is missing in type 'BlockingFunction' but required in type 'Runnable'.
Overload 2 of 3, '(cloudFunction: CloudFunction): WrappedScheduledFunction | WrappedFunction', gave the following error.
Argument of type 'BlockingFunction' is not assignable to parameter of type 'CloudFunction'.
Property 'run' is missing in type 'BlockingFunction' but required in type 'CloudFunction'.
Overload 3 of 3, '(cloudFunction: CloudFunction>): WrappedV2Function>', gave the following error.
Argument of type 'BlockingFunction' is not assignable to parameter of type 'CloudFunction>'.
Property 'run' is missing in type 'BlockingFunction' but required in type 'CloudFunction>'.t
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.