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/nodets/test/client.ts b/lib/nodets/test/client.ts
index a95567f..c2666bc 100644
--- a/lib/nodets/test/client.ts
+++ b/lib/nodets/test/client.ts
@@ -25,17 +25,18 @@
import ThriftTestDriver = test_driver.ThriftTestDriver;
import ThriftTestDriverPromise = test_driver.ThriftTestDriverPromise;
-// var program = require("commander");
-import * as program from "commander";
+import { program } from "commander";
program
- .option("--port <port>", "Set thrift server port number to connect", 9090)
+ .option("--port <port>", "Set thrift server port number to connect", Number.parseInt, 9090)
.option("--promise", "test with promise style functions")
.option("--protocol", "Set thrift protocol (binary) [protocol]")
.parse(process.argv);
-var port: number = program.port;
-var promise = program.promise;
+
+var opts = program.opts();
+var port: number = opts.port;
+var promise = opts.promise;
var options = {
transport: Thrift.TBufferedTransport,
diff --git a/lib/nodets/test/server.ts b/lib/nodets/test/server.ts
index 79457ce..5911384 100644
--- a/lib/nodets/test/server.ts
+++ b/lib/nodets/test/server.ts
@@ -1,15 +1,17 @@
import thrift = require("thrift");
-var program = require("commander");
-import ThriftTest = require("./gen-nodejs/ThriftTest");
-import test_handler = require("./test_handler");
+import { program } from 'commander';
+import ThriftTest = require('./gen-nodejs/ThriftTest');
+import test_handler = require('./test_handler');
+
program
- .option("--port <port>", "Set thrift server port", 9090)
- .option("--promise", "test with promise style functions")
- .option("--protocol", '"Set thrift protocol (binary) [protocol]"')
+ .option('--port <port>', 'Set thrift server port', Number.parseInt, 9090)
+ .option('--promise', 'test with promise style functions')
+ .option('--protocol', '"Set thrift protocol (binary) [protocol]"')
.parse(process.argv);
-var port: number = program.port;
+var opts = program.opts();
+var port: number = opts.port;
var options: thrift.ServerOptions = {
transport: thrift.TBufferedTransport,
@@ -17,12 +19,8 @@
};
var server: thrift.Server;
-if (program.promise) {
- server = thrift.createServer(
- ThriftTest.Processor,
- new test_handler.AsyncThriftTestHandler(),
- options,
- );
+if (opts.promise) {
+ server = thrift.createServer(ThriftTest.Processor, new test_handler.AsyncThriftTestHandler(), options);
} else {
server = thrift.createServer(
ThriftTest.Processor,