diff --git a/extensions/typescript/src/typescriptServiceClient.ts b/extensions/typescript/src/typescriptServiceClient.ts index a6e4771c2fb..c502d4f8bc0 100644 --- a/extensions/typescript/src/typescriptServiceClient.ts +++ b/extensions/typescript/src/typescriptServiceClient.ts @@ -116,11 +116,7 @@ class RequestQueue { } } -export interface IClientVersion { - readonly clientVersion: string; -} - -export default class TypeScriptServiceClient implements ITypescriptServiceClient, IClientVersion { +export default class TypeScriptServiceClient implements ITypescriptServiceClient { private static readonly WALK_THROUGH_SNIPPET_SCHEME = 'walkThroughSnippet'; private static readonly WALK_THROUGH_SNIPPET_SCHEME_COLON = `${TypeScriptServiceClient.WALK_THROUGH_SNIPPET_SCHEME}:`; @@ -210,7 +206,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient } } }, this, this.disposables); - this.telemetryReporter = new TelemetryReporter(this); + this.telemetryReporter = new TelemetryReporter(() => this._tsserverVersion || this._apiVersion.versionString); this.disposables.push(this.telemetryReporter); this.startService(); } @@ -280,10 +276,6 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient return this._apiVersion; } - public get clientVersion(): string { - return this._tsserverVersion || this._apiVersion.versionString; - } - public onReady(): Promise { return this._onReady.promise; } diff --git a/extensions/typescript/src/utils/telemetry.ts b/extensions/typescript/src/utils/telemetry.ts index 407f385f7b4..b0cba1133a5 100644 --- a/extensions/typescript/src/utils/telemetry.ts +++ b/extensions/typescript/src/utils/telemetry.ts @@ -5,7 +5,6 @@ import * as path from 'path'; import VsCodeTelemetryReporter from 'vscode-extension-telemetry'; -import { IClientVersion } from '../typescriptServiceClient'; interface IPackageInfo { name: string; @@ -24,15 +23,16 @@ export default class TelemetryReporter { } } - constructor(private client: IClientVersion) { - } + constructor( + private readonly clientVersionDelegate: () => string + ) { } public logTelemetry(eventName: string, properties?: { [prop: string]: string }) { if (this.reporter) { if (!properties) { properties = {}; } - properties['version'] = this.client.clientVersion; + properties['version'] = this.clientVersionDelegate(); this.reporter.sendTelemetryEvent(eventName, properties); }