specta-rs / tauri-specta

Completely typesafe Tauri commands
MIT License
368 stars 40 forks source link

don't generate unused functions in bindings #138

Open MnlPhlp opened 1 week ago

MnlPhlp commented 1 week ago

When there are no events, part of the bindings file is unused. In my case with "noUnusedLocals": true, in the tsconfig this lead to my project not compiling.

This PR splits the global.ts and global.js into two parts and only includes the event related code if there are any events defined.

I tested this in my project, but I am not very used to ts/js. So feel free to point out any issues.

MnlPhlp commented 1 week ago

Asked for some clarifications

I commented and made a small change. Is there anything else that is still wrong?