From edfe8d65e9a340a7286a9d584677e271cfd7ff6e Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Thu, 1 Nov 2018 23:33:53 -0700 Subject: [PATCH] fix: improve types, remove dead code --- src/bundling.ts | 1 - src/grpc.ts | 8 ++------ src/index.ts | 1 + src/longrunning.ts | 3 --- src/operations_client.ts | 1 - system-test/system.ts | 7 ------- tsconfig.json | 3 +-- 7 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/bundling.ts b/src/bundling.ts index 3982f1688..73892b0a5 100644 --- a/src/bundling.ts +++ b/src/bundling.ts @@ -36,7 +36,6 @@ 'use strict'; import * as _ from 'lodash'; -import * as util from 'util'; import {NormalApiCaller, APICall, PromiseCanceller, APICallback} from './api_callable'; import {GoogleError} from './GoogleError'; import {CallSettings} from './gax'; diff --git a/src/grpc.ts b/src/grpc.ts index 19e382887..bbfac73bb 100644 --- a/src/grpc.ts +++ b/src/grpc.ts @@ -80,7 +80,7 @@ const COMMON_PROTO_FILES = export {GrpcObject} from 'grpc'; export interface GrpcClientOptions extends GoogleAuthOptions { - auth: GoogleAuth; + auth?: GoogleAuth; promise?: PromiseConstructor; grpc?: GrpcModule; } @@ -135,11 +135,7 @@ export class GrpcClient { * promises will be used. * @constructor */ - constructor(options: GrpcClientOptions) { - // if (!(this instanceof GrpcClient)) { - // return new GrpcClient(options); - // } - options = options || {}; + constructor(options: GrpcClientOptions = {}) { this.auth = options.auth || new GoogleAuth(options); this.promise = options.promise || Promise; if ('grpc' in options) { diff --git a/src/index.ts b/src/index.ts index 41885f56f..ee5bf7abd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -46,6 +46,7 @@ export {BundleDescriptor, BundleExecutor} from './bundling'; export {PathTemplate} from './path_template'; export {PageDescriptor} from './paged_iteration'; export {createApiCall} from './api_callable'; +export {GoogleError} from './GoogleError'; export {ClientStub, ClientStubOptions, GrpcClient, GrpcClientOptions, GrpcModule, GrpcObject, GoogleProtoFilesRoot, Metadata, MetadataValue} from './grpc'; function lro(options: GrpcClientOptions) { diff --git a/src/longrunning.ts b/src/longrunning.ts index 5734d6355..5dc40aad8 100644 --- a/src/longrunning.ts +++ b/src/longrunning.ts @@ -29,10 +29,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import * as events from 'events'; import {EventEmitter} from 'events'; -import * as util from 'util'; - import {APICall, APICallback, CancellablePromise, NormalApiCaller, PromiseCanceller} from './api_callable'; import {BackoffSettings, CallOptions, createBackoffSettings} from './gax'; import {GoogleError} from './GoogleError'; diff --git a/src/operations_client.ts b/src/operations_client.ts index a34bb1f2c..85e761197 100644 --- a/src/operations_client.ts +++ b/src/operations_client.ts @@ -27,7 +27,6 @@ /* jscs: disable maximumLineLength */ 'use strict'; -import * as path from 'path'; import * as extend from 'extend'; import * as apiCallable from './api_callable'; import * as gax from './gax'; diff --git a/system-test/system.ts b/system-test/system.ts index 3918b3f02..c44f0eab7 100644 --- a/system-test/system.ts +++ b/system-test/system.ts @@ -21,18 +21,11 @@ import * as rimraf from 'rimraf'; import * as util from 'util'; const mkdir = util.promisify(fs.mkdir); -const readFile = util.promisify(fs.readFile); -const writeFile = util.promisify(fs.writeFile); const rmrf = util.promisify(rimraf); const baseRepoUrl = 'https://github.com/googleapis/'; -const gaxPath = process.cwd(); const testDir = path.join(process.cwd(), 'system-test-run'); -interface PackageJson { - dependencies: {[name: string]: string;}; -} - interface ExecuteResult { stdout: string; stderr: string; diff --git a/tsconfig.json b/tsconfig.json index 07c70b201..1942ae08f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,8 +4,7 @@ "rootDir": ".", "outDir": "build", "noImplicitAny": false, - "noImplicitThis": false, - "target": "es5" + "noImplicitThis": false }, "include": [ "src/*.ts",