Skip to content

Conversation

@ShGKme
Copy link
Contributor

@ShGKme ShGKme commented Oct 6, 2024

Before

// ✅ Ok
t('app', 'Hello, {name}!', { name: 'Alice' })

// ✅ Ok
t('app', 'Hello, {name}!', { user: 'Alice' })

// ✅ Ok
t('app', 'Hello, {name}!', {})

After

// ✅ Ok
t('app', 'Hello, {name}!', { name: 'Alice' })

// ❌ Object literal may only specify known properties, and 'user' does not exist in type 'TranslationVariables<"Hello, {name}!">'
t('app', 'Hello, {name}!', { user: 'Alice' })

// ❌ Argument of type '{}' is not assignable to parameter of type 'TranslationVariables<"Hello, {name}!">'.
//  Property 'name' is missing in type '{}' but required in type 'TranslationVariables<"Hello, {name}!">'
t('app', 'Hello, {name}!', {})

@ShGKme ShGKme added type: bug 🐛 Something isn't working 3. to review 3️⃣ Waiting for reviews labels Oct 6, 2024
@ShGKme ShGKme requested a review from susnux October 6, 2024 15:45
@ShGKme ShGKme self-assigned this Oct 6, 2024
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
@ShGKme ShGKme force-pushed the fix/typed-var-placeholder-keys branch from fdaf005 to 888f9fc Compare October 6, 2024 17:00
@susnux susnux merged commit 08cdafe into main Jan 10, 2025
@susnux susnux deleted the fix/typed-var-placeholder-keys branch January 10, 2025 07:40
@susnux susnux mentioned this pull request Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review 3️⃣ Waiting for reviews type: bug 🐛 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants