Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: export non-Procedures TypeScript types #323

Merged
merged 3 commits into from
Dec 3, 2024

Conversation

espeon
Copy link
Contributor

@espeon espeon commented Dec 1, 2024

Should close #320.

Typemaps should now be correctly merged and exported. Let me know of any issues or things I've overlooked.

@yuezk
Copy link
Contributor

yuezk commented Dec 2, 2024

This PR fixes the issue. But it couldn't handle the generic type. For example, the following code:

#[derive(Debug, Serialize, Type)]
pub(crate) struct Success<T: Serialize + Type = ()> {
  data: T,
}

...will produce:

export type Success = { data: T };

But previously with the older versions crates:

specta = "=2.0.0-rc.1"
specta-macros = "=2.0.0-rc.1"
rspc = { version = "1.0.0-rc.5", features = ["tauri"] }

It can produce the correct types.

export type Success<T> = { data: T }

src/legacy/router.rs Outdated Show resolved Hide resolved
Copy link
Member

@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.

Happy to merge once the comments are addressed. I do agree with @yuezk's comment.

Thanks for taking the time to do a PR and thanks @yuezk for the feedback!

src/legacy/resolver.rs Outdated Show resolved Hide resolved
@espeon espeon requested a review from oscartbeaumont December 2, 2024 16:48
@oscartbeaumont oscartbeaumont merged commit 0096763 into specta-rs:main Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

rspc router doesn't export types that implement specta::Type
3 participants