You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2021/05/20 20:41:57 UTC

[thrift] branch master updated: THRIFT-3508 Map optional fields from thrift idl to optional fields in TypeScript. Client: node,js Patch: Axel Jäger

This is an automated email from the ASF dual-hosted git repository.

jensg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new 346c72c  THRIFT-3508 Map optional fields from thrift idl to optional fields in TypeScript. Client: node,js Patch: Axel Jäger
346c72c is described below

commit 346c72c0d05b83489b4bec10bb4920c9c9ae8bc3
Author: Axel Jäger <ax...@arculus.de>
AuthorDate: Thu May 6 12:07:40 2021 +0200

    THRIFT-3508 Map optional fields from thrift idl to optional fields in TypeScript.
    Client: node,js
    Patch: Axel Jäger
    
    This closes #2386
---
 compiler/cpp/src/thrift/generate/t_js_generator.cc | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/compiler/cpp/src/thrift/generate/t_js_generator.cc b/compiler/cpp/src/thrift/generate/t_js_generator.cc
index fddcef4..48d7250 100644
--- a/compiler/cpp/src/thrift/generate/t_js_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_js_generator.cc
@@ -909,13 +909,9 @@ void t_js_generator::generate_js_struct_definition(ostream& out,
       out << indent() << dval << ";" << endl;
     }
     if (gen_ts_) {
-      if (gen_node_) {
-        f_types_ts_ << ts_indent() << "public " << (*m_iter)->get_name() << ": "
-                    << ts_get_type((*m_iter)->get_type()) << ";" << endl;
-      } else {
-        f_types_ts_ << ts_indent() << (*m_iter)->get_name() << ": "
-                    << ts_get_type((*m_iter)->get_type()) << ";" << endl;
-      }
+      string ts_access = gen_node_ ? "public " : "";
+      f_types_ts_ << ts_indent() << ts_access << (*m_iter)->get_name() << ts_get_req(*m_iter) << ": "
+                  << ts_get_type((*m_iter)->get_type()) << ";" << endl;
     }
   }