Skip to content

Commit

Permalink
Refixed throwing "Illegal constructor"
Browse files Browse the repository at this point in the history
  • Loading branch information
kraenhansen committed Dec 21, 2021
1 parent 07e60ca commit 8838b81
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/jsi/jsi_class.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ class ObjectWrap {
.call(env, "nativeFunc",
util::format(R"(
return function %1(...args) {
// Allow explicit construction only for `Realm` and `Realm.Object`
if (new.target && "%1" !== "Object" && "%1" !== "Realm") {
// Allow explicit construction only for classes with a constructor
if (new.target && !nativeFunc) {
throw TypeError("Illegal constructor");
}
if (nativeFunc)
Expand Down

0 comments on commit 8838b81

Please sign in to comment.