Type-safe native bindings generated automatically from TypeScript specs with lazy on-demand loading.
A library with 10,000 reference manuals: instead of carrying every manual to your desk before you start studying (eager load), you look up the exact book you need only when you turn to that chapter (lazy load).
Developer authors TypeScript module specification: export interface Spec extends TurboModule { ... }
Build step: Codegen parses TS spec and generates C++ header bindings and Java/Obj-C protocols
App startup: TurboModuleRegistry registers module metadata with 0ms initialization overhead
Runtime: JS calls NativeStorage.setItem("token", val)
Engine lazily instantiates C++ HostObject and invokes native OS Keychain/Keystore directly
// NativeStorageSpec.ts (Codegen Specification)
import type { TurboModule } from 'react-native';
import { TurboModuleRegistry } from 'react-native';
export interface Spec extends TurboModule {
getItem(key: string): Promise<string | null>;
setItem(key: string, value: string): Promise<void>;
removeItem(key: string): Promise<void>;
}
export default TurboModuleRegistry.getEnforcing<Spec>('NativeStorage');Lazy module initialization saves 200–500ms of startup latency by loading camera, Bluetooth, and biometrics only when the user opens those screens.