[ 
https://issues.apache.org/jira/browse/THRIFT-3143?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14624033#comment-14624033
 ] 

Kaspar Fenner commented on THRIFT-3143:
---------------------------------------

Current compiler doesn't support TypeScript code generation for Node.js:
{code}
    if (!gen_node_) {
      iter = parsed_options.find("ts");
      gen_ts_ = (iter != parsed_options.end());
    } else {
      gen_ts_ = false;
    }
{code}

I think, having separate generators for this is not a good thing, as it is 
basically still the same language, and if there is an issue, we'd have to fix 
it in two locations.

We already have a general issue here with the JS and Node.js libraries which 
have two different implementations. That means we need also two different 
TypeScript.d.ts definition files. I think that could get quite confusing, 
especially if you want to use NodeJS on the backend and the browser JS on the 
frontend, all in the same project.

My hope is that we can somehow bring these two JS use cases (frontend/backend) 
together and need only one implementation of the library and code generator.
Maybe browserify is really the way to go. But I don't know if it can solve all 
the issues.

What do you think, [~wilfrem] - you said that extending the JavaScript 
generator to generate TypeScript for Node.js could be quite complex? I thought, 
the differences should be minimal for the .d.ts files. I even thought that the 
Node.js / JS difference is only the module/namespace definition. Maybe we need 
to add options for CommonJS and AMD like the TypeScript compiler has. And what 
about the ES6 module format, do we need to support that too? I guess this needs 
some proper investigation.

> add typescript directory support
> --------------------------------
>
>                 Key: THRIFT-3143
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3143
>             Project: Thrift
>          Issue Type: New Feature
>          Components: Node.js - Compiler
>            Reporter: Kazuki Yasufuku
>
> Current typescript support is only work for browser, and generated d.ts uses 
> internal module.
> So, it's hard to use for typescript in node.js.
> To solve probrem, I make a pull request that generate typescript code 
> directory.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to