From 180c08d4eeb2be4beba575be8668e8235a94d676 Mon Sep 17 00:00:00 2001 From: Edwin van den Houdt Date: Thu, 2 Jul 2026 12:32:13 +0200 Subject: [PATCH] fix(registratie): silence NG8102 by moving `?? ''` guard into a method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `draft().antwoorden[q.id]` types as `string` (Record index, no noUncheckedIndexedAccess), so the template `?? ''` tripped NG8102's "redundant nullish coalescing" diagnostic — but a missing key IS `undefined` at runtime, so the guard is real. Moved it into an `antwoord(id)` component method: same runtime safety, no template-only diagnostic. Build now warning-clean. Co-Authored-By: Claude Opus 4.8 --- .../ui/registratie-wizard/registratie-wizard.component.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/registratie/ui/registratie-wizard/registratie-wizard.component.ts b/src/app/registratie/ui/registratie-wizard/registratie-wizard.component.ts index 64e1b37..e22e13e 100644 --- a/src/app/registratie/ui/registratie-wizard/registratie-wizard.component.ts +++ b/src/app/registratie/ui/registratie-wizard/registratie-wizard.component.ts @@ -128,9 +128,9 @@ const NL_TAALVAARDIGHEID_VRAAG = 'nl-taalvaardigheid'; @if (q.type === 'ja-nee') { + [ngModel]="antwoord(q.id)" (ngModelChange)="dispatch({ tag: 'SetAntwoord', vraagId: q.id, value: $event })" [ngModelOptions]="{ standalone: true }" /> } @else { - } @@ -305,6 +305,7 @@ export class RegistratieWizardComponent { protected err = (k: DraftField | 'correspondentie' | 'diploma' | 'documenten') => this.invullen()?.errors[k] ?? ''; protected vraagErr = (id: string) => this.invullen()?.errors.antwoorden?.[id] ?? ''; + protected antwoord = (id: string) => this.draft().antwoorden[id] ?? ''; // runtime guard: missing key → undefined protected set = (key: DraftField, value: string) => this.dispatch({ tag: 'SetField', key, value }); protected setKanaal = (value: string) => this.dispatch({ tag: 'SetCorrespondentie', value: value as Correspondentie });