specta-rs / specta

Easily export your Rust types to other languages
MIT License
279 stars 38 forks source link

Support generic functions #149

Open Brendonovich opened 1 year ago

Brendonovich commented 1 year ago

fn command(arg; tauri::AppHandle<impl tauri::Runtime>) no workey

oscartbeaumont commented 1 year ago

Right now Specta requires all generics for a function to be hardcoded to a specific type when exporting but it would maybe be nice if that wasn't a requirement and it could end up in TS as generics. That being said how do Rust generic bounds translate into Typescript bounds is a really big question here.

oscartbeaumont commented 1 year ago

We also don't support impl Runtime or the like as an argument because we don't ever know the concrete type of the function so it can't be exported.