creditkarma / thrift-typescript

Generate TypeScript from Thrift IDL files
Apache License 2.0
155 stars 32 forks source link

Generated output doesn't handle service inheritance #135

Closed incrediblesound closed 5 years ago

incrediblesound commented 5 years ago

Hello, I've been trying to get this package to work and there's one problem I can't seem to get around.

I have a service with some generic methods defined on it, and another service, let's call it my_app.thrift which inherits from this base class.

The generate function puts all output into the same file, and it appears that both the abstract service and the "my_app" service are rendered in that file with the same name (export class Processor) resulting in the error message: Class 'Processor' used before its declaration.

If you have any insight into this problem I'd really appreciate it, and I can provide additional details if needed.

kevin-greene-ck commented 5 years ago

Hmm, not quite following. Yes, they would both export a Processor class, but they should be namespaced even in the same file. For example, here is the unit test for the case of service extends service: https://github.com/creditkarma/thrift-typescript/blob/master/src/tests/unit/index.spec.ts#L298. In this case there should be two namespaces generated ParentService and ChildService and each would export a Processor. Can you give a more complete thrift example I can test?

kevin-greene-ck commented 5 years ago

Closing as this is old. Reopen if you have more details.