-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
browser: refactor/remove asPromise #686
Conversation
|
e4106b8
to
2a17b84
Compare
}, | ||
}) | ||
) | ||
await fn({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume that the original intention to use await asPromise
here was because MiddlewareFunction
and SourceMiddleware
could return a Promise -- and maybe whoever wrote this originally didn't realize that void | Promise<void>
is a valid return type -- or that there's no requirement to "normalize" all values to a promise in order to await -- that you can just as easily await a regular value as a promise (await 123
=== await Promise.resolve(123)
).
2a17b84
to
f81ed0c
Compare
f81ed0c
to
04bf2c6
Compare
da031b5
to
275d5a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet, love removing code!
This
asPromise
method seems to add unneccessary complexity both in the way it's used and by virtue of its existence. If there's a galaxy brain reason for why we'd do this, I can't find it.A util method that's just an alias to Promise.resolve?... like whyyyyy 😄 And there are actual unit tests for this method?