Skip to content

Conversation

@Andarist
Copy link
Contributor

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Oct 21, 2024
@typescript-bot
Copy link
Collaborator

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

cache.add(
importingFile.path,
moduleSymbol,
moduleSymbol.escapedName,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suspect this might be somewhat questionable solution here, I'm not fully sold on it myself either. cc @andrewbranch - you might have some opinions here (or suggestions for an improved fix? :P)

Comment on lines +24 to +25
`import * as A from "./a";
import * as A from "./c";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As we can see here, those refactorings introduce issues into target files. This is not a new problem from what I can tell. This refactoring just never tried to rename inserted symbols to avoid name clashes etc.

At first, I thought those would be test cases that should be covered by this PR so I added them. I could just remove them now but I think they still have some value here, especially if this naming conflict is ever meant to be addressed in the future.

@iisaduan
Copy link
Member

I actually have a fix for this that I'm finishing the PR for right now. I'll bring your tests over since you've got some extra cases I don't have.

This PR seems to be similar to #59004 with what you brought up here https://github.com/microsoft/TypeScript/pull/60302/files#r1809202658, and so module symbols should be treated differently. There's other similar crashes that aren't * as namespace imports, and this doesn't address those.


function addImportFromExportedSymbol(exportedSymbol: Symbol, isValidTypeOnlyUseSite?: boolean, referenceImport?: ImportOrRequireAliasDeclaration) {
const moduleSymbol = Debug.checkDefined(exportedSymbol.parent);
const moduleSymbol = Debug.checkDefined(isExternalModuleSymbol(exportedSymbol) ? exportedSymbol : exportedSymbol.parent);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the crash is happening here today because the external module symbol doesn't have a .parent

@Andarist Andarist closed this Oct 21, 2024
@Andarist
Copy link
Contributor Author

Andarist commented Oct 21, 2024

@iisaduan cool, I missed the other PR - so I'll just close this one

@Andarist Andarist deleted the fix/move-to-file-namespace-import branch October 21, 2024 17:25
@Ashishsonavane
Copy link

Ashishsonavane commented Oct 21, 2024 via email

@sandersn sandersn removed this from PR Backlog Apr 22, 2025
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants