Skip to content

Commit

Permalink
fix: Implement canConvert for Promise
Browse files Browse the repository at this point in the history
  • Loading branch information
mrousavy committed Nov 19, 2024
1 parent 5e4cd62 commit 7f37a35
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,12 @@ struct JSIConverter<std::shared_ptr<Promise<TResult>>> final {
}
}

static inline bool canConvert(jsi::Runtime&, const jsi::Value&) {
throw std::runtime_error("jsi::Value of type Promise cannot be converted to Promise<> yet!");
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
if (!value.isObject()) {
return false;
}
jsi::Object object = value.getObject(runtime);
return object.hasProperty(runtime, "then");
}
};

Expand Down

0 comments on commit 7f37a35

Please sign in to comment.