You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 74c850f
Browse filesBrowse the repository at this point in the historyBrowse files
EPBDS-16211 E2: seven stateful components, as TypeScript (#137)
## What changes
Seven stateful components become TypeScript:
- `ProgressBar`, `ProgressSteps` and `Counter`;
- `Pagination`, `Select` and `Dropzone`;
- `StandaloneTabs`.
All seven are renamed with `git mv`. Git detects every rename (61–75%
similarity), so their history follows.
The §9.3 step 6 hooks conversions among them are typed as they are:
- their state objects get types;
- the refs their timers read go through non-null assertions, since every
render assigns the ref before any handler runs;
- the `props !== propsSeen` derivations are untouched.
| file | notes |
|---|---|
| `ProgressBar.tsx` | `ProgressBarProps`; the value may be a fraction or
NaN, undefined or null, as documented |
| `ProgressSteps.tsx` | `ProgressStepsProps`, `ProgressStep` |
| `Counter.tsx` | `CounterProps`, `CounterRender`, and `CounterFrame`
for the exported `nextFrame` |
| `Pagination.tsx` | `PaginationProps`, `PageChange` |
| `Select.tsx` | `SelectProps`, `SelectOption` |
| `Dropzone.tsx` | `DropzoneProps`, and `DropzoneHandle`, the real
handle with `fileInputEl` included |
| `StandaloneTabs.tsx` | `StandaloneTabsProps`, `StandaloneTab`, and
`StandaloneTabsHandle` for function content |
**`Upload`'s last component cast, `Dropzone`'s, is deleted.** Its
`DropzoneHandle` is re-exported from `Dropzone`.
A throwaway probe of seven wrong call sites failed on all seven, and its
correct counterparts compiled:
- a string `value` on `ProgressBar`;
- a numeric `step`;
- a `Counter` without `end`;
- a `Pagination` without `totalPages`;
- a `Select` without `options`;
- an `onDrop` taking a string;
- a tab without `content`.
## What the checker surfaced
- **`forwardRef`'s own type erases named props.** It runs them through
`Omit<…, 'ref'>`, which keeps nothing but the index signature of a type
that has one. `RowRef` hit the same trap in #134. `Dropzone` is
therefore cast to the same component with its props kept.
- **`InputNative`'s `select` branch hands `Select` the engine
`onChange`, `(value, name, event)`.** That is the signature `Select`
reports with. `ForwardedProps` said every branch overwrote the handler.
The comment is corrected, and the call is a commented cast.
- **`StandaloneTabs` renders an object tab without an `icon` as it is.**
Its `propTypes` accept `{text}` alone, and React rejects rendering it.
The component is demo-only, and `NavTabs` passes strings, so this is
recorded and not fixed. The cast that keeps the JavaScript's assumption
says so.
- **Two smaller casts:**
- `renderFloat` is still JavaScript, and its JSDoc types the element it
returns as `Object`, so `Counter`'s default `render` is cast.
- `Counter`'s `className` and `style` are declared by its `propTypes`
and read by nothing. The type says so.
## No runtime change
Every edit is a type, a cast or a comment.
`dist/index.js` shrank by 12 bytes, from 327,399 to 327,387, because
`Upload`'s `const Dropzone = DropzoneJs` alias is gone.
## Measured
- **The corpus is identical to master.** Over the 38 examples through
the published entry: commits at mount 107, `translate` calls 1013, and
27 / 64 on an edit. The DOM is identical after mount and after an edit.
- **The TypeScript share grew.** `src/core` + `src/library` hold 64
TypeScript files, 9,989 lines (was 57 and 8,830), against 93 JavaScript
files, 10,111 lines (was 100 and 11,051). That is 49.7% of the lines, up
from 44.4%.
## Housekeeping
- **Six coverage thresholds follow the renamed files.** They are in
`jest.config.js`.
- **Two comments that named `Pagination.js` now name `Pagination.tsx`.**
One of them is in `_semantic.less` and survives compilation, so
`public/static/ui-render.built.css` is rebuilt; it differs by that one
line.
- **`docs/SUPPORTED-PROPS.md` needed no change**, as `docs:props:check`
confirms.
- **The plan records the batch.** `docs/UPGRADE-PLAN.md` §9.6-E2 has the
note.
## Gates
All exited 0:
- `lint:js`, `lint:css`, `typecheck`, `typecheck:contract`;
- `docs:props:check`, `docs:views:check`, `css:fixture:check`;
- `test:env-flags`, `build`;
- `test:coverage`, thresholds included. Every touched file's coverage is
unchanged, and the partial ones (`Pagination`, `StandaloneTabs`,
`InputNative`, `Upload`) are partial on the same expressions as on
master;
- `test:pack`, `test:pack:peers`, `test:types`;
- `test:react16`, `test:react19`, 2908 tests each;
- `test:e2e`, 41 tests;
- the manifest contract.
**`test:react17` took three runs, and none of them failed a test.** Two
runs lost a jest worker to `SIGSEGV`, the V8 crash of nodejs/node#62393
that this machine's Node 24.14 is known to hit:
1. **First run:** the worker died in `manifest.contract.test.js`, and
2900 tests passed.
2. **Second run:** the worker died in `Dropdown.gate.test.js`, a file
this PR does not touch, and 2901 tests passed.
3. **Third run:** clean, 2908 of 2908.
Both crashed suites also passed alone on the React 17 leg, 15 of 15. The
three earlier React 17 runs this session, one per batch, were all clean.
In the demo on the dev server:
- **`Pagination`:** a click on page 2 moved the current page and the
table to rows 6 onwards.
- **`Upload`:** it rendered its three `Dropzone`s, each with a hidden
file input carrying the right `accept` and `multiple`.
- **`StandaloneTabs`:** the navigation switched to "Styles", and one
Back returned to the examples page, so there is one history entry per
click.
- **Console:** no error.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Copy file name to clipboardExpand all lines: docs/UPGRADE-PLAN.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1096,6 +1096,15 @@ Measured: the corpus is identical to master's (107 / 1013 at mount, 27 / 64 on a
1096
1096
1097
1097
Measured: the corpus is identical to master's (107 / 1013 at mount, 27 / 64 on an edit, the DOM unchanged after both), and `dist/index.js` is byte-for-byte the same size, 327,399. `src/core` + `src/library` are 57 TS files, 8,830 lines, against 100 JS files, 11,051 lines: 44.4% of the lines, was 42.4%.
1098
1098
1099
+
**Fifth batch, 2026-09-30: seven stateful components** — `ProgressBar`, `ProgressSteps`, `Counter`, `Pagination`, `Select`, `Dropzone` and `StandaloneTabs`. The §9.3 step 6 hooks conversions among them are typed as they are: their state objects get types, the refs their timers read go through non-null assertions, and the `props !== propsSeen` derivations are untouched. `Upload`'s last component cast, `Dropzone`'s, is deleted, and its `DropzoneHandle` is now the real handle, `fileInputEl` included. Three things the checker surfaced:
1100
+
-**`forwardRef`'s own type erases named props.** It runs them through `Omit<…, 'ref'>`, which keeps nothing but the index signature of a type that has one — the trap `RowRef` hit in the second batch. `Dropzone` is therefore cast to the same component with its props kept.
1101
+
-**`InputNative`'s `select` branch hands `Select` the ENGINE `onChange`, `(value, name, event)`.**`ForwardedProps` said every branch overwrote it. The comment is corrected, and the call is a commented cast.
1102
+
-**`StandaloneTabs` renders an object tab without an `icon` as it is.** Its `propTypes` accept `{text}` alone, and React rejects rendering one. It is demo-only and `NavTabs` passes strings, so it is recorded, not fixed; the cast that keeps the JavaScript's assumption says so.
1103
+
1104
+
Also: `renderFloat` is still JavaScript, and its JSDoc types the element it returns as `Object`, so `Counter`'s default `render` is cast. `Counter`'s `className` and `style` are declared by its `propTypes` and read by nothing, and the type says so.
1105
+
1106
+
Measured: the corpus is identical to master's (107 / 1013 at mount, 27 / 64 on an edit, the DOM unchanged after both). `dist/index.js` is 327,399 → 327,387 bytes, because `Upload`'s `const Dropzone = DropzoneJs` alias is gone. `src/core` + `src/library` are 64 TS files, 9,989 lines, against 93 JS files, 10,111 lines: 49.7% of the lines, was 44.4%.
1107
+
1099
1108
#### E3 — Engine last
1100
1109
1101
1110
`rules.js` / `form/utils.js` are typed **as they are decomposed** (§9.3) — decomposition outputs are born as `engine/*.ts`. Typing the prototype-patching machinery as-is is wasted effort; don't.
0 commit comments