Skip to main content

Primitives (number, boolean, bigint)

Primitive datatypes like number, boolean or bigint can use platform-native datatypes directly. For example, a JS number is always a 64-bit double in C++, a Double in Swift, and a Double in Kotlin.

interface Math extends HybridObject {
add(a: number, b: number): number
}

Primitives are very efficient and can be passed with little to no overhead, especially between C++ and Swift, and C++ and Kotlin.

bigint's actual type

A bigint is actually a variable-size type. While it is bridged to a 64-bit Integer (-263 … 263−1), it can theoretically be larger than that.

Since there is no built-in equivalent of bigint in C++/Swift/Kotlin, you'd need to stringify the bigint value on the JS side and parse it from a string to your big number library of choice on the native side again in cases where you really need big numbers.