check-types fails on main for the browser extension: textContent (string | null) passed where string is required
Summary
bun run check-types fails on main for apps/browser-extension with a type
error that is unrelated to #1552. CONTRIBUTING.md instructs contributors to run
bun run check-types before submitting, so this is hit by anyone following the
documented workflow.
Error
apps/browser-extension/utils/ui-components.ts(611,13): error TS2345: Argument of type '{ id: string; name: string | null; containerTag: string; }' is not assignable to parameter of type '{ id: string; name: string; containerTag: string; }'. Types of property 'name' are incompatible. Type 'null' is not assignable to type 'string'.
Cause
createProjectSelectionModal declares its callback with a non-nullable name
(utils/ui-components.ts:405-411):
onImport: (project: { id: string; name: string; containerTag: string }) => void
The call site passes Node.textContent, which is string | null
(utils/ui-components.ts:604-611):
name: selectedOption.textContent,
WXT's generated tsconfig sets strict: true, so strictNullChecks rejects it.
Why it has gone unnoticed
- CI does not type-check this package .github/workflows/ci.yml filters to
@supermemory/ai-sdkand@supermemory/memory-graphonly. check-typesfor this app was already failing for the unrelated reason in #1552, so a clean run was rare.- It is TypeScript-version-sensitive: TS 5.9's DOM lib does not widen this
access to
| null, but bun.lock pins typescript 5.8.3 (single entry; the extension's^5.8.3dedupes onto it), so the locked toolchain does hit it.
Runtime impact
None. textContent returns null only for node types such as document and
doctype; on an <option> element it is always a string. A disabled placeholder
option is always appended (utils/ui-components.ts:508-513), so select.options
is never empty and selectedIndex cannot be -1, and the if (selectedOption.value)
guard filters that placeholder out. This is a type-safety defect only.
Suggested fix
- name: selectedOption.textContent,
+ name: selectedOption.textContent ?? "",
Relationship to other issues
#1446 added check-types coverage for this workspace but the app was never made
to pass, so the task is red on main. Fixing this completes that work. Separate
from #1552, which is about .wxt types going stale.
Closing this. The code it refers to was removed in #1651. Thanks for reporting.