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

Strict unions cause potential name conflicts #171

Open
hayes opened this issue Aug 1, 2019 · 1 comment
Open

Strict unions cause potential name conflicts #171

hayes opened this issue Aug 1, 2019 · 1 comment

Comments

@hayes
Copy link
Contributor

hayes commented Aug 1, 2019

Strict unions create a lot of new exported type names. This can cause name conflicts when they are imported into the index file.

The specific case I am running into is that one of my schemas has both an Attribute and AttributeType where Attribute is a union, and has a create an AttributeType union type, which conflicts with the thrift AttributeType.

I don't think this can be solved in a non-breaking way, but for v4, it would be nice if types were generated in a way that is less likely to have name collisions.
My proposal for this would be to have the index use namespace imports instead eg import * as Foo from ./Foo. and then do export { Foo } . Then when using a namespace you would could import * as Namespace from './path/to/namespace and then Do Namespace.Foo.Args or Namespace.Foo.Strict

@Kingwl
Copy link

Kingwl commented Oct 21, 2019

Similar problem,
struct X and struct XArgs and struct XResult is conflicts and broken

another problem is a field named arguments, also a diagnosis here

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

No branches or pull requests

2 participants