We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There isn't any type safety for the invoke function, so it's extremely easy to pass invalid arguments.
I think it would be great if rust could generate a d.ts file with the different registered handlers.
d.ts
This should be possible by creating a d.ts file in the root of the "frontend" src like so:
declare module "@tauri-apps/api/core" { export function invoke<T>( cmd: "greet", args: {name: string}, options?: unknown, ): Promise<T>; export function invoke<T>( cmd: "meet", args: {greeting: string}, options?: unknown, ): Promise<T>; // Optionally exclude this to provide stricter type safety export function invoke<T>( cmd: string, args?: unknown, options?: unknown, ): Promise<T>; }
There may be a better way to provide type safety but this was just my initial thoughts.
No response
The text was updated successfully, but these errors were encountered:
Duplicate of #1514, thanks for the feature request.
Sorry, something went wrong.
No branches or pull requests
Describe the problem
There isn't any type safety for the invoke function, so it's extremely easy to pass invalid arguments.
Describe the solution you'd like
I think it would be great if rust could generate a
d.ts
file with the different registered handlers.This should be possible by creating a d.ts file in the root of the "frontend" src like so:
There may be a better way to provide type safety but this was just my initial thoughts.
Alternatives considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: