UNPKG

nitro-codegen

Version:

The code-generator for react-native-nitro-modules.

18 lines (17 loc) 554 B
/** * Returns a boxed version of the given primitive type. * In JNI/Kotlin, primitive types (like `double` or `boolean`) * cannot be nullable, so we need to box them - e.g. as `JDouble` or `JBoolean`. */ export function getKotlinBoxedPrimitiveType(type) { switch (type.kind) { case 'number': return 'jni::JDouble'; case 'boolean': return 'jni::JBoolean'; case 'bigint': return 'jni::JLong'; default: throw new Error(`Type ${type.kind} is not a primitive!`); } }