oscartbeaumont / tauri-specta

Completely typesafe Tauri commands
MIT License
289 stars 26 forks source link

`reference` not `inline` result types. #72

Closed oscartbeaumont closed 2 months ago

oscartbeaumont commented 5 months ago

https://discord.com/channels/616186924390023171/731495028677148753/1201755428728606780

nobane commented 5 months ago

The discord link points to my message about:

#[derive(Serialize, Type)]
struct InitData {
  files: Vec<FileDetail>,
}
#[tauri::command]
#[specta::specta]
pub async fn get_init_data() -> Result<InitData, ()> { 
//...
}

makes

async getInitData() : Promise<__Result__<{  files: FileDetail[]; }> {

but it would be nice if it was actually

async getInitData() : Promise<__Result__<InitData> {
oscartbeaumont commented 5 months ago

This was probably fixed by https://github.com/oscartbeaumont/specta/issues/191.

Hopefully a new Specta release and upgrading Tauri Specta will be enough to fix it.

Sharpiro commented 2 months ago

This was probably fixed by oscartbeaumont/specta#191.

Hopefully a new Specta release and upgrading Tauri Specta will be enough to fix it.

Can we get a new Tauri Specta RC build to see if this works now?

oscartbeaumont commented 2 months ago

I can confirm it is fixed from my testing so i'm going to close this issue.

If you checkout the docs here they will help you get setup with a fixed version. I will do a release once the bugs in #86 are sorted out.