This repository was archived by the owner on Jan 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
CustomEvent thrown TypeError
is not an instance of TypeError
#160
Comments
10 tasks
Please provide a minimal repro |
|
Roughly function _instanceof(left, right) {
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
return !!right[Symbol.hasInstance](left);
} else {
return left instanceof right;
}
}
try {
new CustomEvent("abc", "abc");
} catch (e) {
console.log(_instanceof(e, TypeError));
} |
I'm using:
Discovered here MatrixAI/js-events#2 while testing. I ended up just changing my code to do this Where the target is |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I noticed this while using Node 20.x and using the new
CustomEvent
global.Inside nodejs this answers
true
:However when running inside
jest
it ends up producingfalse
instead.Initial research points to transpilation being where the source of this problem is likely. However it could also be a jest upstream situation.
The text was updated successfully, but these errors were encountered: