Skip to content

feat(compiler-cli): support partial evaluation and ReturnType in isolated declarations#68680

Draft
alxhub wants to merge 1 commit into
angular:mainfrom
alxhub:iso-decl
Draft

feat(compiler-cli): support partial evaluation and ReturnType in isolated declarations#68680
alxhub wants to merge 1 commit into
angular:mainfrom
alxhub:iso-decl

Conversation

@alxhub
Copy link
Copy Markdown
Member

@alxhub alxhub commented May 11, 2026

Note: only really relevant for g3

attempt to statically evaluate @NgModule imports and exports in isolated declarations mode. if resolution succeeds, emit the resolved values as concrete references. if resolution fails, fall back to purely syntactic transforms, such as transforming calls to ReturnType<typeof ...>.

also add validation to ensure expressions falling back to typeof are valid entity names, producing a LOCAL_COMPILATION_UNSUPPORTED_EXPRESSION diagnostic otherwise.

this allows emitting correct type references in .d.ts files without needing full resolution of external references, while supporting common patterns like forRoot() and local evaluation where possible.

TAG=agy
CONV=51a2b6d6-5679-49cf-8fa6-61fbc69628be

…ated declarations

attempt to statically evaluate @NgModule imports and exports in isolated declarations mode.
if resolution succeeds, emit the resolved values as concrete references.
if resolution fails, fall back to purely syntactic transforms, such as transforming calls to ReturnType<typeof ...>.

also add validation to ensure expressions falling back to typeof are valid entity names,
producing a LOCAL_COMPILATION_UNSUPPORTED_EXPRESSION diagnostic otherwise.

this allows emitting correct type references in .d.ts files without needing full resolution of external references, while supporting common patterns like forRoot() and local evaluation where possible.

TAG=agy
CONV=51a2b6d6-5679-49cf-8fa6-61fbc69628be
@angular-robot angular-robot Bot added detected: feature PR contains a feature commit area: compiler Issues related to `ngc`, Angular's template compiler labels May 11, 2026
@ngbot ngbot Bot added this to the Backlog milestone May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: compiler Issues related to `ngc`, Angular's template compiler detected: feature PR contains a feature commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant