Skip to content

Commit f24652c

Browse files
author
Benjamin Lichtman
committed
Always get latest tag of types-registry
1 parent 0b36208 commit f24652c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/server/typingsInstaller/nodeTypingsInstaller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ namespace ts.server.typingsInstaller {
106106
if (this.log.isEnabled()) {
107107
this.log.writeLine(`Updating ${typesRegistryPackageName} npm package...`);
108108
}
109-
this.execSyncAndLog(`${this.npmPath} install --ignore-scripts ${typesRegistryPackageName}`, { cwd: globalTypingsCacheLocation });
109+
this.execSyncAndLog(`${this.npmPath} install --ignore-scripts ${typesRegistryPackageName}@${this.latestDistTag}`, { cwd: globalTypingsCacheLocation });
110110
if (this.log.isEnabled()) {
111111
this.log.writeLine(`Updated ${typesRegistryPackageName} npm package`);
112112
}

src/server/typingsInstaller/typingsInstaller.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,8 @@ namespace ts.server.typingsInstaller {
349349
}
350350

351351
// packageName is guaranteed to exist in typesRegistry by filterTypings
352-
const distTags = this.typesRegistry.get(packageName);
353-
const newVersion = Semver.parse(distTags[`ts${versionMajorMinor}`] || distTags[latestDistTag]);
352+
const distTags = this.typesRegistry.get(packageName)!;
353+
const newVersion = Semver.parse(distTags[`ts${versionMajorMinor}`] || distTags[this.latestDistTag]);
354354
const newTyping: JsTyping.CachedTyping = { typingLocation: typingFile, version: newVersion };
355355
this.packageNameToTypingLocation.set(packageName, newTyping);
356356
installedTypingFiles.push(typingFile);
@@ -523,12 +523,12 @@ namespace ts.server.typingsInstaller {
523523

524524
protected abstract installWorker(requestId: number, packageNames: string[], cwd: string, onRequestCompleted: RequestCompletedAction): void;
525525
protected abstract sendResponse(response: SetTypings | InvalidateCachedTypings | BeginInstallTypes | EndInstallTypes): void;
526+
527+
protected latestDistTag = "latest";
526528
}
527529

528530
/* @internal */
529531
export function typingsName(packageName: string): string {
530532
return `@types/${packageName}@ts${versionMajorMinor}`;
531533
}
532-
533-
const latestDistTag = "latest";
534534
}

0 commit comments

Comments
 (0)