Skip to content

fix(angular-compiler): improve handling of type elision for imports/exports#2257

Merged
brandonroberts merged 4 commits into
betafrom
feat/type-elision-exports
Apr 7, 2026
Merged

fix(angular-compiler): improve handling of type elision for imports/exports#2257
brandonroberts merged 4 commits into
betafrom
feat/type-elision-exports

Conversation

@brandonroberts

Copy link
Copy Markdown
Member

PR Checklist

Affected scope

  • Primary scope: angular-compiler
  • Secondary scopes: vite-plugin-angular

Recommended merge strategy for maintainer [optional]

  • Squash merge
  • Rebase merge
  • Other

What is the new behavior?

Fix type-elision incorrectly treating export type { Foo } and export { type Foo } as value references, which prevented the corresponding imports from being elided.

Test plan

  • npx vitest run packages/angular-compiler/src/lib/type-elision.spec.ts — 40 tests passing (9 new)
  • npx vitest run packages/angular-compiler/src/lib/integration.spec.ts — 76 tests passing
  • pnpm build
  • pnpm test

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

brandonroberts and others added 2 commits April 7, 2026 07:33
Imports referenced only in `export type { Foo }` or `export { type Foo }`
were incorrectly treated as value references, preventing elision. The
walker now skips type-only export specifiers while still walking value
re-exports and export declarations normally.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@netlify

netlify Bot commented Apr 7, 2026

Copy link
Copy Markdown

Deploy Preview for analog-docs ready!

Name Link
🔨 Latest commit ce196ec
🔍 Latest deploy log https://app.netlify.com/projects/analog-docs/deploys/69d4ff910f474d0008b21461
😎 Deploy Preview https://deploy-preview-2257--analog-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Apr 7, 2026

Copy link
Copy Markdown

Deploy Preview for analog-app ready!

Name Link
🔨 Latest commit ce196ec
🔍 Latest deploy log https://app.netlify.com/projects/analog-app/deploys/69d4ff918555b0000804bbb4
😎 Deploy Preview https://deploy-preview-2257--analog-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Apr 7, 2026

Copy link
Copy Markdown

Deploy Preview for analog-blog ready!

Name Link
🔨 Latest commit ce196ec
🔍 Latest deploy log https://app.netlify.com/projects/analog-blog/deploys/69d4ff91f0c97e0008cfbed6
😎 Deploy Preview https://deploy-preview-2257--analog-blog.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the scope:angular-compiler Changes in @analogjs/angular-compiler label Apr 7, 2026
@coderabbitai

coderabbitai Bot commented Apr 7, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The changes expand type-elision testing and implementation to handle TypeScript export-context usages. Documentation in COMPILER.md was updated to reflect increased test coverage (from 31 to 45 tests). The Vitest suite (type-elision.spec.ts) was extended with many cases covering export type { ... }, export { type ... }, mixed specifiers, typeof in type positions, enum/class/value interactions, and preservation of value re-exports. The implementation (type-elision.ts) updates analyzeTypeOnlyImports to skip walking identifier specifiers marked with exportKind === 'type', preventing those specifiers from counting as value references.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly relates to the changeset, explaining the fix for type-elision logic, affected scopes, test results, and breaking change status.
Title check ✅ Passed The title uses Conventional Commit format with 'fix' type and 'angular-compiler' scope, which is a supported package scope. It clearly summarizes the main change: improving type elision handling for imports/exports.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@brandonroberts brandonroberts changed the title Feat/type elision exports fix(angular-compiler): add correct handling type exports Apr 7, 2026
brandonroberts and others added 2 commits April 7, 2026 07:56
…sitions

Verify typeof in type positions, enum dual usage, class extends,
instanceof, and extends+implements are handled correctly by the
type-only import detection.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@brandonroberts brandonroberts changed the title fix(angular-compiler): add correct handling type exports fix(angular-compiler): improve handling of type elision for imports/exports Apr 7, 2026
@brandonroberts brandonroberts merged commit 1605a7b into beta Apr 7, 2026
28 checks passed
@brandonroberts brandonroberts deleted the feat/type-elision-exports branch April 7, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope:angular-compiler Changes in @analogjs/angular-compiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant