Skip to content

Make generated code compile#67568

Merged
mattrbeck merged 4 commits intoangular:mainfrom
crisbeto:instruction-types
Mar 13, 2026
Merged

Make generated code compile#67568
mattrbeck merged 4 commits intoangular:mainfrom
crisbeto:instruction-types

Conversation

@crisbeto
Copy link
Member

@crisbeto crisbeto commented Mar 11, 2026

This PR includes an initial set of changes to make sure that the code we generate in the template pipeline will compile when passed through TypeScript. This ended up being slightly more involved, because the code that translates the output AST to TypeScript was dropping all types.

Note that I added a few tests manually, but the ideal end state is to run the compilation checks against all of the current compliance tests.

Updates the type factories and various usage sites to add a generic for type nodes.
Updates the translator and AST factories to account for type nodes.
Updates the Babel and TypeScript AST factories to account to produce type nodes.
@crisbeto crisbeto added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Mar 11, 2026
@angular-robot angular-robot bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Mar 11, 2026
@ngbot ngbot bot added this to the Backlog milestone Mar 11, 2026
@crisbeto crisbeto force-pushed the instruction-types branch 5 times, most recently from b0adfc4 to 3cb9755 Compare March 11, 2026 15:47
@crisbeto crisbeto requested a review from atscott March 11, 2026 16:44
@crisbeto crisbeto marked this pull request as ready for review March 11, 2026 16:44
Initial pass to make sure some common cases produce code that compiles.
@crisbeto crisbeto force-pushed the instruction-types branch from 3cb9755 to 403ea80 Compare March 11, 2026 21:10
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Mar 11, 2026
@crisbeto
Copy link
Member Author

Caretaker note: the presubmit failures are unrelated.

@crisbeto crisbeto removed the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Mar 12, 2026
| 'string'
| 'function'
| 'never'
| 'unknown';
Copy link
Member

Choose a reason for hiding this comment

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

You're definitely more familiar than me so I trust your judgement, but do we also want null, symbol, and bigint here (and other places)? Are they just not necessary because we don't emit them?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah these are the only ones we generate through the output AST at the moment. I also want eventually to clean it up a bit, because some existing ones like function aren't used right now either.

@mattrbeck mattrbeck merged commit 412788f into angular:main Mar 13, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants