creditkarma / thrift-typescript

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

Allow * for language choice in namespace declarations #119

Open r4j4h opened 6 years ago

r4j4h commented 6 years ago
namespace * MyNamespace

is recommended in https://www.manning.com/books/programmers-guide-to-apache-thrift-cx (please ignore the cancelled message) and compiles fine using the namespace in all languages (that I've tried) using the Apache Thrift code generator.

With thrift-typescript I encounter:

    Parse Failure: 2 errors found:

    Scan Error:

    Message: Unexpected token: *

    4 | namespace * MyNamespace
                  ^

    Parse Error:

    Message: Unable to find name identifier for namespace

    4 | namespace * MyNamespace

I can bypass it by replacing * with js but then I am going to have to duplicate the namespace line for each language I want to support.

Is this an approach that thrift-typescript could support or is my current approach actually a bad idea in practice?

kevin-greene-ck commented 6 years ago

I think supporting the * character makes a lot of sense. We've obviously just included namespaces for all of our supported languages to this point. Don't think this would be a big change, but not sure either when we would have the time to get to it. Will add it to our list of features to support.

STih07 commented 5 years ago

Stiil doesn`t support it?