1515 */
1616
1717import { 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