There's another path that also returns `undefined`:

```
if (typeof args[args.length - 1] === "function") {
```

Should that return a resolved promise?