fix(structures): widen via String() in narrowing test to satisfy lint #231

Merged
julien merged 1 commits from fix/structure-kind-spec-lint into main 2026-05-26 13:36:43 +02:00

1 Commits

Author SHA1 Message Date
Julien Gautier 377a484afc fix(structures): widen via String() in narrowing test to satisfy lint
CI / commits (pull_request) Successful in 2m44s
CI / scan (pull_request) Successful in 2m53s
CI / a11y (pull_request) Successful in 3m42s
CI / perf (pull_request) Successful in 8m39s
CI / check (pull_request) Failing after 12m35s
The narrowing test for `isStructureKind` had `const candidate: string =
'medico_social'`, which ESLint's `@typescript-eslint/no-inferrable-types`
correctly flags as trivially-inferred.

The naive fix - dropping the annotation - would let TypeScript infer
the literal type `'medico_social'`, which is already a StructureKind
subtype. The narrowing check would then be vacuous (TypeScript already
knows the value is a kind, the runtime guard has nothing to prove).

Fix: round-trip through `String()` to widen the literal to `string`.
TypeScript infers `string` for `String(...)` return; no annotation
needed; the narrowing test stays meaningful.

CI lint target on portal-bff now passes 0 errors. The 13 remaining
warnings (non-null assertions in principal-extractor.spec, unused
underscored params in rate-limit.middleware, etc.) are pre-existing
and not in scope for this fix.
2026-05-26 13:34:03 +02:00