From 96b055218ce67aa947684050711835ed52b7b4fa Mon Sep 17 00:00:00 2001 From: ruanshudong Date: Thu, 20 Jun 2024 14:17:15 +0800 Subject: [PATCH] fix tarsnode create ts use import from assert, no require --- tools/tars2node/gen_proxy_ts.cpp | 2 +- tools/tars2node/gen_server_ts.cpp | 2 +- tools/tars2node/gen_ts.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/tars2node/gen_proxy_ts.cpp b/tools/tars2node/gen_proxy_ts.cpp index 79e2e47b..faee9edd 100644 --- a/tools/tars2node/gen_proxy_ts.cpp +++ b/tools/tars2node/gen_proxy_ts.cpp @@ -434,7 +434,7 @@ bool CodeGenerator::generateTSProxy(const ContextPtr &cPtr) sstr << "/// " << endl; if (bNeedAssert) { - sstr << TAB << "import assert = require(\"assert\");" << endl; + sstr << TAB << "import assert from \"assert\";" << endl; } if (bNeedStream) { diff --git a/tools/tars2node/gen_server_ts.cpp b/tools/tars2node/gen_server_ts.cpp index f0317a84..8681ea0b 100644 --- a/tools/tars2node/gen_server_ts.cpp +++ b/tools/tars2node/gen_server_ts.cpp @@ -464,7 +464,7 @@ bool CodeGenerator::generateTSServer(const ContextPtr &pPtr) str << "/// " << endl; if (bNeedAssert) { - str << TAB << "import assert = require(\"assert\");" << endl; + str << TAB << "import assert from \"assert\";" << endl; } if (bNeedStream) { diff --git a/tools/tars2node/gen_ts.cpp b/tools/tars2node/gen_ts.cpp index ac54f985..a2669e6b 100644 --- a/tools/tars2node/gen_ts.cpp +++ b/tools/tars2node/gen_ts.cpp @@ -407,7 +407,7 @@ void CodeGenerator::generateTS(const ContextPtr &pPtr) ostringstream ostr; if (bNeedAssert) { - ostr << "import assert = require(\"assert\");" << endl; + ostr << "import assert from \"assert\";" << endl; } if (bNeedStream) {