Conversation
# Conflicts: # example/src-tauri/Cargo.lock # taurpc/Cargo.toml # taurpc/src/lib.rs
oscartbeaumont
left a comment
There was a problem hiding this comment.
I have left some comments again to explain some things! Just let me know if I can be of any help fixing anything or if you want clarification on anything!
taurpc/src/export.rs
Outdated
| ) -> Result<(), Error> { | ||
| // TODO: Maybe default to `true` once this is more stable. | ||
| // Maybe use a runtime configuration system? | ||
| let specta_phases_enabled = cfg!(not(feature = "specta_phases")); |
There was a problem hiding this comment.
I don't know how would be best to configure this? I think TauRPC should concider a manual builder.some_config().export(path)-like API similar to Tauri Specta so we have something to put configuration on but I think we do a change like that in another PR. From what I have seen in comments maybe some TauRPC users like the export being implicit, so idk what the best way to solve this in.
For now I am implementing this feature internally but we really don't need to expose or document it until a later date. If anything, delaying launching this could be good so we can get some more user feedback from Tauri Specta users to fix issues.
| } | ||
| } | ||
|
|
||
| fn extract_std_result<'a>( |
There was a problem hiding this comment.
This is effectively the new version of specta::datatype::FunctionReturnType.
| None | ||
| } | ||
|
|
||
| fn validate_exported_command(command: &Function, types: &ResolvedTypes) -> Result<(), Error> { |
There was a problem hiding this comment.
This validation logic is likely going to be cleaner in .rc-25 as it's currently pretty messy but this how Tauri Specta does it.
I am thinking specta_typescript::Exporter needs an API for built-in validation which I am prototyping on specta-rs/specta#470. Both for cleaner code and so it's easier to not forget to check it everything.
| /// The newest version of Specta's Typescript exporter will always error on these (and the previous solution which was `BigIntExportBehaviour` has been removed). | ||
| /// The recommendations for handling this now are documented here: https://github.com/specta-rs/specta/blob/d578bc055b7c5e6573d1cd723e7be56d33c28e5c/specta-typescript/src/error.rs#L11 | ||
| /// | ||
| // TODO: I (@oscartbeaumont) am going to do a follow up PR to support BigInt's properly in the future but this requires upstream work in Tauri so it's not possible at the moment. |
There was a problem hiding this comment.
As this comment says I am working on getting bigint support into Tauri. For now we reimplement BigIntExportBehavior::Number in TauRPC (this is what Tauri Specta is doing for now).
I will follow up with a PR for proper support once it's ready!
So this code is going to be removable in the hopefully near-future!
This release hasn't been published but it's going to be coming out soon so this is a draft for upgrading. This will likely replace #58 unless it gets merged prior to me doing the next Specta release.
This PR is based on #58 so it's review comments are also relevant.