ts-rs
ts-rs copied to clipboard
How to handle naming conflicts
Currently, having multiple types with the same name is problematic.
Firstly, with just #[ts(export)], they will just overwrite eachother. This can be worked around with #[ts(export_to = "..")].
Then, when a third type depends on two types with the same name, the generated imports for the third type will be invalid. This can be worked around with #[ts(rename = "..")].
How can we improve on this? Resolving these conflicts would require coordination between different invocations of derive(TS).
I don't like to reintroduce something like export! to which you pass each type you wish to export, since this gets really painfull when working with a deep module tree, requiring you to make everything public.
yeah I've just stumbled upon this problem in my project, would be nice if you could have "export_to_dir=..." parameter so that you can namespace your conflicting names
(my code is autogenerated by diesel so I cannot really specify full paths)
Yeah, I'm also stumbling on this. For my use case it would be sufficient if the module an exported type was located in was taken into account (e.g., each mod became its own directory). Granted, not sure how possible/straightforward that would be