refactor(api): type req<T>() and tighten the error layer (R7 S1)

req() returned Promise<any>, so every api.* return annotation was an
unchecked assertion and the 17 action endpoints leaked `any` to callers.
Make req generic with a single audited cast at the boundary; T flows from
each method's declared return type via contextual inference, so no call
site needs a type arg except where none existed:

- me(): type the /api/me probe ({ authenticated } + Partial<Me>)
- deepAll / syncSubscriptions: real backend-verified response shapes
- HttpError.detailData, localizeDetail(d), inner detailData: any -> unknown

Also teach localizeDetail the FastAPI 422 detail-ARRAY shape (carried in
from R6 S1b review): now that malformed requests return 422, surface the
offending field via a localized errors.validation key instead of falling
through to the generic toast.

No runtime change on normal flows (req is await-identical); the 422 branch
only fires on genuinely malformed input. Gate green: typecheck, eslint,
prettier, 68 vitest. Smoke-tested localdev: /api/me + feed 200, no console
errors.
This commit is contained in:
2026-07-26 21:51:24 +02:00
parent cb925e3ab9
commit 16585d868d
3 changed files with 44 additions and 15 deletions
+1
View File
@@ -1,6 +1,7 @@
{
"title": "Couldn't complete that",
"generic": "The server couldn't carry out that action. Please try again.",
"validation": "Invalid value for “{{field}}”. Please check it and try again.",
"server": "Server error",
"ok": "OK",
"offline": {
+1
View File
@@ -1,6 +1,7 @@
{
"title": "Nem sikerült",
"generic": "A szerver nem tudta végrehajtani a műveletet. Próbáld újra.",
"validation": "Érvénytelen érték: „{{field}}”. Ellenőrizd, majd próbáld újra.",
"server": "Szerverhiba",
"ok": "OK",
"offline": {