diff --git a/napi/src/js_values/number.rs b/napi/src/js_values/number.rs index f3578de1..a81f45d5 100644 --- a/napi/src/js_values/number.rs +++ b/napi/src/js_values/number.rs @@ -6,16 +6,6 @@ use crate::{sys, Error, Result}; pub struct JsNumber(pub(crate) Value); -impl TryFrom for usize { - type Error = Error; - - fn try_from(value: JsNumber) -> Result { - let mut result = 0; - check_status!(unsafe { sys::napi_get_value_int64(value.0.env, value.0.value, &mut result) })?; - Ok(result as usize) - } -} - impl TryFrom for u32 { type Error = Error; diff --git a/test_module/src/array.rs b/test_module/src/array.rs index 2348320b..3df64fd6 100644 --- a/test_module/src/array.rs +++ b/test_module/src/array.rs @@ -12,9 +12,8 @@ fn test_create_array(env: Env) -> ContextlessResult { #[js_function(1)] fn test_create_array_with_length(ctx: CallContext) -> Result { - ctx - .env - .create_array_with_length(ctx.get::(0)?.try_into()?) + let length: u32 = ctx.get::(0)?.try_into()?; + ctx.env.create_array_with_length(length as usize) } #[js_function(3)]