Skip to content

Upgrade Specta 2.0.0-rc.24#64

Open
oscartbeaumont wants to merge 26 commits intoMatsDK:mainfrom
oscartbeaumont:upgrade-specta-rc24
Open

Upgrade Specta 2.0.0-rc.24#64
oscartbeaumont wants to merge 26 commits intoMatsDK:mainfrom
oscartbeaumont:upgrade-specta-rc24

Conversation

@oscartbeaumont
Copy link
Copy Markdown

@oscartbeaumont oscartbeaumont commented Mar 30, 2026

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.

Copy link
Copy Markdown
Author

@oscartbeaumont oscartbeaumont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

) -> 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"));
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>(
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is effectively the new version of specta::datatype::FunctionReturnType.

None
}

fn validate_exported_command(command: &Function, types: &ResolvedTypes) -> Result<(), Error> {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@oscartbeaumont oscartbeaumont marked this pull request as ready for review March 31, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants