diff --git a/jvm/hermes/src/main/jni/JJSIValue.cpp b/jvm/hermes/src/main/jni/JJSIValue.cpp index 1c321533b..7b096f55d 100644 --- a/jvm/hermes/src/main/jni/JJSIValue.cpp +++ b/jvm/hermes/src/main/jni/JJSIValue.cpp @@ -147,8 +147,8 @@ bool JJSIValue::asBool() { return value_->asBool(); } -double JJSIValue::asNumber() { - return value_->asNumber(); +jint JJSIValue::asNumber() { + return static_cast(value_->asNumber()); } // TODO: Ensure this is what we want to do - we can return the JSI String container diff --git a/jvm/hermes/src/main/jni/JJSIValue.h b/jvm/hermes/src/main/jni/JJSIValue.h index 660771034..0c0deadf3 100644 --- a/jvm/hermes/src/main/jni/JJSIValue.h +++ b/jvm/hermes/src/main/jni/JJSIValue.h @@ -111,7 +111,7 @@ class JJSIValue : public HybridClass { bool isObject(); bool asBool(); - double asNumber(); + jint asNumber(); std::string asString(alias_ref jRuntime); jlong asBigInt(alias_ref jRuntime); local_ref asSymbol(alias_ref jRuntime); diff --git a/jvm/hermes/src/main/kotlin/com/intuit/playerui/jsi/Value.kt b/jvm/hermes/src/main/kotlin/com/intuit/playerui/jsi/Value.kt index 2ca3a862e..86085ddcc 100644 --- a/jvm/hermes/src/main/kotlin/com/intuit/playerui/jsi/Value.kt +++ b/jvm/hermes/src/main/kotlin/com/intuit/playerui/jsi/Value.kt @@ -70,7 +70,7 @@ public class Value private constructor(mHybridData: HybridData) : JSIValueContai public external fun asBoolean(): Boolean // TODO: Consider making this return Number directly, so there aren't assumptions about what will come out of this? - public external fun asNumber(): Double + public external fun asNumber(): Int // TODO: Doing this for Player runtime compat /** context(RuntimeThreadContext) */ public external fun asString(runtime: Runtime): String /** context(RuntimeThreadContext) */ public external fun asBigInt(runtime: Runtime): Long /** context(RuntimeThreadContext) */ public external fun asSymbol(runtime: Runtime): Symbol