https://github.com/joris-gallot/tinvoke
A type-safe wrapper for Tauri's invoke function
https://github.com/joris-gallot/tinvoke
invoke tauri typesafe typescript
Last synced: 5 months ago
JSON representation
A type-safe wrapper for Tauri's invoke function
- Host: GitHub
- URL: https://github.com/joris-gallot/tinvoke
- Owner: joris-gallot
- License: mit
- Created: 2025-08-08T15:17:10.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-08-31T13:28:56.000Z (6 months ago)
- Last Synced: 2025-08-31T15:29:12.503Z (6 months ago)
- Topics: invoke, tauri, typesafe, typescript
- Language: TypeScript
- Homepage:
- Size: 147 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tinvoke
Type-safe wrapper for [Tauri](https://tauri.app)'s invoke function.
## Installation
```bash
npm install tinvoke
```
## Quick Setup
### 1. Add ts-rs dependency and export Rust types
Follow the setup guide at [ts-rs](https://github.com/Aleph-Alpha/ts-rs#get-started)
### 2. Configure TypeScript types
```typescript
import type { User } from 'path/to/bindings/User'
import type { Command } from 'tinvoke'
declare module 'tinvoke' {
interface CommandsMap {
get_user: Command
}
}
```
## Usage
Full type safety: command names, parameters, and return types are all typed based on your CommandsMap definition.
```typescript
import { tinvoke } from 'tinvoke'
const user = await tinvoke('get_user', { name: 'Alice' })
```
## License
MIT