- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
new Pool() instanceof Pool
is false
#1612
Comments
Took a look at new Pool() instanceof EventEmitter; // true
new Pool() instanceof Pool; // false Woult it be possible to use |
Another work-around might be to check against const {Pool: createPool} = require('pg');
const Pool = require('pg-pool');
createPool() instanceof Pool; // true |
This will be fixed by #1541 in a new major version. |
Still occurring in
|
Also please note that
|
@alxndrsn “in a new major version”, so 8.0.0. |
Aha of course, sorry for not getting that 🙂 |
I'm releasing this very soon: #2063 |
(fixed in pg 8.0.0) |
Code
Expected
Should run fine.
Actual
AssertionError [ERR_ASSERTION]: false == true
Versions
I am building a wrapper that accepts either
Pool
orConnection
and want to have listeners for pool's events, but not client's. To work around this issue I am usinginstanceof
with right-hand side ofPool.super_
. Not sure if this property is intended to be used that way, or won't change later since docs don't mention its existence.I'd propose to fix this by adding and exporting a static method that's something like
Pool.new(options)
instead of exporting a wrapper function. We can keepsuper_
on it as a property as well, so change won't be semver-breaking. If this is not feasible given dependency onpg-pool
module, we can inherit from there with only difference beingPool.Client
.The text was updated successfully, but these errors were encountered: