Skip to content

Replace prop-types with TypeScript types in widget editors - #3858

Draft
jeremywiebe wants to merge 28 commits into
mainfrom
claude/stupefied-gates-c80d2e
Draft

Replace prop-types with TypeScript types in widget editors#3858
jeremywiebe wants to merge 28 commits into
mainfrom
claude/stupefied-gates-c80d2e

Conversation

@jeremywiebe

Copy link
Copy Markdown
Collaborator

Summary:

Issue: LEMS-XXXX

Test plan:

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Size Change: -1.01 kB (-0.2%)

Total Size: 516 kB

📦 View Changed
Filename Size Change
packages/math-input/dist/es/index.js 98.5 kB -81 B (-0.08%)
packages/perseus-core/dist/es/index.item-splitting.js 12.9 kB +1 B (+0.01%)
packages/perseus-editor/dist/es/index.js 104 kB -603 B (-0.58%)
packages/perseus/dist/es/index.js 204 kB -329 B (-0.16%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 20.6 kB
packages/keypad-context/dist/es/index.js 1 kB
packages/kmath/dist/es/index.js 6.31 kB
packages/math-input/dist/es/strings.js 1.63 kB
packages/perseus-core/dist/es/index.js 27.7 kB
packages/perseus-linter/dist/es/index.js 9.79 kB
packages/perseus-score/dist/es/index.js 9.86 kB
packages/perseus-utils/dist/es/index.js 403 B
packages/perseus/dist/es/strings.js 12.4 kB
packages/pure-markdown/dist/es/index.js 1.39 kB
packages/simple-markdown/dist/es/index.js 6.71 kB

compressed-size-action

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

npm Snapshot: Published

Good news!! We've packaged up the latest commit from this PR (4c97b2a) and published it to npm. You
can install it using the tag PR3858.

Example:

pnpm add @khanacademy/perseus@PR3858

If you are working in Khan Academy's frontend, you can run the below command.

./dev/tools/bump_perseus_version.ts -t PR3858

If you are working in Khan Academy's webapp, you can run the below command.

./dev/tools/bump_perseus_version.js -t PR3858

…es in TextListEditor; narrow options to string[]
…es in SimpleKeypadInput; remove rest-prop spread
@jeremywiebe
jeremywiebe force-pushed the claude/stupefied-gates-c80d2e branch from 089c430 to 789fde9 Compare July 9, 2026 20:36
@jeremywiebe

Copy link
Copy Markdown
Collaborator Author

/snapshot

@jeremywiebe
jeremywiebe force-pushed the claude/stupefied-gates-c80d2e branch from 789fde9 to dab9f6c Compare July 9, 2026 20:41
@jeremywiebe

Copy link
Copy Markdown
Collaborator Author

/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 */}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>?

render(<Harnessed apiOptions={{editingDisabled: true}} />);
render(
<Harnessed
apiOptions={{...ApiOptions.defaults, editingDisabled: true}}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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});

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.change() and Changeable are both a pain... this is simpler and clearer!

@jeremywiebe
jeremywiebe force-pushed the claude/stupefied-gates-c80d2e branch from 4e55a85 to 25fc506 Compare July 10, 2026 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant