fix: setClassMetadata generates namespace-prefixed types for @Inject params with different type annotations#15
Merged
Brooooooklyn merged 1 commit intomainfrom Feb 9, 2026
Conversation
1beacd8 to
e4d81d4
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
…params with different type annotations When a constructor parameter uses `@Inject(TOKEN) param: SomeType`, the type annotation (SomeType) differs from the dep token (TOKEN). Previously only the token was checked for namespace prefixing, leaving the type annotation as a bare reference. Now the import map is consulted to generate `i1.SomeType` for imported types, while skipping type-only imports that have no runtime value. Also extends CrossFileAnalyzer to resolve monorepo package imports via tsconfig path aliases (skipping node_modules), and separates barrel resolution from type-only detection to avoid path mismatches with Angular's output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
e4d81d4 to
482f70e
Compare
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.
When a constructor parameter uses
@Inject(TOKEN) param: SomeType, the type annotation (SomeType) differs from the dep token (TOKEN). Previously only the token was checked for namespace prefixing, leaving the type annotation as a bare reference. Now the import map is consulted to generatei1.SomeTypefor imported types, while skipping type-only imports that have no runtime value.Also extends CrossFileAnalyzer to resolve monorepo package imports via tsconfig path aliases (skipping node_modules), and separates barrel resolution from type-only detection to avoid path mismatches with Angular's output.
Note
Medium Risk
Changes
setClassMetadata()ctor-parameter type emission and import handling; incorrect classification of type-only/value imports could change generated JS imports or metadata at runtime.Overview
Fixes
setClassMetadata()constructor-parameter metadata so that when@Inject(TOKEN)is used with a different type annotation, the type now resolves via the fileimport_mapand emits namespace-prefixed references (e.g.iN.Observable) instead of a bare identifier.Extends
ImportMapto trackimport type/inline type specifiers (and, withcross_file_elision, marks interface/type-alias imports as type-only via cross-file export analysis), avoiding namespace imports for erased type-only symbols and keeping namespace import paths aligned with Angular (prefer original import paths over barrel-resolved ones). Also threads an optionaltsconfigPaththrough the NAPI e2e runner to support path-alias resolution during cross-file analysis, and adds targeted tests for the new metadata/import behavior.Written by Cursor Bugbot for commit 482f70e. This will update automatically on new commits. Configure here.