fix(codex-audit): narrow content non-null in block-handle + inserter

`npm run check` was reporting 'content is possibly null' errors in
both block-handle and block-inserter $effect closures — 6 errors
between them. TS doesn't carry the `if (!content) return` narrowing
into inner closures, so we re-bind to a const typed `HTMLElement`
right after the guard.

`npm run check`: 22 → 16 errors. Remaining 10 (drawer command-name
/ mark string-not-assignable, words.svelte missing 'insert-image'
key in the Record, plus 6 pre-existing in src/lib/_demo and others)
need a deeper look at the command-name / mark string unions —
follow-up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
active-uix
dev 4 months ago
parent d767d88c03
commit 949cc88d75

@ -154,8 +154,11 @@
}
$effect(() => {
const content = document.querySelector<HTMLElement>('[data-words-content]');
if (!content) return;
const found = document.querySelector<HTMLElement>('[data-words-content]');
if (!found) return;
// Narrowed once at the top; TS doesn't carry the narrowing into
// the closure below, so we re-bind to a non-null `content`.
const content: HTMLElement = found;
// Listen at the document level (not on `content`) so the cursor
// crossing into the grip — which lives OUTSIDE the content box,

@ -114,8 +114,11 @@
}
$effect(() => {
const content = document.querySelector<HTMLElement>('[data-words-content]');
if (!content) return;
const found = document.querySelector<HTMLElement>('[data-words-content]');
if (!found) return;
// Narrowed once at the top; TS doesn't carry the narrowing into
// the closures below, so we re-bind to a non-null `content`.
const content: HTMLElement = found;
// Track movement on the document, not on `content`, so the "+"
// button (which lives in the left margin OUTSIDE the content

Loading…
Cancel
Save

Powered by TurnKey Linux.