Skip to content

Commit 74c850f

Browse files
authored
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)
1 parent 29d3a60 commit 74c850f

14 files changed

Lines changed: 332 additions & 104 deletions

File tree

‎docs/UPGRADE-PLAN.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,15 @@ Measured: the corpus is identical to master's (107 / 1013 at mount, 27 / 64 on a
10961096

10971097
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%.
10981098

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+
10991108
#### E3 — Engine last
11001109

11011110
`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.

‎jest.config.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ module.exports = {
6464
functions: 100,
6565
lines: 100,
6666
},
67-
'./src/core/components/StandaloneTabs.js': {
67+
'./src/core/components/StandaloneTabs.tsx': {
6868
statements: 100,
6969
branches: 94,
7070
functions: 100,
@@ -211,7 +211,7 @@ module.exports = {
211211
functions: 100,
212212
lines: 100,
213213
},
214-
'./src/core/components/Dropzone.js': {
214+
'./src/core/components/Dropzone.tsx': {
215215
statements: 100,
216216
branches: 100,
217217
functions: 100,
@@ -235,7 +235,7 @@ module.exports = {
235235
functions: 100,
236236
lines: 100,
237237
},
238-
'./src/core/components/ProgressSteps.js': {
238+
'./src/core/components/ProgressSteps.tsx': {
239239
statements: 100,
240240
branches: 100,
241241
functions: 100,
@@ -259,7 +259,7 @@ module.exports = {
259259
functions: 77,
260260
lines: 100,
261261
},
262-
'./src/core/components/Counter.js': {
262+
'./src/core/components/Counter.tsx': {
263263
statements: 100,
264264
branches: 100,
265265
functions: 100,
@@ -283,7 +283,7 @@ module.exports = {
283283
functions: 100,
284284
lines: 100,
285285
},
286-
'./src/core/components/Pagination.js': {
286+
'./src/core/components/Pagination.tsx': {
287287
statements: 100,
288288
branches: 94,
289289
functions: 100,
@@ -295,7 +295,7 @@ module.exports = {
295295
functions: 100,
296296
lines: 100,
297297
},
298-
'./src/core/components/ProgressBar.js': {
298+
'./src/core/components/ProgressBar.tsx': {
299299
statements: 100,
300300
branches: 100,
301301
functions: 100,

‎public/static/ui-render.built.css‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4947,7 +4947,7 @@
49474947
a compile-time one. Measured: the five surviving rules pairing a dropdown with
49484948
`.label` are all inside `modules/dropdown` itself and style a `.label` *within* a
49494949
dropdown, which we do not render.
4950-
menu -- carried the comment "For Pagination Component", which was false. `Pagination.js`
4950+
menu -- carried the comment "For Pagination Component", which was false. `Pagination.tsx`
49514951
emits `app__pagination*` and is styled by `src/style/components/pagination.less`.
49524952
49534953
What remains is `globals/reset` and `modules/dropdown`, which are step 4's second half: the
Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,56 @@ import { useTimers } from './utils'
66

77
const DEFAULT_INTERVAL = 17
88
const MAX_ANIMATION_STEPS = 10000
9-
const ANIMATION_PROPS = ['start', 'end', 'duration', 'delay', 'interval', 'easingFn']
9+
10+
/** What the animation runs from: the props that restart it when their value changes. */
11+
type Animation = {
12+
start: number
13+
end: number
14+
duration?: number
15+
delay?: number
16+
interval?: number
17+
easingFn: (progress: number) => number
18+
}
19+
const ANIMATION_PROPS: Array<keyof Animation> = ['start', 'end', 'duration', 'delay', 'interval', 'easingFn']
20+
21+
/** The displayed value and the steps left. */
22+
export type CounterFrame = { value: number, steps: number }
23+
24+
/** How a value is shown: `renderFloat` by default. */
25+
export type CounterRender = (value: number, decimals: number) => React.ReactNode
26+
27+
export type CounterProps = {
28+
/** Default is 0 */
29+
start?: number
30+
end: number
31+
/** Number formatting function */
32+
render?: CounterRender
33+
/** Default is 0 */
34+
decimals?: number
35+
/** Animation delay, default is TIME_DURATION_INSTANT */
36+
delay?: number
37+
/** Animation duration */
38+
duration?: number
39+
/** Animation interval, default is 17 ms, which translates to ~60 frames per second */
40+
interval?: number
41+
/** Animation easing function, see https://gist.github.com/gre/1650294 */
42+
easingFn?: (progress: number) => number
43+
/** Declared by `propTypes`, and not read */
44+
className?: string
45+
/** Declared by `propTypes`, and not read */
46+
style?: React.CSSProperties
47+
}
1048

1149
// A module constant, not an inline default: the animation restarts whenever `easingFn` changes, so a
1250
// default created per render would restart it on every render. The class's `defaultProps` held one.
13-
const cubicEasing = (t) => t * t * t
51+
const cubicEasing = (t: number) => t * t * t
1452

1553
// `===`, except that NaN equals NaN. The class compared with `!==` inside a lifecycle, so a NaN prop
1654
// restarted the animation on every parent render; compared during render, it would never settle.
17-
const sameValue = (a, b) => a === b || (Number.isNaN(a) && Number.isNaN(b))
55+
const sameValue = (a: unknown, b: unknown) => a === b || (Number.isNaN(a) && Number.isNaN(b))
1856

1957
/** How an animation runs, from its props: what the class's `setup()` computed. */
20-
const planOf = ({end, start, duration = ONE_SECOND, delay = TIME_DURATION_INSTANT, interval = DEFAULT_INTERVAL}) => {
58+
const planOf = ({end, start, duration = ONE_SECOND, delay = TIME_DURATION_INSTANT, interval = DEFAULT_INTERVAL}: Animation) => {
2159
const safeDuration = Number.isFinite(duration) && duration >= 0 ? duration : ONE_SECOND
2260
const safeDelay = Number.isFinite(delay) && delay >= 0 ? delay : TIME_DURATION_INSTANT
2361
const safeInterval = Number.isFinite(interval) && interval > 0 ? interval : DEFAULT_INTERVAL
@@ -28,7 +66,7 @@ const planOf = ({end, start, duration = ONE_SECOND, delay = TIME_DURATION_INSTAN
2866
}
2967

3068
/** The displayed value and the steps left, as an animation starts. */
31-
const initialState = (animation) => {
69+
const initialState = (animation: Animation): CounterFrame => {
3270
const {steps, safeDuration} = planOf(animation)
3371
return {steps, value: safeDuration === 0 ? animation.end : animation.start}
3472
}
@@ -42,7 +80,7 @@ const initialState = (animation) => {
4280
* @param {Number} end - the value the animation finishes on
4381
* @returns {{value: Number, steps: Number}} the next state
4482
*/
45-
export const nextFrame = (state, end) => {
83+
export const nextFrame = (state: CounterFrame, end: number): CounterFrame => {
4684
const {value, steps} = state
4785
if (steps <= 0) return state
4886
const nextSteps = steps - 1
@@ -69,14 +107,15 @@ export const nextFrame = (state, end) => {
69107
function Counter ({
70108
start = 0,
71109
end,
72-
render = renderFloat,
110+
// A cast: `renderFloat` is still JavaScript, and its JSDoc types the element it returns as `Object`.
111+
render = renderFloat as CounterRender,
73112
decimals = 0,
74113
delay,
75114
duration,
76115
interval,
77116
easingFn = cubicEasing,
78-
}) {
79-
const animation = {start, end, duration, delay, interval, easingFn}
117+
}: CounterProps) {
118+
const animation: Animation = {start, end, duration, delay, interval, easingFn}
80119
const [running, setRunning] = useState(animation)
81120
const [state, setState] = useState(() => initialState(animation))
82121
if (ANIMATION_PROPS.some((prop) => !sameValue(running[prop], animation[prop]))) {
Lines changed: 47 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,47 @@
11
import React, { forwardRef, useEffect, useImperativeHandle, useRef } from 'react'
22
import { ENGINE_PROPS, FIELD_ONLY_PROPS, omitProps } from './domProps'
33

4+
/** What `Dropzone` exposes through its ref. */
5+
export type DropzoneHandle = {
6+
/** The hidden `<input type="file">`, once mounted */
7+
readonly fileInputEl: HTMLInputElement | null
8+
/** Opens the file dialog, unless disabled */
9+
open: () => void
10+
}
11+
12+
/** The named props are read here; the rest is spread onto the wrapping `<div>` through ./domProps. */
13+
export type DropzoneProps = {
14+
/** Comma-separated list of accepted formats (e.g. `.jpg, .png` or `image/*`) */
15+
accept?: string
16+
/** Allow selecting multiple files */
17+
multiple?: boolean
18+
/** Disable click and drop */
19+
disabled?: boolean
20+
/** Fires on drop or file dialog selection, with the files `accept` lets through */
21+
onDrop?: (acceptedFiles: File[]) => void
22+
/** Fires once when the first dragged file enters the zone */
23+
onDragEnter?: (event: React.DragEvent<HTMLDivElement>) => void
24+
/** Fires once when the last dragged file leaves the zone */
25+
onDragLeave?: (event: React.DragEvent<HTMLDivElement>) => void
26+
/** Fires when the user closes the file dialog without picking files */
27+
onFileDialogCancel?: () => void
28+
/** Extra props for the hidden `<input type="file">` */
29+
inputProps?: React.InputHTMLAttributes<HTMLInputElement>
30+
/** Css class for the wrapping element */
31+
className?: string
32+
/** Rendered inside the zone */
33+
children?: React.ReactNode
34+
[key: string]: unknown
35+
}
36+
437
/**
538
* Drag & drop file zone built on the native File API. Replaces the small subset
639
* of `react-dropzone` we use: a wrapping element that opens a hidden file input
740
* on click, accepts drag&drop, and preserves the imperative API used by Upload:
841
* `open()` plus the underlying `fileInputEl`.
942
*
10-
* @param {String} [accept] - comma-separated list of accepted formats (e.g. `.jpg, .png` or `image/*`)
11-
* @param {Boolean} [multiple] - allow selecting multiple files
12-
* @param {Boolean} [disabled] - disable click and drop
13-
* @param {Function} [onDrop] - (acceptedFiles: File[]) => void; fires on drop or file dialog selection
14-
* @param {Function} [onDragEnter] - fires once when the first dragged file enters the zone
15-
* @param {Function} [onDragLeave] - fires once when the last dragged file leaves the zone
16-
* @param {Function} [onFileDialogCancel] - fires when the user closes the file dialog without picking files
17-
* @param {Object} [inputProps] - extra props for the hidden `<input type="file">`
18-
* @param {String} [className] - css class for the wrapping element
19-
* @param {*} [children] - rendered inside the zone
43+
* Typed by a cast at the end: `forwardRef`'s own type runs the props through `Omit<…, 'ref'>`, which
44+
* erases every named prop of a type with an index signature. This is the same component with them kept.
2045
*/
2146
const Dropzone = forwardRef(function Dropzone ({
2247
accept,
@@ -30,8 +55,8 @@ const Dropzone = forwardRef(function Dropzone ({
3055
className,
3156
children,
3257
...props
33-
}, ref) {
34-
const inputRef = useRef(null)
58+
}: DropzoneProps, ref: React.ForwardedRef<DropzoneHandle>) {
59+
const inputRef = useRef<HTMLInputElement>(null)
3560
const dragCounter = useRef(0)
3661

3762
useImperativeHandle(ref, () => ({
@@ -53,29 +78,29 @@ const Dropzone = forwardRef(function Dropzone ({
5378
return () => input.removeEventListener('cancel', handler)
5479
}, [onFileDialogCancel])
5580

56-
const handleClick = (e) => {
81+
const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {
5782
if (disabled) return
5883
// Avoid recursive click when the synthetic click bubbles from the hidden input itself.
5984
if (e.target === inputRef.current) return
6085
inputRef.current && inputRef.current.click()
6186
}
6287

63-
const handleInputChange = (e) => {
88+
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
6489
const files = Array.from(e.target.files || [])
6590
if (!disabled && files.length && onDrop) onDrop(filterByAccept(files, accept))
6691
// Reset so picking the same file again still triggers `change`.
6792
e.target.value = ''
6893
}
6994

70-
const handleDragEnter = (e) => {
95+
const handleDragEnter = (e: React.DragEvent<HTMLDivElement>) => {
7196
e.preventDefault()
7297
e.stopPropagation()
7398
if (disabled) return
7499
dragCounter.current += 1
75100
if (dragCounter.current === 1 && onDragEnter) onDragEnter(e)
76101
}
77102

78-
const handleDragLeave = (e) => {
103+
const handleDragLeave = (e: React.DragEvent<HTMLDivElement>) => {
79104
e.preventDefault()
80105
e.stopPropagation()
81106
if (disabled) {
@@ -87,14 +112,14 @@ const Dropzone = forwardRef(function Dropzone ({
87112
if (dragCounter.current === 0 && onDragLeave) onDragLeave(e)
88113
}
89114

90-
const handleDragOver = (e) => {
115+
const handleDragOver = (e: React.DragEvent<HTMLDivElement>) => {
91116
e.preventDefault()
92117
e.stopPropagation()
93118
if (disabled) return
94119
if (e.dataTransfer) e.dataTransfer.dropEffect = 'copy'
95120
}
96121

97-
const handleDrop = (e) => {
122+
const handleDrop = (e: React.DragEvent<HTMLDivElement>) => {
98123
e.preventDefault()
99124
e.stopPropagation()
100125
dragCounter.current = 0
@@ -127,21 +152,21 @@ const Dropzone = forwardRef(function Dropzone ({
127152
{children}
128153
</div>
129154
)
130-
})
155+
}) as React.ForwardRefExoticComponent<DropzoneProps & React.RefAttributes<DropzoneHandle>>
131156

132157
export default Dropzone
133158

134159
// Extensions whose spelling differs from the MIME subtype they map to.
135-
const EXTENSION_TYPE_ALIASES = {jpg: 'jpeg', jpeg: 'jpg', tif: 'tiff', tiff: 'tif', htm: 'html', html: 'htm'}
160+
const EXTENSION_TYPE_ALIASES: Record<string, string | undefined> = {jpg: 'jpeg', jpeg: 'jpg', tif: 'tiff', tiff: 'tif', htm: 'html', html: 'htm'}
136161

137162
/** Whether a browser-reported MIME type corresponds to an extension pattern such as `.jpeg` */
138-
function typeMatchesExtension (type, extension) {
163+
function typeMatchesExtension (type: string, extension: string) {
139164
const subtype = type.split('/')[1]
140165
if (!subtype) return false
141166
return subtype === extension || EXTENSION_TYPE_ALIASES[extension] === subtype
142167
}
143168

144-
function filterByAccept (files, accept) {
169+
function filterByAccept (files: File[], accept?: string) {
145170
if (!accept) return files
146171
const patterns = String(accept).split(',').map((s) => s.trim().toLowerCase()).filter(Boolean)
147172
if (!patterns.length) return files

‎src/core/components/InputNative.tsx‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import PropTypes from 'prop-types'
22
import React, { useCallback, useEffect, useLayoutEffect, useRef } from 'react'
33
import { noSpellCheck, resizeToContent, toTextHeight, toTextHeightFunc } from './renders'
44
import Select from './Select'
5+
import type { SelectProps } from './Select'
56
import { ENGINE_PROPS, omitProps } from './domProps'
67

78
/**
@@ -17,7 +18,9 @@ export type InputNativeElement = HTMLInputElement | HTMLTextAreaElement
1718
* It has to be stated separately from `InputNativeProps` because the two disagree on purpose:
1819
* `InputNativeProps.onChange` is the ENGINE callback `(value, name, event)`, while the bag spread
1920
* onto `<input>`/`<textarea>` always carries a DOM handler instead — the render overwrites the key
20-
* on every branch before spreading. The cast at the `omitProps` call is where that swap happens.
21+
* on every branch that spreads onto an element. The cast at the `omitProps` call is where that swap
22+
* happens. The `select` branch is the exception: it hands the bag to `Select` with the engine
23+
* callback still in it, which is the signature `Select` reports with.
2124
*/
2225
type ForwardedProps =
2326
Omit<
@@ -181,7 +184,9 @@ function InputNative (props: InputNativeProps) {
181184
if (compact != null) forwarded.ref = onMountResize
182185
switch (forwarded.type) {
183186
case 'select':
184-
return <Select {...forwarded} />
187+
// A cast: the engine `onChange` is still in the bag here, as `Select` wants it (see
188+
// `ForwardedProps`), and `options` rides in with the rest of the field's props.
189+
return <Select {...(forwarded as unknown as SelectProps)} />
185190
case 'checkbox':
186191
forwarded.onChange = onChangeCheckbox
187192
if (forwarded.checked == null && forwarded.value != null) forwarded.checked = forwarded.value

0 commit comments

Comments
 (0)