Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Commit

Permalink
Update debug.ts to use class syntax (#295)
Browse files Browse the repository at this point in the history
PR-URL: #295
  • Loading branch information
DominicKramer committed Jun 29, 2017
1 parent 8d044a2 commit 8906108
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src.ts/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@
*/

import {AuthOptions, Common} from './types/common-types';
const common: Common = require('@google-cloud/common');
export const common: Common = require('@google-cloud/common');

import * as util from 'util';

export class Debug {
export class Debug extends common.Service {
options: AuthOptions;

/**
Expand All @@ -46,8 +44,8 @@ export class Debug {
* @param {object} options - [Configuration object](#/docs)
*/
constructor(options: AuthOptions) {
if (!(this instanceof Debug)) {
options = common.util.normalizeArguments(this, options);
if (new.target !== Debug) {
options = common.util.normalizeArguments(null, options);
return new Debug(options);
}

Expand All @@ -59,7 +57,9 @@ export class Debug {
};

// TODO: Update Service to provide types
common.Service.call(this, config, options);
// TODO: Determine if we should check if `options` is `undefined` or
// `null` here and, if so, provide a default value.
super(config, options);

// FIXME(ofrobots): We need our own copy of options because Service may
// default to '{{projectId}}' when options doesn't contain the `projectId`.
Expand All @@ -69,6 +69,3 @@ export class Debug {
this.options = options;
}
}
// TODO: Determine how to use class syntax directly so that this line is not
// needed.
util.inherits(Debug, common.Service);

0 comments on commit 8906108

Please sign in to comment.