tinvoke
v0.1.0
Published
A type-safe wrapper for Tauri's invoke function
Downloads
215
Maintainers
Readme
tinvoke
Type-safe wrapper for Tauri's invoke function.
Installation
npm install tinvokeQuick Setup
1. Add ts-rs dependency and export Rust types
Follow the setup guide at ts-rs
2. Configure TypeScript types
import type { User } from 'path/to/bindings/User'
import type { Command } from 'tinvoke'
declare module 'tinvoke' {
interface CommandsMap {
get_user: Command<User, { name: string }>
}
}Usage
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' })License
MIT
