if $t first argument is not string
xhxhxhxh opened this issue · 1 comments
Reporting a bug?
<span style="width: 95%;">{{ $t(showRelationDirection?.label || '') }}</span>
There are hundreds of similar usecase in my project,I can not add || ''
everywhere, and it is difficult to ensure the param alaways string. If one place throw error, whole template can not render,
And I can not know which place throw error. Is there any configuration to ignore this error?
Expected behavior
if $t first argument is not string, can return ''
instead of throw error, I expect the template render success.
Reproduction
no link
System Info
...
Screenshot
No response
Additional context
No response
Validations
- Read the Contributing Guidelines
- Read the Documentation
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion
- The provided reproduction is a minimal reproducible example of the bug.
I should you should design the type of showRelationDirection.label
in your application.
If you would use TypeScript, you can do it with type definition.
The $t
argument expects exactly what the error message says.
Thanks!