diff --git a/src/types.h b/src/types.h index af3c99a..a6a7b1f 100644 --- a/src/types.h +++ b/src/types.h @@ -183,24 +183,6 @@ struct Type { } }; -template<> -struct Type { - static constexpr const char* name = "BigInt"; - static inline napi_status ToNode(napi_env env, - uint64_t value, - napi_value* result) { - return napi_create_bigint_uint64(env, value, result); - } - static inline std::optional FromNode(napi_env env, - napi_value value) { - uint64_t result; - bool lossless; - if (napi_get_value_bigint_uint64(env, value, &result, &lossless) == napi_ok) - return result; - return std::nullopt; - } -}; - #if defined(__APPLE__) template<> struct Type { @@ -254,6 +236,23 @@ struct Type { } }; +template<> +struct Type { + static constexpr const char* name = "Integer"; + static inline napi_status ToNode(napi_env env, + uint64_t value, + napi_value* result) { + return Type::ToNode(env, static_cast(value), result); + } + static inline std::optional FromNode(napi_env env, + napi_value value) { + auto result = Type::FromNode(env, value); + if (!result) + return std::nullopt; + return static_cast(*result); + } +}; + template<> struct Type { static constexpr const char* name = "Boolean";