Skip to content
New issue

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

Empty binding.ts file generated when the input commands contain usize as parameter #157

Open
Nithin1506200 opened this issue Jan 16, 2025 · 1 comment

Comments

@Nithin1506200
Copy link

when ever any tauri commands contains a input parameter has usize an empty binding.ts is generated. If the input parameter is i32 its works as fine as number data type is infered then.

#[specta::specta]
#[tauri::command]
pub async fn spectra_generate(
  indx:usize // it works for i32 !
) -> Result<Vec<String>, String> {
 //some code
}
#[test]
#[cfg_attr(mobile, tauri::mobile_entry_point)]
fn generate_arr() {
    let builder = Builder::<tauri::Wry>::new().commands(collect_commands![
        spectra_generate,
    ]);
    let _ = builder.export(
        specta_typescript::Typescript::default(),
        "../src/bindings.ts",
    );
}

//
specta-typescript = "0.0.7"

@Brendonovich
Copy link
Collaborator

I'd recommend adding .unwrap() after .export(), it's likely you'll see an error about how usize can't be properly exported to typescript as JS doesn't support 64 bit integers without BigInt. You can ignore the error with the bigint modifier on Typescript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants