kazupon/vue-i18n

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,
image
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

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!