Skip to content

fix(compiler-cli): escape template literal in TCB#67678

Merged
mattrbeck merged 1 commit intoangular:mainfrom
crisbeto:67675/escape-template-literal
Mar 16, 2026
Merged

fix(compiler-cli): escape template literal in TCB#67678
mattrbeck merged 1 commit intoangular:mainfrom
crisbeto:67675/escape-template-literal

Conversation

@crisbeto
Copy link
Copy Markdown
Member

Fixes a regression introduced by #67381 where we weren't escaping backticks in template literals.

Fixes #67675.

@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 13, 2026
@angular-robot angular-robot bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Mar 13, 2026
@ngbot ngbot bot added this to the Backlog milestone Mar 13, 2026
@crisbeto crisbeto requested a review from atscott March 13, 2026 09:36
Copy link
Copy Markdown
Member

@JoostK JoostK left a comment

Choose a reason for hiding this comment

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

A test in https://github.com/angular/angular/blob/main/packages/compiler-cli/test/ngtsc/template_typecheck_spec.ts would be meaningful to verify the template is checked as expected;

@Component({
  template: `
    @let var = `Version: \`${check(version)}\``;
  `
})
export class Cmp {
  version = 'test'
  check(input: number): string {
    return String(input);
  }
}

Should report a type assignability error from string to number. That shows that the template's substitutions are type-checked as expected.

Fixes a regression introduced by angular#67381 where we weren't escaping backticks in template literals.

Fixes angular#67675.
@crisbeto crisbeto force-pushed the 67675/escape-template-literal branch from a5b4ef7 to 1729e55 Compare March 15, 2026 21:27
@crisbeto
Copy link
Copy Markdown
Member Author

crisbeto commented Mar 15, 2026

Added the extra test case.

@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Mar 16, 2026
@mattrbeck mattrbeck merged commit 2bd708f into angular:main Mar 16, 2026
20 of 21 checks passed
@mattrbeck
Copy link
Copy Markdown
Member

This PR was merged into the repository. The changes were merged into the following branches:

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.

double escaped backtick in template literal string in template html breaks from @angular/ v21.2.2

3 participants