Start decoupling TCB generation from TypeScript factory APIs#67381
Merged
thePunderWoman merged 5 commits intoangular:mainfrom Mar 3, 2026
Merged
Start decoupling TCB generation from TypeScript factory APIs#67381thePunderWoman merged 5 commits intoangular:mainfrom
thePunderWoman merged 5 commits intoangular:mainfrom
Conversation
Introduces the `TcbExpr` class that will be used to generate TCB code without going through TypeScript's factory APIs.
Initial pass to move usages of TS `factory` APIs to the new `TcbExpr`.
Deletes utilities that we no longer use.
crisbeto
commented
Mar 2, 2026
| * | ||
| * @deprecated This is a temporary method until all code generation code has been migrated. | ||
| */ | ||
| export function tempPrint(node: ts.Node, sourceFile: ts.SourceFile): string { |
Member
Author
There was a problem hiding this comment.
I'm using this function in the cases where we convert some arbitrary nodes to strings. In follow-up changes I'll try to get rid of all call sites.
TypeScript has functionality that automatically escapes quotes in string literals. These changes update the places where we may need to do the same ourselves.
1f44053 to
fa9fd4c
Compare
crisbeto
commented
Mar 2, 2026
| expect(result).toContain(`if ((((this).expr)) === (0)) { (this).zero(); }`); | ||
| expect(result).toContain( | ||
| `if (!((((this).expr)) === (0)) && (((this).expr)) === (1)) { (this).one(); }`, | ||
| `if ((!((((this).expr)) === (0))) && ((((this).expr)) === (1))) { (this).one(); }`, |
Member
Author
There was a problem hiding this comment.
The context for the additional parens is that TS is a bit smarter about only inserting them when necessary whereas we do it for all instances.
Resolves issues caught during the presubmit.
Member
Author
atscott
approved these changes
Mar 3, 2026
crisbeto
added a commit
to crisbeto/angular
that referenced
this pull request
Mar 4, 2026
This is a follow-up to angular#67381 which introduced a subtle bug where depending on the type checking configuration, we may put an object literal directly in the TCB body which the TS compiler ends up interpreting as a block. These changes resolve the issue by always wrapping the literal in parentheses.
crisbeto
added a commit
to crisbeto/angular
that referenced
this pull request
Mar 4, 2026
This is a follow-up to angular#67381 which introduced a subtle bug where depending on the type checking configuration, we may put an object literal directly in the TCB body which the TS compiler ends up interpreting as a block. These changes resolve the issue by always wrapping the literal in parentheses.
thePunderWoman
pushed a commit
that referenced
this pull request
Mar 4, 2026
This is a follow-up to #67381 which introduced a subtle bug where depending on the type checking configuration, we may put an object literal directly in the TCB body which the TS compiler ends up interpreting as a block. These changes resolve the issue by always wrapping the literal in parentheses.
crisbeto
added a commit
to crisbeto/angular
that referenced
this pull request
Mar 5, 2026
This is a follow-up to angular#67381 which introduced a subtle bug where depending on the type checking configuration, we may put an object literal directly in the TCB body which the TS compiler ends up interpreting as a block. These changes resolve the issue by always wrapping the literal in parentheses.
atscott
pushed a commit
that referenced
this pull request
Mar 5, 2026
This is a follow-up to #67381 which introduced a subtle bug where depending on the type checking configuration, we may put an object literal directly in the TCB body which the TS compiler ends up interpreting as a block. These changes resolve the issue by always wrapping the literal in parentheses.
crisbeto
added a commit
to crisbeto/angular
that referenced
this pull request
Mar 13, 2026
Fixes a regression introduced by angular#67381 where we weren't escaping backticks in template literals. Fixes angular#67675.
crisbeto
added a commit
to crisbeto/angular
that referenced
this pull request
Mar 15, 2026
Fixes a regression introduced by angular#67381 where we weren't escaping backticks in template literals. Fixes angular#67675.
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.
Starts the process of decoupling our TCB generation from TypeScript's
factoryAPIs which might not be available in TypeScript 7. These changes try to cover the majority of TCB use cases, but we still have some where we print throughts.Printer. I aim to address those in a follow-up PR.