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

Commit 8906108

Browse files
Update debug.ts to use class syntax (#295)
PR-URL: #295
1 parent 8d044a2 commit 8906108

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src.ts/debug.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@
1515
*/
1616

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

20-
import * as util from 'util';
21-
22-
export class Debug {
20+
export class Debug extends common.Service {
2321
options: AuthOptions;
2422

2523
/**
@@ -46,8 +44,8 @@ export class Debug {
4644
* @param {object} options - [Configuration object](#/docs)
4745
*/
4846
constructor(options: AuthOptions) {
49-
if (!(this instanceof Debug)) {
50-
options = common.util.normalizeArguments(this, options);
47+
if (new.target !== Debug) {
48+
options = common.util.normalizeArguments(null, options);
5149
return new Debug(options);
5250
}
5351

@@ -59,7 +57,9 @@ export class Debug {
5957
};
6058

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

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

0 commit comments

Comments
 (0)