Replace prop-types with TypeScript types in widget editors - #3858
Replace prop-types with TypeScript types in widget editors#3858jeremywiebe wants to merge 28 commits into
Conversation
|
Size Change: -1.01 kB (-0.2%) Total Size: 516 kB 📦 View Changed
ℹ️ View Unchanged
|
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (4c97b2a) and published it to npm. You Example: pnpm add @khanacademy/perseus@PR3858If you are working in Khan Academy's frontend, you can run the below command. ./dev/tools/bump_perseus_version.ts -t PR3858If you are working in Khan Academy's webapp, you can run the below command. ./dev/tools/bump_perseus_version.js -t PR3858 |
…pes in widget editors
…-disable from interactive-graph-settings
…es in NumberInput
…es in TextListEditor; narrow options to string[]
…es in SimpleKeypadInput; remove rest-prop spread
…settings to remove defunct id prop
…es in matcher-editor
…es in matrix-editor
…es in measurer-editor
…es in molecule-editor
…es in number-line-editor
…es in numeric-input-editor
…es in orderer-editor
…es in sorter-editor
089c430 to
789fde9
Compare
|
/snapshot |
…abels are a 2-element array
789fde9 to
dab9f6c
Compare
|
/snapshot |
| <label htmlFor="canvas-size"> | ||
| Canvas size (x,y pixels) | ||
| </label> | ||
| {/* eslint-disable-next-line jsx-a11y/label-has-associated-control -- TODO(LEMS-2871): Address a11y error */} |
There was a problem hiding this comment.
The RangeInput doesn't apply the id prop we pass it to anything. It also provides a start/end label for each input it renders so linking a label here is un-helpful.
Maybe there's a better way to address the labelling a11y issue? Avoid making this a <label>?
…ipt types in molecule-editor
…ipt types in measurer-editor
…ipt types in matrix-editor
…ript types in widget editors
… at editor entry points; thread APIOptionsWithDefaults through editor chain
| render(<Harnessed apiOptions={{editingDisabled: true}} />); | ||
| render( | ||
| <Harnessed | ||
| apiOptions={{...ApiOptions.defaults, editingDisabled: true}} |
There was a problem hiding this comment.
With the removal of prop-types, it's become apparent that we were a bit loose with the types APIOptions vs. APIOptionsWithDefaults.
The Editor now accepts APIOptionsWithDefaults because it's used internally and (should) always be provided APIOptionsWithDefaults.
| onChange={(cat) => { | ||
| // @ts-expect-error - TS2554 - Expected 3 arguments, but got 2. | ||
| this.change("categories", cat); | ||
| this.props.onChange({categories: cat}); |
There was a problem hiding this comment.
this.change() and Changeable are both a pain... this is simpler and clearer!
4e55a85 to
25fc506
Compare
Summary:
Issue: LEMS-XXXX
Test plan: