Don't crash when a JS file appears in an inferred context

This commit is contained in:
Ryan Cavanaugh
2017-08-29 13:29:56 -07:00
parent 78524c1b90
commit 0e2d399c49
3 changed files with 35 additions and 15 deletions

View File

@@ -1648,7 +1648,7 @@ namespace ts.server {
if (openFiles) {
for (const file of openFiles) {
const scriptInfo = this.getScriptInfo(file.fileName);
Debug.assert(!scriptInfo || !scriptInfo.isScriptOpen());
Debug.assert(!scriptInfo || !scriptInfo.isScriptOpen(), "Script should not exist and not be open already");
const normalizedPath = scriptInfo ? scriptInfo.fileName : toNormalizedPath(file.fileName);
this.openClientFileWithNormalizedPath(normalizedPath, file.content, tryConvertScriptKindName(file.scriptKind), file.hasMixedContent);
}