Skip to content

feat(typescript) :: typecheck browser JavaScript in CI - #1373

Draft
81reap wants to merge 8 commits into
sqlpage:mainfrom
81reap:stack/8-typecheck
Draft

feat(typescript) :: typecheck browser JavaScript in CI#1373
81reap wants to merge 8 commits into
sqlpage:mainfrom
81reap:stack/8-typecheck

Conversation

@81reap

@81reap 81reap commented Aug 8, 2026

Copy link
Copy Markdown

Motivation

  • The browser scripts carry JSDoc types that nothing checks, so a misspelt property or a missing null check only shows up in a browser.
  • The browser tests are TypeScript, but nothing compiles them either. fix(modal) :: give modal component an accessible name #1367 fixed a getByRole option that does not exist; tsc reports it as TS2353.

Description

  • Add a root tsconfig.json running checkJs and strict over sqlpage/*.js, and one per test project.
  • Declare in sqlpage/globals.d.ts the names the bundle relies on at runtime rather than through an import: L, ApexCharts, chart_series, TomSelect, and tabler's bundled bootstrap.
  • Declare in tests/end-to-end/globals.d.ts what the tests reach for on the page, chiefly the Tom Select instance sqlpage_select_dropdown attaches to a <select>.
  • Fix what the checker found: unguarded page.goto() results in the tests, a querySelectorAll typed as Element, and an Array.prototype.shift whose result is only sometimes defined.
  • Hoist @types/node to the root, add typescript, and run npm run typecheck from npm test.
  • Split table sorting into three named tests, reading the cells as td._col_id and td._col_Amount_in_stock. It looked for td.id and td.Amount, which the table has never rendered, so it sorted two empty lists and passed whatever the table did. The new helper refuses a column of fewer than two cells.

Testing

  • npm test checks 46 files, typechecks the three projects and passes the 15 unit tests, all reporting nothing.
  • The browser suite passes 43 tests.
  • no console errors on card page fails for the reason described in fix(biome.js) :: fix remaining lint issues #1366, on this branch and on the unmodified base alike.

GitHub cannot base a pull request on a branch that lives in a fork, so all eight target main and each one carries the commits of those above it. Review and merge them in order:

  1. fix(biome.js) :: fix remaining lint issues #1366 :: fix(biome.js) :: fix remaining lint issues
  2. fix(modal) :: give modal component an accessible name #1367 :: fix(modal) :: give modal component an accessible name
  3. fix(map) :: ignore map coordinates that are not a pair of numbers #1368 :: fix(map) :: ignore map coordinates that are not a pair of numbers
  4. feat(chart) :: render column charts as bar charts #1369 :: feat(chart) :: render column charts as bar charts
  5. fix(chart) :: align stacked series on their X values #1370 :: fix(chart) :: align stacked series on their X values
  6. fix(chart) :: line series up on a category axis for every chart type #1371 :: fix(chart) :: line series up on a category axis for every chart type
  7. fix(npm) :: install dependencies only once at root level #1372 :: fix(npm) :: install dependencies only once at root level
  8. feat(typescript) :: typecheck browser JavaScript in CI #1373 :: feat(typescript) :: typecheck browser JavaScript in CI ← this PR

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