Skip to content

@statesync/tauri


@statesync/tauri / TauriInvoke

Type Alias: TauriInvoke()

ts
type TauriInvoke = <T>(commandName, args?) => Promise<T>;

Defined in: transport.ts:69

Minimal structural type matching the Tauri invoke function signature.

Accepts any function that:

  1. Takes a Tauri command name and an optional args record.
  2. Returns a promise resolving to the command's return value.

Consumers can pass:

  • invoke from @tauri-apps/api/core (production)
  • A custom stub with the same shape (testing / mocking)

Type Parameters

Type ParameterDescription
TThe return type of the invoked Tauri command.

Parameters

ParameterType
commandNamestring
args?Record<string, unknown>

Returns

Promise<T>

Example

typescript
import { invoke } from '@tauri-apps/api/core';

// `invoke` satisfies TauriInvoke out of the box:
const tauriInvoke: TauriInvoke = invoke;

Released under the MIT License.