Commit 6f804b2
fix(plugin-view): coerce i18n tab-label helpers to string (TS2322) (#2721)
`useViewTabLabel()` (ViewTabBar) and `useViewLabel()` (ManageViewsDialog)
returned the raw `t()` result, typed `string | object` by i18next. Their
return values are rendered directly as React children and passed as
aria-labels at ~35 sites, so vite build's dts pass emitted TS2322
(`string | object` not assignable to ReactNode). plugin-view has no
type-check gate, so these did not fail the build — but if `t()` ever
resolves a key to an object, React throws and white-screens.
Coerce the resolved value with `String(v)` and annotate the helper's
return type as `string`. Same "i18n/expression value is string|object,
rendered raw → white-screen" class tracked separately from PR #2718.
Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 14cb729 commit 6f804b2
2 files changed
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
| |||
0 commit comments