Skip to content

Refactor TypeScript initialization to remove unchecked casts - #1544

Merged
lovasoa merged 1 commit into
mainfrom
refactor/ts-unsafe-casts
Oct 9, 2026
Merged

lovasoa merged 1 commit into
mainfrom
refactor/ts-unsafe-casts

Conversation

@lovasoa

@lovasoa lovasoa commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Replace 13 unchecked TypeScript assertions with runtime narrowing and type inference, prioritizing frontend initialization. DOM selection now verifies the requested element class for both descendants and fragment roots; script metadata lives on HTMLScriptElement; toast and modal instances are checked against the page-provided or bundled Bootstrap constructor while retaining instance reuse.

Consolidate the Bootstrap initializer loops and flatten the chart initializer closure. Browser and documentation tests validate element types and query results instead of asserting them. The change removes 3 lines overall (14 fewer frontend lines); much of the chart diff is unindentation.

Three documented ApexCharts assertions remain at the library boundary: chart type names, series values supported at runtime beyond the declared types, and undocumented rendered chart internals. Removing these without changing existing chart behavior requires separate library typing work. No dependency, compiler-setting, or SQL component API changes.

Validation:

  • npm run format
  • npm test (Biome, all three TypeScript projects, frontend unit and documentation tests)
  • npm run build and cargo build to embed the updated assets
  • Component Playwright project: 82 passed, covering charts, fragment initialization and delayed bundles, forms, toasts, modals, maps, tables, facets, and big numbers
  • git diff --check

Based on freshly fetched origin/main at 4e277b2a, implemented in an isolated worktree.

@lovasoa
lovasoa added this pull request to the merge queue Oct 9, 2026
Merged via the queue into main with commit 1cd2027 Oct 9, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant