Skip to content

fix: setClassMetadata generates namespace-prefixed types for @Inject params with different type annotations#15

Merged
Brooooooklyn merged 1 commit intomainfrom
fix/missing-di-provider-namespace-imports
Feb 9, 2026
Merged

fix: setClassMetadata generates namespace-prefixed types for @Inject params with different type annotations#15
Brooooooklyn merged 1 commit intomainfrom
fix/missing-di-provider-namespace-imports

Conversation

@Brooooooklyn
Copy link
Copy Markdown
Member

@Brooooooklyn Brooooooklyn commented Feb 9, 2026

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.


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 file import_map and emits namespace-prefixed references (e.g. iN.Observable) instead of a bare identifier.

Extends ImportMap to track import type/inline type specifiers (and, with cross_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 optional tsconfigPath through 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.

@Brooooooklyn Brooooooklyn force-pushed the fix/missing-di-provider-namespace-imports branch from 1beacd8 to e4d81d4 Compare February 9, 2026 12:20
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

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>
@Brooooooklyn Brooooooklyn force-pushed the fix/missing-di-provider-namespace-imports branch from e4d81d4 to 482f70e Compare February 9, 2026 12:41
@Brooooooklyn Brooooooklyn merged commit 7cdb9a4 into main Feb 9, 2026
3 checks passed
@Brooooooklyn Brooooooklyn deleted the fix/missing-di-provider-namespace-imports branch February 9, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant