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
I've encountered an issue where having two structs with the same name across multiple modules results in them overwriting each other during type exports. This led to some confusion on my part, and I found it necessary to rename several structs to address the problem.
I believe that structs should not share the same name, even if they are in different modules. Could we consider either implementing a solution that allows exporting types with unique names or introducing an error when such naming conflicts occur?
The text was updated successfully, but these errors were encountered:
The fact that duplicate named structs are overriding each other is definetly a bug, they should error on export so will keep this issue open for tracking a fix for that.
I personally think Specta should never mess with the naming of the structures because the types can be imported and used by Typescript code so the user should be in charge of some explicit mapping (the name) between the Rust and Typescript types.
Potential Solutions:
Just rename it. Having multiple identically named types can be confusing with LSP/code readability. Eg. struct MyNewName
Use #[specta(rename = "abc)] on the struct. This will change the Typescript name.
I've encountered an issue where having two structs with the same name across multiple modules results in them overwriting each other during type exports. This led to some confusion on my part, and I found it necessary to rename several structs to address the problem.
I believe that structs should not share the same name, even if they are in different modules. Could we consider either implementing a solution that allows exporting types with unique names or introducing an error when such naming conflicts occur?
The text was updated successfully, but these errors were encountered: