Skip to content

A type-safe wrapper for Tauri's invoke function

License

joris-gallot/tinvoke

Repository files navigation

tinvoke

Type-safe wrapper for Tauri's invoke function.

Installation

npm install tinvoke

Quick 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

About

A type-safe wrapper for Tauri's invoke function

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •