-
-
Notifications
You must be signed in to change notification settings - Fork 29
Closed
Description
🐛 Bug Report
TypeScript type assertions (as in #133) result in placeholders being numbered differently. Since type assertions go away at runtime, this is incorrect. (It results in placeholders that react-i18next doesn't recognize at runtime.)
To Reproduce
export function Test() {
const one = "one";
const two = "two";
return (
<Trans>
<div>
<a>{{ one } as any}</a> to <b>{{ two } as any}</b>
</div>
</Trans>
);
}With type assertions, i18next-cli extract extracts "<0><1>{{one}}</1> to <4>{{two}}</4></0>".
Without the as any type assertions, it extracts "<0><1>{{one}}</1> to <3>{{two}}</3></0>".
From what I can tell, "<0><1>{{one}}</1> to <3>{{two}}</3></0>" matches what react-i18next expects at runtime.
Expected behavior
Results that are consistent and compatible with react-i18next
Your Environment
- runtime version: Node.js 24
- i18next version: i18next 25.7.2, react-i18next 16.5.0, i18next-cli 1.31.0
- os: Mac
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels