angular/packages/compiler
Kristiyan Kostadinov 3441f7b914 fix(compiler): error if rawText isn't estimated correctly (#60529) (#60753)
The `TemplateLiteralElementExpr` has some logic where it tries to estimate the `rawText` if one isn't provided by looking at the node's source span. The problem with this approach is that we have some long-standing issues with our expression AST parser (see https://github.com/angular/angular/pull/60267#discussion_r1986402524) where it might not produce accurate spans if escape sequences are involved. This in turn can lead to unrecoverable errors, because TypeScript will throw an error if the raw string doesn't match the cooked one when constructing a TypeScript AST node.

These changes remove the logic that depends on the source span and relies purely on the secondary fallback that inserts escaped characters manually.

It's also worth noting that the `rawText` doesn't seem to matter much at this point, because the main usage of it is when downlevelling template literals to ES5 which we no longer support.

Fixes #60528.

PR Close #60529

PR Close #60753
2025-04-07 13:15:02 -07:00
..
design docs: capitalize webpack with a lowercase W (#56812) 2024-11-26 22:24:11 +00:00
src fix(compiler): error if rawText isn't estimated correctly (#60529) (#60753) 2025-04-07 13:15:02 -07:00
test refactor(compiler): prevent object methods being recognised as entities (#58100) 2025-04-02 11:35:54 +00:00
BUILD.bazel feat(bazel): support shared chunks in ng_package (#60241) 2025-03-06 10:29:05 -08:00
compiler.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
index.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
package.json refactor: remove peer dependency on core from compiler (#60437) 2025-03-18 18:15:08 +01:00
public_api.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00