Skip to content

Commit b0321dc

Browse files
Refactor to avoid errors
1 parent ee5e8e3 commit b0321dc

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/server/typingsInstaller/typingsInstaller.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace ts.server.typingsInstaller {
5555
try {
5656
if (fileExists) {
5757
const content = <TypeDeclarationTimestampFile>JSON.parse(host.readFile(typeDeclarationTimestampFilePath));
58-
return content.entries;
58+
return content.entries || {};
5959
}
6060
else {
6161
host.writeFile(typeDeclarationTimestampFilePath, "{}");
@@ -247,10 +247,11 @@ namespace ts.server.typingsInstaller {
247247
continue;
248248
}
249249
const existingTypingFile = this.packageNameToTypingLocation.get(packageName);
250-
if (existingTypingFile.typingLocation === typingFile) {
251-
continue;
252-
}
253250
if (existingTypingFile) {
251+
if (existingTypingFile.typingLocation === typingFile) {
252+
continue;
253+
}
254+
254255
if (this.log.isEnabled()) {
255256
this.log.writeLine(`New typing for package ${packageName} from '${typingFile}' conflicts with existing typing file '${existingTypingFile}'`);
256257
}

0 commit comments

Comments
 (0)