Repository navigation
fix: don't treat destructured parameter names as dependencies - #325
Merged
Merged
Conversation
commit: |
sxzz
approved these changes
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI usage
Description
collectDependenciesadds thevalueof everyPropertynode as a dependency, including properties of anObjectPattern. In a destructured parameter, that value is a binding, not a reference:This bundles to
declare const value$1: stringandexport { value$1 as value }, because thevalueinmod.d.tsis treated as a global reference. When the parameter's name matches a declaration in the same module, that declaration is never tree-shaken, even if nothing uses it.This PR skips
valuewhen the parent is anObjectPattern. Computed keys are still collected.Linked Issues
Additional context
For this reason, posthog-js 1.438.13 publishes
declare const posthog$1: PostHogandposthog$1 as default(dist/module.d.ts), so editors auto-import its default export asposthog$1. The source declaresexport const posthog. Other modules destructure a parameter with the same name, e.g.useHideSurveyOnURLChange({ …, posthog }).