fix: import elision for inline type specifiers, declare property decorators, and computed keys#10
Merged
Brooooooklyn merged 4 commits intomainfrom Feb 5, 2026
Conversation
…rators, and computed keys
Three import specifier mismatches fixed:
1. Inline `type` specifiers (`import { type FormGroup }`) now tracked and elided
2. `declare` property decorator args (`@ViewChild(X) declare y`) now elided
3. Computed property keys in type annotations (`[fromEmail]: T`) now preserved
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ction
The computed property key collector only checked the top-level members of
a TSTypeLiteral but did not recurse into property type annotations. This
meant nested patterns like `{ nested: { [fromEmail]: string } }` would
miss inner computed keys, incorrectly eliding those imports.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
… types The computed property key collector only handled TSTypeLiteral, TSUnionType, and TSIntersectionType. Added support for TSArrayType, TSTupleType, TSTypeReference (generics), and TSParenthesizedType so computed keys like `[myKey]` inside these type structures are correctly preserved. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
Adds explicit assertion that the decorator name itself (not just its arguments) is correctly elided when only used on declare properties. TypeScript does not emit declare properties, so the decorator has no runtime effect. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.
Three import specifier mismatches fixed:
typespecifiers (import { type FormGroup }) now tracked and elideddeclareproperty decorator args (@ViewChild(X) declare y) now elided[fromEmail]: T) now preservedNote
Medium Risk
Medium risk: changes elision rules that directly affect emitted JS/TS imports, so mistakes could drop needed runtime imports or keep extra ones in Angular transforms.
Overview
Improves import elision accuracy in
ImportElisionAnalyzerto match TypeScript/Angular behavior for several previously misclassified patterns.Inline
import { type X }specifiers are now always treated as elidable even when mixed with value imports,declareproperty decorators (and their arguments) are treated as compiler-only uses eligible for elision, and a new post-pass preserves imports referenced via computed property keys inside type annotations (e.g.{ [fromEmail]: string }).Adds regression tests covering these scenarios, including nested/union/array/tuple/parenthesized type shapes for computed keys.
Written by Cursor Bugbot for commit 3fc59c6. This will update automatically on new commits. Configure here.