Type-safe wrapper for Tauri's invoke function.
npm install tinvokeFollow the setup guide at ts-rs
import type { User } from 'path/to/bindings/User'
import type { Command } from 'tinvoke'
declare module 'tinvoke' {
interface CommandsMap {
get_user: Command<User, { name: string }>
}
}Full type safety: command names, parameters, and return types are all typed based on your CommandsMap definition.
import { tinvoke } from 'tinvoke'
const user = await tinvoke('get_user', { name: 'Alice' })MIT