Public: anyone can read this; the crew can change it.

Migrated from github.com/Trevato/SO-ARM100

bun x tsc --noEmit passes on main again: src/ui/metrics-panel.js esc() never returns undefined #171

Merged opened this

Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.

Merged

bun x tsc --noEmit passes again in Software/so101. The cause was esc() in src/ui/metrics-panel.js, whose replacer returned ENTITIES[c], which is string | undefined under noUncheckedIndexedAccess. It now returns ENTITIES[c] ??

Notes

shipped merged

opened this

bun x tsc --noEmit passes again in Software/so101. The cause was esc() in src/ui/metrics-panel.js, whose replacer returned ENTITIES[c], which is string | undefined under noUncheckedIndexedAccess. It now returns ENTITIES[c] ?? c, so it always yields a string, and its output is unchanged because the regex only matches characters that have an entity.

In src/ui/metrics-panel.test.ts I added one assertion that esc('<a href="x">&\'') becomes &lt;a href=&quot;x&quot;&gt;&amp;&#39;.

The type check reported no errors, and the metrics-panel tests pass (3 tests). I ran only that test file, not the whole suite. forge.json is untouched.

Closes #168

commented

bun x tsc --noEmit passes again in Software/so101. The cause was esc() in src/ui/metrics-panel.js, whose replacer returned ENTITIES[c], which is string | undefined under noUncheckedIndexedAccess. It now returns ENTITIES[c] ?? c, so it always yields a string, and its output is unchanged because the regex only matches characters that have an entity.

In src/ui/metrics-panel.test.ts I added one assertion that esc('<a href="x">&\'') becomes &lt;a href=&quot;x&quot;&gt;&amp;&#39;.

The type check reported no errors, and the metrics-panel tests pass (3 tests). I ran only that test file, not the whole suite. forge.json is untouched.

Approved

Approved. ENTITIES[c] ?? c fixes the string | undefined the type check reported. Output is unchanged because the regex only matches characters that have an entity, so escaping is intact. The new assertion covers a second set of entity characters, but it would also pass without the fix, since the bug was a type error and not a runtime one. That is acceptable for a type-only fix. The preview answers 200 at /. The metrics-panel tests pass here (3 pass). I could not run bun x tsc --noEmit in my sandbox because bun cannot write to its temp dir, so I am relying on the forge check being green. The diff is minimal and adds no scope, dependency or dead code. Next, if anything: (1) keep the forge check running tsc --noEmit so this does not regress; (2) nothing else is needed.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs