Skip to content

Commit 6abd0d3

Browse files
committed
fix(examples): null-safe $refs access in DialogRef typed fixture (LB6 SEAM 1)
Optional-chain $refs.dlg so the ref-may-be-null narrowing holds under the Solid typed gate's strictNullChecks (TS18047). The `.showModal()`/`.close()` RED proof (TS2339 on HTMLElement pre-fix) is unaffected.
1 parent 4d269e8 commit 6abd0d3

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

examples/typed/DialogRef.rozie

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@
2525
<script lang="ts">
2626
$onMount(() => {
2727
// Both calls are HTMLDialogElement-only — they only typecheck once the ref
28-
// is typed HTMLDialogElement (not the HTMLElement default).
28+
// is typed HTMLDialogElement (not the HTMLElement default). Optional-chained
29+
// so the ref-may-be-null narrowing holds on every target's tsconfig (the
30+
// Solid gate runs strictNullChecks).
2931
if ($props.open) {
30-
$refs.dlg.showModal()
32+
$refs.dlg?.showModal()
3133
} else {
32-
$refs.dlg.close()
34+
$refs.dlg?.close()
3335
}
3436
})
3537
</script>

0 commit comments

Comments
 (0)