Repository navigation
EPBDS-16211 E2: the field components and their helpers, as TypeScript - #138
Merged
Merged
Conversation
Input, InputDate and Table become .tsx, and domProps, inputs/ validationRules, inputs/normalizers and utils/timers become .ts (git mv, so their history follows). LocalDraftTableRow's last three component casts go: no .tsx file casts a component any more. The checker's findings, each typed as the code behaves: the draft row hands its fields an `unknown` error, which under validate: 'maxLength' is the function the factory returns (a cast at the read, with the note); InputDate passes rc-picker a `resize` it does not declare and drops (measured: no element carries it, the open panel included); `password` keeps its last value on itself, which TypeScript only sees through a cast. omitProps returns Record<string, unknown> instead of the `Object` its JSDoc said, which retires Row's cast. Every mention of a renamed file follows it, the coverage thresholds included; the first gate run caught three thresholds my stale-path check had missed, because `git grep -E` with \b matches nothing on this machine. Rechecked with -P: six older comments naming Data.js (missed by #133) and five naming TooltipPop.js are fixed too. docs/SUPPORTED-PROPS.md and the built CSS are regenerated. Measured: the 38-example corpus is identical to master (107 / 1013 / 27 / 64, same DOM); dist/index.js 327,387 -> 327,369 bytes; TypeScript is 53.5% of src/core + src/library lines, was 49.7%.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
The field components and the helpers the converted files already leaned on become TypeScript.
.tsx:Input,InputDateandTable..ts:domProps, with a typedomitProps;inputs/validationRules;inputs/normalizers;utils/timers, which holdsuseTimers.All seven are renamed with
git mv. Git detects every rename (53–96% similarity), so their history follows.Input.tsxInputPropsInputDate.tsxInputDateProps, over rc-picker's ownPickerPropsTable.tsxTablePropsandTablePartProps; the family's structure is unchangeddomProps.tsomitPropsreturnsRecord<string, unknown>, not theObjectits JSDoc saidvalidationRules.tsValidationResultnormalizers.tstimers.tsTimers, withsetTimeout's extra arguments typed through to the callbackLocalDraftTableRow's last three component casts go, so no.tsxfile casts a component any more. What is left ofUnconvertedComponenttypes the registry slots (Active.Field,Active.UIRender) and the engine's import cycle.Row's cast of theomitPropsresult is gone too.A throwaway probe of seven wrong uses failed on all seven, and its correct counterparts compiled:
onRemovetaking a number;InputDateonChangetaking a number;striped;omitPropson a string;maxLength('5');phone(5);What the checker found
unknownerror.fieldErrors[name]reachesInput/InputDateaserror. It is normally a message. Undervalidate: 'maxLength'it is the function the factory returns, the bug EPBDS-16211 E2: the five components #132 converted, as TypeScript #133 recorded, and React does not render it. A commented cast where it is read says so.InputDatepasses rc-picker aresizethat rc-picker does not declare. A probe showed that rc-picker drops it: no element it renders carries the attribute, the open panel included. It is typed rather than removed, so the runtime is unchanged.passwordkeeps its last value on itself forpassword.confirm. TypeScript recognises a function's own properties only when they are assigned at the top level, so the assignment inside the function is a cast.No runtime change
Every edit is a type, a cast or a comment.
dist/index.jswent from 327,387 to 327,369 bytes, 18 smaller, because three cast aliases are gone and one is added.The prop-reference generator
It statically parses
domPropsandTable.pack()already looked for.ts.export const ENGINE_PROPS = [literally, so the two lists stay unannotated.docs/SUPPORTED-PROPS.mdis regenerated. Only the paths andTable's line count changed.Measured
translatecalls 1013, and 27 / 64 on an edit. The DOM is identical after mount and after an edit.src/core+src/libraryhold 71 TypeScript files, 10,806 lines (was 64 and 9,989), against 86 JavaScript files, 9,396 lines (was 93 and 10,111). That is 53.5% of the lines, up from 49.7%.Housekeeping
domProps.jsnamesdomProps.ts. There were 22 in 17 files: component and engine comments, tests, the generator, the curation, and a comment in the CI workflow.jest.config.jsand nine comments. Two of the comments are in LESS (_semantic.less,tooltip.less) that survives compilation, sopublic/static/ui-render.built.cssis rebuilt. A comment that told history ("Table.jsused to be a 24-line wrapper") now names the component without an extension.docs/UPGRADE-PLAN.md§9.6-E2 has the note.A miss of my own, which the gates caught
The first run of the gate set failed
test:coverage: "Coverage data for./src/core/components/Table.jswas not found", and the same forInput.jsandInputDate.js. The three thresholds still named the old files.My stale-path check had passed, but vacuously. On this machine
git grep -Ewith\bmatches nothing: 0 hits where the same search without\bfinds 9. Every check in this PR was rerun word-bounded withgit grep -P, next to a control search for a known hit.That rerun also found older stale mentions, which are fixed here as well:
Data.js. EPBDS-16211 E2: the five components #132 converted, as TypeScript #133 said it had renamed all of them, and its search missed these.TooltipPop.js.Gates
The final run, after the fixes above, exited 0 on every gate:
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, andvalidationRules' andLocalDraftTableRow's partial branches are the same expressions as on master;test:pack,test:pack:peers,test:types;test:react16,test:react17,test:react19, 2908 tests each, with no worker crash;test:e2e, 41 tests;In the demo on the dev server:
inputexample: typing kept the value, and the wrapper took thedoneclass. That is the path thedonecast covers.nestedDataKindexample: it renders fourui tables. None of their 58 cells carries an emptyclass, the cells hold 44 fields, and the draft row's "Add line" button is there.The demo has no date field, since the one date-typed meta is an orphan, so
InputDateis covered by its suites.🤖 Generated with Claude Code