Commit d0479ad
fix(babel-plugin-lingui-macro): unwrap non-null assertion (
`tokenizeExpression` only unwrapped `TSAsExpression`, so a placeholder like
`t`${x!}`` was treated as a complex expression and assigned an indexed
placeholder (`{0}`), whereas `@lingui/swc-plugin` unwraps it to a named
placeholder (`{x}`). This produced different message IDs for identical source,
breaking catalog lookups in projects that extract with the JS macro but run
with the SWC plugin.
Unwrap `TSNonNullExpression` and `TSSatisfiesExpression` alongside
`TSAsExpression` so all TS-only wrappers name the inner expression, matching
the SWC plugin and the existing `as` behavior.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>x!) and satisfies in placeholders (#2622)1 parent b4be90d commit d0479ad
3 files changed
Lines changed: 37 additions & 2 deletions
File tree
- packages/babel-plugin-lingui-macro
- src
- test
- __snapshots__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
265 | | - | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
266 | 272 | | |
267 | 273 | | |
268 | 274 | | |
| |||
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
511 | 511 | | |
512 | 512 | | |
513 | 513 | | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
514 | 534 | | |
515 | 535 | | |
516 | 536 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
112 | 121 | | |
113 | 122 | | |
114 | 123 | | |
| |||
0 commit comments