Skip to content

Fix isSameEntityName - #38999

Merged
Andrew Branch (andrewbranch) merged 3 commits into
microsoft:masterfrom
andrewbranch:bug/38412
Jun 10, 2020
Merged

Fix isSameEntityName#38999
Andrew Branch (andrewbranch) merged 3 commits into
microsoft:masterfrom
andrewbranch:bug/38412

Conversation

@andrewbranch

Copy link
Copy Markdown
Member

Fixes#38412

I misrefactored this utility function 8 months ago, resulting in the JS

exportconstmoment=rollupMoment__default||moment;

being interpreted more like

exportconstmoment=moment||anything;

when trying to decide if rollupMoment__default is ever referenced. In JS, we don’t count these kinds of conditional assignment as a usage, so it appeared that rollupMoment__default was never used at all, causing the import to be elided.

@andrewbranch

Copy link
Copy Markdown
MemberAuthor

A tangential point is that the logic I meant probably doesn’t make sense for export variable statements anyway 🤷‍♂️

@andrewbranch

Copy link
Copy Markdown
MemberAuthor

The failing test is failing on master.

@andrewbranch
Andrew Branch (andrewbranch) merged commit 0d6ae00 into microsoft:masterJun 10, 2020
AllenLee (cangSDARM) added a commit to cangSDARM/TypeScript that referenced this pull request Jun 15, 2020
* upstream/master: (22 commits)
Small fix in `getIsContextSensitiveAssignmentOrContextType`
Simplify `visitObjectLiteralExpression`
Fix handling of `aruments` in the emitter
Fix declaration emit for property references of imported object literal types (microsoft#39055)
Fix casing for wild card keys for implicit globs to get wild card directories to watch (microsoft#39049)
DOM update 2020-06-12
fix(a11y): make ISSUE_TEMPLATE/Bug_report.md more accessible for folks with screen readers (microsoft#39013)
Update request-pr-review script to latest version of octokit (microsoft#39031)
pin version of octokit
skip implements types with no symbols
isDynamicName skips parentheses for element access
Allow `e: unknown` in `catch` arguments
Serialize (noncontextual) keyword named namespace members with export declarations in both declaration emitters (microsoft#38982)
Patch to use this.timeout() > 0 rather than this.enableTimeout() to work with mocha 8+
Handle missing return type nodes and nested type references missing type arguments in existing jsdoc node serialization (microsoft#39011)
Add containerName to CallHierarchyItem (microsoft#38997)
Fix isSameEntityName (microsoft#38999)
Fix typo for 'blocklist' (microsoft#39001)
remove errant tab
Switch to isSymbolAccessible for both.
...
@microsoftMicrosoft (microsoft) locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

importsNotUsedAsValues in JS files elides imports incorrectly

4 participants

@andrewbranch@sandersn@sheetalkamat@typescript-bot