Skip to content

Conversation

@sheetalkamat
Copy link
Member

Fixes #48039

@merceyz
Copy link

merceyz commented Apr 27, 2022

This should also close #41717 since #44554 was closed in favour of this one.

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>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is setting the prototype pretty typical in factory functions and whatnot @rbuckton?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We generally don't, but apparently we use Object.create in program.ts for redirected source files.

Copy link
Contributor

@rbuckton rbuckton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm concerned with the fact redirection uses Object.create to wrap an existing source file because its easily overlooked. However, since this is already an existing behavior this change seems fine.

@sheetalkamat sheetalkamat merged commit c8ec855 into main May 4, 2022
@sheetalkamat sheetalkamat deleted the redirectTs branch May 4, 2022 15:59
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: Team For Milestone Bug PRs that fix a bug with a specific milestone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot read property 'get' of undefined – file.pragmas.get("jsximportsource") in getJSXImplicitImportBase

6 participants