Skip to content

Commit 18db87c

Browse files
committed
added extra check to prevent multiple installation of the same typing, added version field to telemetry event (#12258)
* added extra check to prevent multiple installation of the same typing, added version field to telemetry event * use ts.version
1 parent b350b1c commit 18db87c

File tree

6 files changed

+14
-7
lines changed

6 files changed

+14
-7
lines changed

src/compiler/core.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
/* @internal */
55
namespace ts {
6+
7+
export const version = "2.0.9";
8+
69
/**
710
* Ternary values are defined such that
811
* x & y is False if either x or y is False.

src/compiler/program.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
/// <reference path="core.ts" />
44

55
namespace ts {
6-
/** The version of the TypeScript compiler release */
7-
8-
export const version = "2.2.0";
9-
106
const emptyArray: any[] = [];
117

128
export function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName = "tsconfig.json"): string {

src/server/protocol.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2106,6 +2106,11 @@ namespace ts.server.protocol {
21062106
* true if install request succeeded, otherwise - false
21072107
*/
21082108
installSuccess: boolean;
2109+
2110+
/**
2111+
* version of typings installer
2112+
*/
2113+
typingsInstallerVersion: string;
21092114
}
21102115

21112116
export interface NavBarResponse extends Response {

src/server/server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,8 @@ namespace ts.server {
300300
telemetryEventName: "typingsInstalled",
301301
payload: {
302302
installedPackages: response.packagesToInstall.join(","),
303-
installSuccess: response.installSuccess
303+
installSuccess: response.installSuccess,
304+
typingsInstallerVersion: response.typingsInstallerVersion
304305
}
305306
};
306307
const eventName: protocol.TelemetryEventName = "telemetry";

src/server/types.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ declare namespace ts.server {
6969
readonly packagesToInstall: ReadonlyArray<string>;
7070
readonly kind: EventInstall;
7171
readonly installSuccess: boolean;
72+
readonly typingsInstallerVersion: string;
7273
}
7374

7475
export interface InstallTypingHost extends JsTyping.TypingResolutionHost {

src/server/typingsInstaller/typingsInstaller.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ namespace ts.server.typingsInstaller {
233233
}
234234
const result: string[] = [];
235235
for (const typing of typingsToInstall) {
236-
if (this.missingTypingsSet[typing]) {
236+
if (this.missingTypingsSet[typing] || this.packageNameToTypingLocation[typing]) {
237237
continue;
238238
}
239239
const validationResult = validatePackageName(typing);
@@ -314,7 +314,8 @@ namespace ts.server.typingsInstaller {
314314
this.sendResponse(<TypingsInstallEvent>{
315315
kind: EventInstall,
316316
packagesToInstall: scopedTypings,
317-
installSuccess: ok
317+
installSuccess: ok,
318+
typingsInstallerVersion: ts.version // qualified explicitly to prevent occasional shadowing
318319
});
319320
}
320321

0 commit comments

Comments
 (0)