When source file is redirected, set the prototype correctly in node factory (#48862)

Fixes #48039
This commit is contained in:
Sheetal Nandi authored and GitHub committed 2022-05-04 08:59:11 -07:00
1 parent d879880a37
commit c8ec855f9f
4 files changed
+104 -1

No files matched your search

+1 -1
View File
@@ -5275,7 +5275,7 @@ namespace ts {
hasNoDefaultLib: boolean,
libReferences: readonly FileReference[]
) {
const node = baseFactory.createBaseSourceFileNode(SyntaxKind.SourceFile) as Mutable<SourceFile>;
const node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(SyntaxKind.SourceFile)) as Mutable<SourceFile>;
for (const p in source) {
if (p === "emitNode" || hasProperty(node, p) || !hasProperty(source, p)) continue;
(node as any)[p] = (source as any)[p];