Run TypeScript.
Bind natively.
Write the library in TypeScript. TypeBind generates typed native bindings so iOS and Android execute the same code.
counter.impl.ts
import { implement } from "@typebind/core";import type { TCounter } from "./counter.js";let count = 0;export const counter = implement<TCounter>({add: async ({ amount }) => (count += amount),get: async () => count,});
Swift
try await counter.add(amount: 1)
Kotlin
counter.add(amount = 1.0)
Swift
try await counter.add(amount: 1)
Kotlin
counter.add(amount = 1.0)
Write once, run everywhere
Call your TypeScript natively with a shared interface.
Step 1
Write the library once
The implementation is ordinary async TypeScript. TypeBind type-checks it against the contract without shipping overhead in the JS bundle.
Step 2
Generate native bindings
TypeBind walks the contract and emits Swift and Kotlin types and a wrapper class so native code calls your implementation safely.
Step 3
Call JS from native
iOS and Android stay in charge. They load the JS module and talk to it through the generated API. The same implementation on all platforms.
One contract is the source
A Zod contract types the library. What you ship is ordinary TypeScript — no extra runtime, no extra weight in the bundle.
- Zod is not shipped in the bundle.
counter.contract.ts
export const Counter = defineModule({add: {args: z.object({ amount: z.number() }),returns: z.number(),},get: {args: z.void(),returns: z.number(),},});
Native is the host
Your app stays Swift or Kotlin. TypeBind generates the class the host constructs, then that class talks to the JS module on JavaScriptCore or QuickJS.
One contract, two APIs
The same Zod module becomes Codable Swift, kotlinx.serialization Kotlin, and executor wrappers. Types match because they come from one source.
JSON-shaped types
Anything that maps cleanly across the bridge is allowed: strings, numbers, bools, objects, arrays, enums, optionals.
Mismatch fails loud
Ship last week's JS with this week's native API and the wrapper refuses to start. No silent drift in production.
Write TypeScript. Bind natively.
Define the contract, implement the library, generate Swift and Kotlin. JavaScriptCore on iOS, QuickJS on Android.