-
-
Notifications
You must be signed in to change notification settings - Fork 342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript error when using pluralization and formatting #1574
Comments
Would you be able to provide a reproduction 🙏 More infoWhy do I need to provide a reproduction?Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making. What will happen?If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritise it based on its severity and how many people we think it might affect. If How can I create a reproduction?We have a couple of templates for starting with a minimal reproduction: 👉 Reproduction mininal starter A public GitHub repository is also perfect. 👌 Please ensure that the reproduction is as minimal as possible. You might also find these other articles interesting and/or helpful: |
https://stackblitz.com/edit/vitejs-vite-mtgsgc?file=src%2FApp.vue It works correctly in the live preview, but when you enter |
Typescript error when using pluralization and formatting intlify#1574
This is actually correct behaviour but I think it differs from v8, the reason it only throws an error on build is due to the type-check, at runtime the passed options are unused/ignored but during type check it throws as // passing `plural` as options
t('results', null, { plural: 2 }) // works
// ^ confused with legacy
$tc('results', 10, { count: 10 }) // does not work!
// passing named object with number
t('results', { count: 2 }) // works So I suppose we could improve the docs, it's not exactly breaking per se as it's a different but similar function |
Reporting a bug?
I'm trying to use pluralization and formatting together. This works as it should, but the TypeScript types seem to be incorrect, which makes it impossible to build the project properly.
Expected behavior
The types match the actual call signature of the
t
function and I can successfully build my project.Reproduction
The error in question:
System Info
Screenshot
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: