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

ASF GitHub Bot commented on THRIFT-3143:
----------------------------------------

jeking3 commented on a change in pull request #1630: THRIFT-3143: Add nodets 
support
URL: https://github.com/apache/thrift/pull/1630#discussion_r235175049
 
 

 ##########
 File path: compiler/cpp/src/thrift/generate/t_js_generator.cc
 ##########
 @@ -302,11 +298,11 @@ class t_js_generator : public t_oop_generator {
   string ts_declare() { return (ts_module_.empty() ? "declare " : ""); }
 
   /**
-   * Returns "?" if the given field is optional.
+   * Returns "?" if the given field is optional or has a default value.
    * @param t_field The field to check
    * @return string
    */
-  string ts_get_req(t_field* field) { return (field->get_req() == 
t_field::T_OPTIONAL ? "?" : ""); }
+  string ts_get_req(t_field* field) {return (field->get_req() == 
t_field::T_OPTIONAL || field->get_value() != nullptr ? "?" : ""); }
 
 Review comment:
   This is still a C++03 compatible project and you have at least one C++11 
concept in one of the files.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> 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
>            Priority: Major
>
> 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
(v7.6.3#76005)

Reply via email to