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

[Discussion] Plans to support duplicate type names? #62

Open
ajmcquilkin opened this issue Apr 11, 2023 · 1 comment · May be fixed by #72
Open

[Discussion] Plans to support duplicate type names? #62

ajmcquilkin opened this issue Apr 11, 2023 · 1 comment · May be fixed by #72
Labels
help wanted Extra attention is needed
Milestone

Comments

@ajmcquilkin
Copy link

Just submitting this to see if there's any plans to support exporting types with duplicate names. I would love to use specta on a project with auto-generated Rust types with significant numbers of duplicate type names. I can imagine a somewhat direct mapping for duplicate type names existing between Rust modules and TypeScript namespaces, although I can't speak to mappings from Rust modules in other languages.

On a side note, in the event that an equivalent of Rust's module system doesn't exist in a given export language target, this could then throw a DuplicateTypeName error when a user attempts to export to this language.

Within the test_duplicate_ty_name test, I could imagine the following to be a valid TypeScript export from the Rust test modules provided:

namespace one {
    const One = { /* ... */ };
}

namespace two {
    const One = { /* ... */ };
}

const Demo = { one: one.One, two: two.One };

I don't have much context on what this would take technically to implement, but I'd be happy to investigate if this is something the project would be interested in.

@oscartbeaumont
Copy link
Owner

I would be willing to support this but I would prefer it if using it was a configuration similar to the current handling of bigints with the options Enabled, Error or something like that.

@Brendonovich has been pushing me towards inlining all of the types in rspc to avoid naming as a problem so having this configuration as an enum would make it possible for me to handle that when I come to implement it.

I don't see myself working on this any time soon but a PR would be welcome. Hit me up on Discord or here if you wanna chat more about specifics if you were going to do a PR.

@oscartbeaumont oscartbeaumont added the help wanted Extra attention is needed label Apr 24, 2023
@oscartbeaumont oscartbeaumont added this to the v2.0.0-rc.4 milestone Sep 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants