thrift-typescript
thrift-typescript copied to clipboard
Strict unions cause potential name conflicts
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
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