Skip to content

Commit 13bd478

Browse files
Merge pull request #26569 from dsherret/issue26535_FixNullableDocumentRegistryTarget
Document Registry - Provide a default script target
2 parents 7288651 + 0baf746 commit 13bd478

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/services/documentRegistry.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ namespace ts {
184184

185185
const bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ true);
186186
let entry = bucket.get(path);
187-
const scriptTarget = scriptKind === ScriptKind.JSON ? ScriptTarget.JSON : compilationSettings.target;
187+
const scriptTarget = scriptKind === ScriptKind.JSON ? ScriptTarget.JSON : compilationSettings.target || ScriptTarget.ES5;
188188
if (!entry && externalCache) {
189189
const sourceFile = externalCache.getDocument(key, path);
190190
if (sourceFile) {
@@ -199,7 +199,7 @@ namespace ts {
199199

200200
if (!entry) {
201201
// Have never seen this file with these settings. Create a new source file for it.
202-
const sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget!, version, /*setNodeParents*/ false, scriptKind); // TODO: GH#18217
202+
const sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, /*setNodeParents*/ false, scriptKind);
203203
if (externalCache) {
204204
externalCache.setDocument(key, path, sourceFile);
205205
}

0 commit comments

Comments
 (0)