-
-
Notifications
You must be signed in to change notification settings - Fork 175
Multiple versions of polka can't play nice #211
Copy link
Copy link
Open
Description
In some cases, you may end up with something like this:
import {someApp} from 'wherever'; // Assume this package bundles polka, so it has its own copy
import polka from 'polka';
const server = polka();
const app = someApp();
app.server; // a Polka instance
server.use(app.server); // error since `!(app.server instanceof Polka)`you shouldn't run into this often since your package manager would usually de-dupe and you'd have a single polka version
however, its very possible something you depend on which consumes polka instances (or any polka types) is pinned to an older 1.x than you are for example.
to solve this, maybe instead of base instanceof Polka, we can brand the class and check for that instead (some sort of _$polkaVersion or something, so we can also only consume same-major instances)
Line 28 in 08a6f63
| } else if (typeof base === 'function' || base instanceof Polka) { |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels