Upgrade typescript
Client: nodejs
Patch: Cameron Martin
Typescript was on a really old version, and upgrading this is necessary for future changes. Upgrading this required upgrading `@types/node` and `commander`, since the old versions of these are not compatible with the newer version of typescript.
This closes #3084
diff --git a/lib/nodejs/test/client.js b/lib/nodejs/test/client.js
index 1d137ff..617039b 100644
--- a/lib/nodejs/test/client.js
+++ b/lib/nodejs/test/client.js
@@ -29,7 +29,7 @@
require("./test_driver").ThriftTestDriverPromise;
const SecondService = require(`./${helpers.genPath}/SecondService`);
-const program = require("commander");
+const { program } = require("commander");
program
.option(
@@ -49,7 +49,7 @@
.option("--ssl", "use SSL transport")
.option("--callback", "test with callback style functions")
.option(
- "-t, --type <type>",
+ "--type <type>",
"Select server type (http|multiplex|tcp|websocket)",
"tcp",
)
@@ -57,26 +57,27 @@
.option("--es5", "Use es5 code")
.parse(process.argv);
-const host = program.host;
-const port = program.port;
-const domainSocket = program.domainSocket;
-const ssl = program.ssl;
-let type = program.type;
+const opts = program.opts();
+const host = opts.host;
+const port = opts.port;
+const domainSocket = opts.domainSocket;
+const ssl = opts.ssl;
+let type = opts.type;
/* for compatibility with cross test invocation for http transport testing */
-if (program.transport === "http") {
- program.transport = "buffered";
+if (opts.transport === "http") {
+ opts.transport = "buffered";
type = "http";
}
-if (program.transport === "websocket") {
- program.transport = "buffered";
+if (opts.transport === "websocket") {
+ opts.transport = "buffered";
type = "websocket";
}
const options = {
- transport: helpers.transports[program.transport],
- protocol: helpers.protocols[program.protocol],
+ transport: helpers.transports[opts.transport],
+ protocol: helpers.protocols[opts.protocol],
};
if (type === "http" || type === "websocket") {
@@ -101,10 +102,8 @@
let connection;
let client;
-const testDriver = program.callback
- ? ThriftTestDriver
- : ThriftTestDriverPromise;
-if (helpers.ecmaMode === "es6" && program.callback) {
+const testDriver = opts.callback ? ThriftTestDriver : ThriftTestDriverPromise;
+if (helpers.ecmaMode === "es6" && opts.callback) {
console.log("ES6 does not support callback style");
process.exit(0);
}