You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment, Vec<T> simply exports Array<T>, which is generally what the user expects, even in Tauri, as most of the time the serialization is done through serde.
We do this through a generic impl block on Vec that goes something like
impl<T:TS>TSforVec<T>{// ... export T, but wrapped in Array<>}
So we can't just write
implTSforVec<u8>{// Export as Uint8Array}
because that would generate a compiler error complaining about conflicting trait impls.
Also, most people don't expect an Uint8Array, so even if it were allowed, we still couldn't do that easily, as it can't be the default behavior.
I do recommend that you create a type that exports as Uint8Array and use #[ts(as = "...")] instead of #[ts(type = "...")] though, as it helps avoid typos
@eye-wave I'd be interested in how you do (de)serialization such that you'd profit from ts-rs generating typed arrays. What format are you using for (de)serialization, and which libraries do you use for them on the Rust/TS side?
I'd generally be open to support more data models besides the serde data model, but the serde model is the only commonly used one i am aware of.
Is your feature request related to a problem? Please describe.
It would be to have Integer of Float Vectors be converted to typed arrays.
example
Describe alternatives you've considered
Tsify, but it only works with wasm-bindgen which i don't need for a tauri app
adding #[ts(type = "MyArray")] for each problematic property
The text was updated successfully, but these errors were encountered: