@khanacademy/perseus-editor 2.6.1 → 2.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/article-editor.d.ts +1 -2
  3. package/dist/components/form-wrapped-text-field.d.ts +1 -10
  4. package/dist/components/graph-points-count-selector.d.ts +1 -1
  5. package/dist/es/index.js +373 -364
  6. package/dist/es/index.js.map +1 -1
  7. package/dist/index.js +375 -366
  8. package/dist/index.js.map +1 -1
  9. package/dist/widgets/input-number-editor.d.ts +1 -2
  10. package/dist/widgets/interactive-graph-editor.d.ts +140 -139
  11. package/package.json +12 -12
  12. package/src/__stories__/editor.stories.tsx +3 -1
  13. package/src/__tests__/i18n.test.ts +1 -1
  14. package/src/article-editor.tsx +13 -14
  15. package/src/components/checkbox.tsx +1 -1
  16. package/src/components/dropdown-option.tsx +12 -12
  17. package/src/components/form-wrapped-text-field.tsx +4 -2
  18. package/src/components/graph-points-count-selector.tsx +3 -1
  19. package/src/components/graph-settings.tsx +1 -1
  20. package/src/components/hover-behavior.ts +2 -2
  21. package/src/components/json-editor.tsx +2 -2
  22. package/src/components/sortable.tsx +1 -1
  23. package/src/components/util.ts +1 -1
  24. package/src/components/widget-editor.tsx +7 -7
  25. package/src/diffs/__tests__/structured-item-diff.test.ts +8 -8
  26. package/src/diffs/renderer-diff.tsx +3 -3
  27. package/src/diffs/split-diff.ts +2 -2
  28. package/src/diffs/structured-item-diff.tsx +10 -10
  29. package/src/diffs/text-diff.tsx +1 -1
  30. package/src/diffs/widget-diff.tsx +2 -2
  31. package/src/editor-page.tsx +8 -8
  32. package/src/editor.tsx +36 -36
  33. package/src/hint-editor.tsx +27 -27
  34. package/src/i18n.ts +4 -4
  35. package/src/iframe-content-renderer.tsx +10 -10
  36. package/src/item-editor.tsx +4 -4
  37. package/src/multirenderer-editor.tsx +17 -11
  38. package/src/widgets/categorizer-editor.tsx +3 -3
  39. package/src/widgets/cs-program-editor.tsx +2 -2
  40. package/src/widgets/definition-editor.tsx +2 -2
  41. package/src/widgets/dropdown-editor.tsx +8 -8
  42. package/src/widgets/example-graphie-widget-editor.tsx +1 -1
  43. package/src/widgets/example-graphie-widget.tsx +2 -2
  44. package/src/widgets/example-widget-editor.tsx +2 -2
  45. package/src/widgets/example-widget.tsx +3 -3
  46. package/src/widgets/explanation-editor.tsx +3 -3
  47. package/src/widgets/expression-editor.tsx +9 -9
  48. package/src/widgets/graded-group-editor.tsx +6 -6
  49. package/src/widgets/graded-group-set-editor.tsx +3 -3
  50. package/src/widgets/grapher-editor.tsx +2 -2
  51. package/src/widgets/group-editor.tsx +3 -3
  52. package/src/widgets/iframe-editor.tsx +4 -4
  53. package/src/widgets/input-number-editor.tsx +6 -6
  54. package/src/widgets/interaction-editor.tsx +102 -102
  55. package/src/widgets/interactive-graph-editor.tsx +12 -8
  56. package/src/widgets/label-image/marker.tsx +1 -1
  57. package/src/widgets/label-image/question-markers.tsx +1 -1
  58. package/src/widgets/lights-puzzle-editor.tsx +4 -4
  59. package/src/widgets/matrix-editor.tsx +2 -2
  60. package/src/widgets/measurer-editor.tsx +6 -6
  61. package/src/widgets/molecule-editor.tsx +2 -2
  62. package/src/widgets/number-line-editor.tsx +1 -1
  63. package/src/widgets/numeric-input-editor.tsx +2 -2
  64. package/src/widgets/orderer-editor.tsx +2 -2
  65. package/src/widgets/passage-editor.tsx +3 -3
  66. package/src/widgets/passage-ref-editor.tsx +3 -3
  67. package/src/widgets/passage-ref-target-editor.tsx +1 -1
  68. package/src/widgets/plotter-editor.tsx +4 -4
  69. package/src/widgets/radio/editor.tsx +3 -3
  70. package/src/widgets/reaction-diagram-editor.tsx +5 -5
  71. package/src/widgets/sequence-editor.tsx +1 -1
  72. package/src/widgets/simple-markdown-tester-editor.tsx +3 -3
  73. package/src/widgets/simple-markdown-tester.tsx +2 -2
  74. package/src/widgets/simulator-editor.tsx +1 -1
  75. package/src/widgets/sorter-editor.tsx +1 -1
  76. package/src/widgets/table-editor.tsx +1 -1
  77. package/src/widgets/transformer-editor.tsx +10 -10
  78. package/src/widgets/unit-editor.tsx +5 -5
  79. package/tsconfig-build.tsbuildinfo +1 -1
  80. package/dist/all-editors.js.flow +0 -8
  81. package/dist/all-widgets.js.flow +0 -34
  82. package/dist/article-editor.js.flow +0 -72
  83. package/dist/components/blur-input.js.flow +0 -25
  84. package/dist/components/checkbox.js.flow +0 -26
  85. package/dist/components/device-framer.js.flow +0 -20
  86. package/dist/components/drag-target.js.flow +0 -8
  87. package/dist/components/dropdown-option.js.flow +0 -49
  88. package/dist/components/form-wrapped-text-field.js.flow +0 -45
  89. package/dist/components/graph-points-count-selector.js.flow +0 -12
  90. package/dist/components/graph-settings.js.flow +0 -8
  91. package/dist/components/graph-type-selector.js.flow +0 -12
  92. package/dist/components/hover-behavior.js.flow +0 -48
  93. package/dist/components/json-editor.js.flow +0 -8
  94. package/dist/components/link.js.flow +0 -50
  95. package/dist/components/section-control-button.js.flow +0 -25
  96. package/dist/components/segment-count-selector.js.flow +0 -11
  97. package/dist/components/simple-button.js.flow +0 -18
  98. package/dist/components/sortable.js.flow +0 -8
  99. package/dist/components/util.js.flow +0 -9
  100. package/dist/components/viewport-resizer.js.flow +0 -22
  101. package/dist/components/widget-editor.js.flow +0 -91
  102. package/dist/components/widget-select.js.flow +0 -16
  103. package/dist/diffs/article-diff.js.flow +0 -71
  104. package/dist/diffs/item-diff.js.flow +0 -41
  105. package/dist/diffs/renderer-diff.js.flow +0 -25
  106. package/dist/diffs/split-diff.js.flow +0 -8
  107. package/dist/diffs/string-array-diff.js.flow +0 -11
  108. package/dist/diffs/structured-item-diff.js.flow +0 -37
  109. package/dist/diffs/tags-diff.js.flow +0 -24
  110. package/dist/diffs/text-diff.js.flow +0 -21
  111. package/dist/diffs/widget-diff-performer.js.flow +0 -8
  112. package/dist/diffs/widget-diff.js.flow +0 -31
  113. package/dist/editor-page.js.flow +0 -72
  114. package/dist/editor.js.flow +0 -96
  115. package/dist/hint-editor.js.flow +0 -87
  116. package/dist/i18n.js.flow +0 -13
  117. package/dist/iframe-content-renderer.js.flow +0 -28
  118. package/dist/index.js.flow +0 -23
  119. package/dist/item-editor.js.flow +0 -46
  120. package/dist/item-extras-editor.js.flow +0 -23
  121. package/dist/katex-error-view.js.flow +0 -24
  122. package/dist/multirenderer-editor.js.flow +0 -46
  123. package/dist/stateful-article-editor.js.flow +0 -16
  124. package/dist/stateful-editor-page.js.flow +0 -8
  125. package/dist/testing-widgets.js.flow +0 -34
  126. package/dist/util/points.js.flow +0 -9
  127. package/dist/util/register-all-widgets-and-editors-for-testing.js.flow +0 -7
  128. package/dist/widgets/categorizer-editor.js.flow +0 -62
  129. package/dist/widgets/cs-program-editor.js.flow +0 -25
  130. package/dist/widgets/definition-editor.js.flow +0 -23
  131. package/dist/widgets/dropdown-editor.js.flow +0 -37
  132. package/dist/widgets/example-graphie-widget-editor.js.flow +0 -25
  133. package/dist/widgets/example-graphie-widget.js.flow +0 -102
  134. package/dist/widgets/example-widget-editor.js.flow +0 -26
  135. package/dist/widgets/example-widget.js.flow +0 -86
  136. package/dist/widgets/explanation-editor.js.flow +0 -27
  137. package/dist/widgets/expression-editor.js.flow +0 -43
  138. package/dist/widgets/graded-group-editor.js.flow +0 -68
  139. package/dist/widgets/graded-group-set-editor.js.flow +0 -66
  140. package/dist/widgets/grapher-editor.js.flow +0 -21
  141. package/dist/widgets/group-editor.js.flow +0 -64
  142. package/dist/widgets/iframe-editor.js.flow +0 -24
  143. package/dist/widgets/image-editor.js.flow +0 -8
  144. package/dist/widgets/input-number-editor.js.flow +0 -77
  145. package/dist/widgets/interaction/constraint-editor.js.flow +0 -35
  146. package/dist/widgets/interaction-editor.js.flow +0 -36
  147. package/dist/widgets/interactive-graph-editor.js.flow +0 -5803
  148. package/dist/widgets/label-image/answer-choices.js.flow +0 -16
  149. package/dist/widgets/label-image/behavior.js.flow +0 -17
  150. package/dist/widgets/label-image/marker.js.flow +0 -32
  151. package/dist/widgets/label-image/question-markers.js.flow +0 -23
  152. package/dist/widgets/label-image/select-image.js.flow +0 -13
  153. package/dist/widgets/label-image-editor.js.flow +0 -44
  154. package/dist/widgets/lights-puzzle-editor.js.flow +0 -34
  155. package/dist/widgets/matcher-editor.js.flow +0 -28
  156. package/dist/widgets/matrix-editor.js.flow +0 -26
  157. package/dist/widgets/measurer-editor.js.flow +0 -42
  158. package/dist/widgets/molecule-editor.js.flow +0 -23
  159. package/dist/widgets/number-line-editor.js.flow +0 -45
  160. package/dist/widgets/numeric-input-editor.js.flow +0 -8
  161. package/dist/widgets/orderer-editor.js.flow +0 -30
  162. package/dist/widgets/passage-editor.js.flow +0 -24
  163. package/dist/widgets/passage-ref-editor.js.flow +0 -17
  164. package/dist/widgets/passage-ref-target-editor.js.flow +0 -22
  165. package/dist/widgets/plotter-editor.js.flow +0 -75
  166. package/dist/widgets/radio/editor.js.flow +0 -81
  167. package/dist/widgets/reaction-diagram-editor.js.flow +0 -26
  168. package/dist/widgets/sequence-editor.js.flow +0 -73
  169. package/dist/widgets/simple-markdown-tester-editor.js.flow +0 -23
  170. package/dist/widgets/simple-markdown-tester.js.flow +0 -61
  171. package/dist/widgets/simulator-editor.js.flow +0 -26
  172. package/dist/widgets/sorter-editor.js.flow +0 -22
  173. package/dist/widgets/table-editor.js.flow +0 -24
  174. package/dist/widgets/transformer-editor.js.flow +0 -17
  175. package/dist/widgets/unit-editor.js.flow +0 -41
  176. package/dist/widgets/video-editor.js.flow +0 -25
@@ -51,7 +51,7 @@ class ItemEditor extends React.Component<Props> {
51
51
 
52
52
  triggerPreviewUpdate: (newData?: any) => void = (newData: any) => {
53
53
  // eslint-disable-next-line react/no-string-refs
54
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'sendNewData' does not exist on type 'ReactInstance'.
54
+ // @ts-expect-error - TS2339 - Property 'sendNewData' does not exist on type 'ReactInstance'.
55
55
  this.refs.frame.sendNewData(newData);
56
56
  };
57
57
 
@@ -67,7 +67,7 @@ class ItemEditor extends React.Component<Props> {
67
67
 
68
68
  getSaveWarnings: () => any = () => {
69
69
  // eslint-disable-next-line react/no-string-refs
70
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
70
+ // @ts-expect-error - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
71
71
  return this.refs.questionEditor.getSaveWarnings();
72
72
  };
73
73
 
@@ -81,10 +81,10 @@ class ItemEditor extends React.Component<Props> {
81
81
  } = (options: any) => {
82
82
  return {
83
83
  // eslint-disable-next-line react/no-string-refs
84
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
84
+ // @ts-expect-error - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
85
85
  question: this.refs.questionEditor.serialize(options),
86
86
  // eslint-disable-next-line react/no-string-refs
87
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
87
+ // @ts-expect-error - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
88
88
  answerArea: this.refs.itemExtrasEditor.serialize(options),
89
89
  itemDataVersion: ITEM_DATA_VERSION,
90
90
  };
@@ -274,7 +274,7 @@ const LeafContainer = ({
274
274
  const hasPreviewHeading = shape.type === "content" || shape.type === "hint";
275
275
  const previewHeading = hasPreviewHeading && (
276
276
  <div className={css(styles.containerHeader)}>
277
- {/* @ts-expect-error [FEI-5003] - TS2322 - Type '{ children: string; depth: number; className: string; }' is not assignable to type 'IntrinsicAttributes & HeaderProps & { children?: ReactNode; }'. */}
277
+ {/* @ts-expect-error - TS2322 - Type '{ children: string; depth: number; className: string; }' is not assignable to type 'IntrinsicAttributes & HeaderProps & { children?: ReactNode; }'. */}
278
278
  <Header depth={path.length} className={css(styles.containerTitle)}>
279
279
  {capitalize(name)}
280
280
  </Header>
@@ -349,7 +349,7 @@ const ObjectContainer = ({
349
349
  }: ObjectContainerProps): React.ReactElement => {
350
350
  const headingEditor = (
351
351
  <div className={css(styles.containerHeader)}>
352
- {/* @ts-expect-error [FEI-5003] - TS2322 - Type '{ children: string; depth: number; className: string; }' is not assignable to type 'IntrinsicAttributes & HeaderProps & { children?: ReactNode; }'. */}
352
+ {/* @ts-expect-error - TS2322 - Type '{ children: string; depth: number; className: string; }' is not assignable to type 'IntrinsicAttributes & HeaderProps & { children?: ReactNode; }'. */}
353
353
  <Header depth={path.length} className={css(styles.containerTitle)}>
354
354
  {capitalize(name)}
355
355
  </Header>
@@ -363,7 +363,7 @@ const ObjectContainer = ({
363
363
  styles.previewCollectionHeader,
364
364
  )}
365
365
  >
366
- {/* @ts-expect-error [FEI-5003] - TS2322 - Type '{ children: string; depth: number; className: string; }' is not assignable to type 'IntrinsicAttributes & HeaderProps & { children?: ReactNode; }'. */}
366
+ {/* @ts-expect-error - TS2322 - Type '{ children: string; depth: number; className: string; }' is not assignable to type 'IntrinsicAttributes & HeaderProps & { children?: ReactNode; }'. */}
367
367
  <Header depth={path.length} className={css(styles.containerTitle)}>
368
368
  {capitalize(name)}
369
369
  </Header>
@@ -478,7 +478,7 @@ const withStickiness = <
478
478
  sticky: boolean;
479
479
  };
480
480
  return class StickyComponent extends React.Component<Config, State> {
481
- // @ts-expect-error [FEI-5003] - TS2564 - Property 'stickynessTimer' has no initializer and is not definitely assigned in the constructor.
481
+ // @ts-expect-error - TS2564 - Property 'stickynessTimer' has no initializer and is not definitely assigned in the constructor.
482
482
  stickynessTimer: number;
483
483
 
484
484
  state = {
@@ -488,7 +488,7 @@ const withStickiness = <
488
488
  componentDidMount() {
489
489
  // TODO(jeff, CP-3128): Use Wonder Blocks Timing API.
490
490
  // eslint-disable-next-line no-restricted-syntax
491
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'Timer' is not assignable to type 'number'.
491
+ // @ts-expect-error - TS2322 - Type 'Timer' is not assignable to type 'number'.
492
492
  this.stickynessTimer = setInterval(this.updateStickiness, 1000);
493
493
  this.updateStickiness();
494
494
  }
@@ -501,7 +501,7 @@ const withStickiness = <
501
501
 
502
502
  updateStickiness = () => {
503
503
  const domNode = ReactDOM.findDOMNode(this);
504
- // @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'offsetHeight' does not exist on type 'Element | Text'.
504
+ // @ts-expect-error - TS2531 - Object is possibly 'null'. | TS2339 - Property 'offsetHeight' does not exist on type 'Element | Text'.
505
505
  const height = domNode.offsetHeight;
506
506
  const windowHeight = window.innerHeight;
507
507
  const sticky = height > windowHeight;
@@ -514,7 +514,7 @@ const withStickiness = <
514
514
 
515
515
  render(): React.ReactNode {
516
516
  return (
517
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'Readonly<Config> & { sticky: boolean; children?: ReactNode; }' is not assignable to type 'IntrinsicAttributes & LibraryManagedAttributes<Component, PropsWithChildren<WithStickiness<Config>>>'.
517
+ // @ts-expect-error - TS2322 - Type 'Readonly<Config> & { sticky: boolean; children?: ReactNode; }' is not assignable to type 'IntrinsicAttributes & LibraryManagedAttributes<Component, PropsWithChildren<WithStickiness<Config>>>'.
518
518
  <WrappedComponent {...this.props} sticky={this.state.sticky} />
519
519
  );
520
520
  }
@@ -536,7 +536,7 @@ const ItemNodeContent = withStickiness(
536
536
  <div className={css(sticky && styles.sticky)}>
537
537
  {/* TODO(CP-4852): only pass the props to Editor that it uses. */}
538
538
  {
539
- // @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
539
+ // @ts-expect-error - TS2769 - No overload matches this call.
540
540
  <Editor
541
541
  {...data}
542
542
  onChange={(newVal) =>
@@ -867,6 +867,12 @@ class MultiRendererEditor extends React.Component<MultiRendererEditorProps> {
867
867
  item={item}
868
868
  shape={itemShape}
869
869
  apiOptions={apiOptions}
870
+ // Today, with analytics being the only thing in
871
+ // dependencies, we send in a dummy function as we don't
872
+ // want to gather analytics events from within the editor.
873
+ dependencies={{
874
+ analytics: {onAnalyticsEvent: async () => {}},
875
+ }}
870
876
  >
871
877
  {({renderers}) => (
872
878
  <NodeContainer
@@ -885,21 +891,21 @@ class MultiRendererEditor extends React.Component<MultiRendererEditorProps> {
885
891
 
886
892
  score: () => any | undefined = () => {
887
893
  if (this.layout) {
888
- // @ts-expect-error [FEI-5003] - TS2571 - Object is of type 'unknown'.
894
+ // @ts-expect-error - TS2571 - Object is of type 'unknown'.
889
895
  return this.layout.score();
890
896
  }
891
897
  };
892
898
 
893
899
  getSerializedState: () => any | undefined = () => {
894
900
  if (this.layout) {
895
- // @ts-expect-error [FEI-5003] - TS2571 - Object is of type 'unknown'.
901
+ // @ts-expect-error - TS2571 - Object is of type 'unknown'.
896
902
  return this.layout.getSerializedState();
897
903
  }
898
904
  };
899
905
 
900
906
  restoreSerializedState: (state?: any) => void = (state: any) => {
901
907
  if (this.layout) {
902
- // @ts-expect-error [FEI-5003] - TS2571 - Object is of type 'unknown'.
908
+ // @ts-expect-error - TS2571 - Object is of type 'unknown'.
903
909
  this.layout.restoreSerializedState(state);
904
910
  }
905
911
  };
@@ -56,7 +56,7 @@ class CategorizerEditor extends React.Component<Props> {
56
56
  <TextListEditor
57
57
  options={this.props.categories}
58
58
  onChange={(cat) => {
59
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 2.
59
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 2.
60
60
  this.change("categories", cat);
61
61
  }}
62
62
  layout="horizontal"
@@ -65,7 +65,7 @@ class CategorizerEditor extends React.Component<Props> {
65
65
  <TextListEditor
66
66
  options={this.props.items}
67
67
  onChange={(items) => {
68
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
68
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
69
69
  this.change({
70
70
  items: items,
71
71
  // TODO(eater): This truncates props.values so there
@@ -84,7 +84,7 @@ class CategorizerEditor extends React.Component<Props> {
84
84
  {/* There are a bunch of props that renderer.jsx passes to each widget
85
85
  via widget-container.jsx that we aren't passing to Categorizer here.
86
86
  See perseus-all-package/types.js#WidgetProps for details. */}
87
- {/* @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call. */}
87
+ {/* @ts-expect-error - TS2769 - No overload matches this call. */}
88
88
  <Categorizer
89
89
  apiOptions={this.props.apiOptions}
90
90
  items={this.props.items}
@@ -156,7 +156,7 @@ class CSProgramEditor extends React.Component<any> {
156
156
  };
157
157
 
158
158
  change: (...args: ReadonlyArray<unknown>) => any = (...args) => {
159
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'readonly unknown[]' is not assignable to parameter of type 'any[]'.
159
+ // @ts-expect-error - TS2345 - Argument of type 'readonly unknown[]' is not assignable to parameter of type 'any[]'.
160
160
  return Changeable.change.apply(this, args);
161
161
  };
162
162
 
@@ -188,7 +188,7 @@ class CSProgramEditor extends React.Component<any> {
188
188
  "Error retrieving scratchpad info for program ID ",
189
189
  Errors.TransientService,
190
190
  {
191
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'string' is not assignable to type 'Error | null | undefined'.
191
+ // @ts-expect-error - TS2322 - Type 'string' is not assignable to type 'Error | null | undefined'.
192
192
  cause: error,
193
193
  loggedMetadata: {
194
194
  textStatus,
@@ -47,7 +47,7 @@ class DefinitionEditor extends React.Component<Props> {
47
47
  Word to be defined:{" "}
48
48
  <TextInput
49
49
  value={this.props.togglePrompt}
50
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
50
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
51
51
  onChange={this.change("togglePrompt")}
52
52
  placeholder="define me"
53
53
  />
@@ -64,7 +64,7 @@ class DefinitionEditor extends React.Component<Props> {
64
64
  if (_.has(props, "content")) {
65
65
  newProps.definition = props.content;
66
66
  }
67
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
67
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
68
68
  this.change(newProps);
69
69
  }}
70
70
  />
@@ -89,7 +89,7 @@ class DropdownEditor extends React.Component<Props> {
89
89
  };
90
90
 
91
91
  focus: (arg1: number) => boolean = (i) => {
92
- // @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'focus' does not exist on type 'Element | Text'.
92
+ // @ts-expect-error - TS2531 - Object is possibly 'null'. | TS2339 - Property 'focus' does not exist on type 'Element | Text'.
93
93
  ReactDOM.findDOMNode(this.refs["editor" + i]).focus(); // eslint-disable-line react/no-string-refs
94
94
  return true;
95
95
  };
@@ -144,14 +144,14 @@ class DropdownEditor extends React.Component<Props> {
144
144
  ref={"radio" + i}
145
145
  type="radio"
146
146
  name={dropdownGroupName}
147
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'string' is not assignable to type 'boolean | undefined'.
147
+ // @ts-expect-error - TS2322 - Type 'string' is not assignable to type 'boolean | undefined'.
148
148
  checked={
149
149
  choice.correct ? "checked" : ""
150
150
  }
151
151
  // eslint-disable-next-line react/jsx-no-bind
152
- // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
152
+ // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
153
153
  onChange={this.onCorrectChange.bind(
154
- // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
154
+ // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
155
155
  this,
156
156
  i,
157
157
  )}
@@ -161,9 +161,9 @@ class DropdownEditor extends React.Component<Props> {
161
161
  type="text"
162
162
  ref={"editor" + i}
163
163
  // eslint-disable-next-line react/jsx-no-bind
164
- // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
164
+ // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
165
165
  onChange={this.onContentChange.bind(
166
- // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
166
+ // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
167
167
  this,
168
168
  i,
169
169
  )}
@@ -175,9 +175,9 @@ class DropdownEditor extends React.Component<Props> {
175
175
  href="#"
176
176
  className="simple-button orange"
177
177
  // eslint-disable-next-line react/jsx-no-bind
178
- // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
178
+ // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
179
179
  onClick={this.removeChoice.bind(
180
- // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
180
+ // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
181
181
  this,
182
182
  i,
183
183
  )}
@@ -42,7 +42,7 @@ class ExampleGraphieWidgetEditor extends React.Component<Props> {
42
42
 
43
43
  handleChange: (arg1: any) => void = (newProps) => {
44
44
  if (newProps.coord) {
45
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
45
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
46
46
  this.change({
47
47
  correct: newProps.coord,
48
48
  });
@@ -21,7 +21,7 @@ import type {Coord, WidgetExports} from "@khanacademy/perseus";
21
21
 
22
22
  const {Graphie} = components;
23
23
 
24
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'MovablePoint' does not exist on type 'typeof Graphie'.
24
+ // @ts-expect-error - TS2339 - Property 'MovablePoint' does not exist on type 'typeof Graphie'.
25
25
  const MovablePoint = Graphie.MovablePoint;
26
26
 
27
27
  type Props = any;
@@ -121,7 +121,7 @@ class ExampleGraphieWidget extends React.Component<Props> {
121
121
  };
122
122
 
123
123
  movePoint: (arg1: Coord) => void = (newCoord) => {
124
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
124
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
125
125
  this.change({
126
126
  coord: newCoord,
127
127
  });
@@ -22,7 +22,7 @@ class ExampleWidgetEditor extends React.Component<Props> {
22
22
  handleAnswerChange: (arg1: React.ChangeEvent<HTMLInputElement>) => void = (
23
23
  event,
24
24
  ) => {
25
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
25
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
26
26
  this.change({
27
27
  correct: event.target.value,
28
28
  });
@@ -50,7 +50,7 @@ class ExampleWidgetEditor extends React.Component<Props> {
50
50
 
51
51
  focus: () => boolean = () => {
52
52
  // eslint-disable-next-line react/no-string-refs
53
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
53
+ // @ts-expect-error - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
54
54
  this.refs.input.focus();
55
55
  return true;
56
56
  };
@@ -29,7 +29,7 @@ class TextInput extends React.Component<any> {
29
29
 
30
30
  focus = () => {
31
31
  // eslint-disable-next-line react/no-string-refs
32
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
32
+ // @ts-expect-error - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
33
33
  this.refs.input.focus();
34
34
  return true;
35
35
  };
@@ -101,7 +101,7 @@ class ExampleWidget extends React.Component<any> {
101
101
  // eslint-disable-next-line react/no-string-refs
102
102
  ref="input"
103
103
  value={this.props.value}
104
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
104
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
105
105
  onChange={this.change("value")}
106
106
  />
107
107
  );
@@ -118,7 +118,7 @@ class ExampleWidget extends React.Component<any> {
118
118
  */
119
119
  focus: () => boolean = () => {
120
120
  // eslint-disable-next-line react/no-string-refs
121
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
121
+ // @ts-expect-error - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
122
122
  this.refs.input.focus();
123
123
  return true;
124
124
  };
@@ -49,7 +49,7 @@ class ExplanationEditor extends React.Component<Props, State> {
49
49
  Prompt to show explanation:{" "}
50
50
  <TextInput
51
51
  value={this.props.showPrompt}
52
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
52
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
53
53
  onChange={this.change("showPrompt")}
54
54
  />
55
55
  </label>
@@ -59,7 +59,7 @@ class ExplanationEditor extends React.Component<Props, State> {
59
59
  Prompt to hide explanation:{" "}
60
60
  <TextInput
61
61
  value={this.props.hidePrompt}
62
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
62
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
63
63
  onChange={this.change("hidePrompt")}
64
64
  />
65
65
  </label>
@@ -79,7 +79,7 @@ class ExplanationEditor extends React.Component<Props, State> {
79
79
  if (_.has(props, "widgets")) {
80
80
  newProps.widgets = props.widgets;
81
81
  }
82
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
82
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
83
83
  this.change(newProps);
84
84
  }}
85
85
  />
@@ -337,14 +337,14 @@ class ExpressionEditor extends React.Component<any, any> {
337
337
  newAnswer: () => void = () => {
338
338
  const answerForms = this.props.answerForms.slice();
339
339
  answerForms.push(this._newEmptyAnswerForm());
340
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
340
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
341
341
  this.change({answerForms});
342
342
  };
343
343
 
344
344
  handleRemoveForm: (arg1: number) => void = (i) => {
345
345
  const answerForms = this.props.answerForms.slice();
346
346
  answerForms.splice(i, 1);
347
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
347
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
348
348
  this.change({answerForms});
349
349
  };
350
350
 
@@ -355,7 +355,7 @@ class ExpressionEditor extends React.Component<any, any> {
355
355
  .merge([i], props)
356
356
  .freeze();
357
357
 
358
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
358
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
359
359
  this.change({answerForms});
360
360
  };
361
361
 
@@ -367,12 +367,12 @@ class ExpressionEditor extends React.Component<any, any> {
367
367
  "simplify",
368
368
  "value",
369
369
  );
370
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'key' does not exist on type 'Pick<any, "form" | "value" | "simplify" | "considered">'.
370
+ // @ts-expect-error - TS2339 - Property 'key' does not exist on type 'Pick<any, "form" | "value" | "simplify" | "considered">'.
371
371
  form.key = component.key;
372
372
  return form;
373
373
  });
374
374
 
375
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
375
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
376
376
  this.change({answerForms});
377
377
  };
378
378
 
@@ -410,14 +410,14 @@ class ExpressionEditor extends React.Component<any, any> {
410
410
  .reject((set) => set === remove)
411
411
  .concat(keep);
412
412
 
413
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 2.
413
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 2.
414
414
  this.change("buttonSets", buttonSets);
415
415
  };
416
416
 
417
417
  // called when the correct answer changes
418
418
  handleTexInsert: (arg1: string) => void = (str) => {
419
419
  // eslint-disable-next-line react/no-string-refs
420
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'insert' does not exist on type 'ReactInstance'.
420
+ // @ts-expect-error - TS2339 - Property 'insert' does not exist on type 'ReactInstance'.
421
421
  this.refs.expression.insert(str);
422
422
  };
423
423
 
@@ -468,7 +468,7 @@ class AnswerOption extends React.Component<any, any> {
468
468
  render(): React.ReactNode {
469
469
  let removeButton = null;
470
470
  if (this.state.deleteFocused) {
471
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'Element' is not assignable to type 'null'.
471
+ // @ts-expect-error - TS2322 - Type 'Element' is not assignable to type 'null'.
472
472
  removeButton = (
473
473
  <button
474
474
  type="button"
@@ -480,7 +480,7 @@ class AnswerOption extends React.Component<any, any> {
480
480
  </button>
481
481
  );
482
482
  } else {
483
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'Element' is not assignable to type 'null'.
483
+ // @ts-expect-error - TS2322 - Type 'Element' is not assignable to type 'null'.
484
484
  removeButton = (
485
485
  <button
486
486
  type="button"
@@ -41,7 +41,7 @@ class GradedGroupEditor extends React.Component<Props> {
41
41
  const hint = {content: ""} as const;
42
42
  this.props.onChange({hint}, () => {
43
43
  // eslint-disable-next-line react/no-string-refs
44
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
44
+ // @ts-expect-error - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
45
45
  this.refs["hint-editor"].focus();
46
46
  });
47
47
  };
@@ -59,7 +59,7 @@ class GradedGroupEditor extends React.Component<Props> {
59
59
  <TextInput
60
60
  value={this.props.title}
61
61
  className={css(styles.input)}
62
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
62
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
63
63
  onChange={this.change("title")}
64
64
  />
65
65
  </label>
@@ -106,7 +106,7 @@ class GradedGroupEditor extends React.Component<Props> {
106
106
  onChange={(props) => {
107
107
  // Copy all props over from the existing hint
108
108
  // and then add new props.
109
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 2.
109
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 2.
110
110
  this.change(
111
111
  "hint",
112
112
  Object.assign({}, this.props.hint, props),
@@ -128,7 +128,7 @@ class GradedGroupEditor extends React.Component<Props> {
128
128
 
129
129
  getSaveWarnings: () => any = () => {
130
130
  // eslint-disable-next-line react/no-string-refs
131
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
131
+ // @ts-expect-error - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
132
132
  return this.refs.editor.getSaveWarnings();
133
133
  };
134
134
 
@@ -139,13 +139,13 @@ class GradedGroupEditor extends React.Component<Props> {
139
139
  return {
140
140
  title: this.props.title,
141
141
  // eslint-disable-next-line react/no-string-refs
142
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
142
+ // @ts-expect-error - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
143
143
  ...this.refs.editor.serialize(),
144
144
  hint:
145
145
  // eslint-disable-next-line react/no-string-refs
146
146
  this.refs["hint-editor"] &&
147
147
  // eslint-disable-next-line react/no-string-refs
148
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
148
+ // @ts-expect-error - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
149
149
  this.refs["hint-editor"].serialize(),
150
150
  };
151
151
  };
@@ -9,7 +9,7 @@ import GradedGroupEditor from "./graded-group-editor";
9
9
  type Props = any;
10
10
 
11
11
  class GradedGroupSetEditor extends React.Component<Props> {
12
- // @ts-expect-error [FEI-5003] - TS2564 - Property '_editors' has no initializer and is not definitely assigned in the constructor.
12
+ // @ts-expect-error - TS2564 - Property '_editors' has no initializer and is not definitely assigned in the constructor.
13
13
  _editors: Array<any>;
14
14
 
15
15
  static propTypes = {
@@ -63,7 +63,7 @@ class GradedGroupSetEditor extends React.Component<Props> {
63
63
  widgetEnabled={true}
64
64
  immutableWidgets={false}
65
65
  onChange={(data) =>
66
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 2.
66
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 2.
67
67
  this.change(
68
68
  "gradedGroups",
69
69
  setArrayItem(this.props.gradedGroups, i, {
@@ -78,7 +78,7 @@ class GradedGroupSetEditor extends React.Component<Props> {
78
78
 
79
79
  addGroup: () => void = () => {
80
80
  const groups = this.props.gradedGroups || [];
81
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 2.
81
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 2.
82
82
  this.change(
83
83
  "gradedGroups",
84
84
  groups.concat([GradedGroupEditor.defaultProps]),
@@ -69,7 +69,7 @@ class GrapherEditor extends React.Component<Props> {
69
69
  // NOTE(jeremy): This editor doesn't pass in a bunch of
70
70
  // standard props that the Renderer provides normally (eg.
71
71
  // alignment, findWidgets, etc).
72
- // @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
72
+ // @ts-expect-error - TS2769 - No overload matches this call.
73
73
  <Grapher
74
74
  {...graphProps}
75
75
  apiOptions={this.props.apiOptions}
@@ -111,7 +111,7 @@ class GrapherEditor extends React.Component<Props> {
111
111
  rulerLabel={this.props.graph.rulerLabel}
112
112
  rulerTicks={this.props.graph.rulerTicks}
113
113
  showTooltips={this.props.graph.showTooltips}
114
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
114
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
115
115
  onChange={this.change("graph")}
116
116
  />
117
117
  <div className="perseus-widget-row">
@@ -58,7 +58,7 @@ class GroupEditor extends React.Component<Props> {
58
58
  return (
59
59
  <GroupMetadataEditor
60
60
  value={this.props.metadata}
61
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
61
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
62
62
  onChange={this.change("metadata")}
63
63
  />
64
64
  );
@@ -70,13 +70,13 @@ class GroupEditor extends React.Component<Props> {
70
70
 
71
71
  getSaveWarnings: () => ReadonlyArray<any> = () => {
72
72
  // eslint-disable-next-line react/no-string-refs
73
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
73
+ // @ts-expect-error - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
74
74
  return this.refs.editor.getSaveWarnings();
75
75
  };
76
76
 
77
77
  serialize: () => any = () => {
78
78
  // eslint-disable-next-line react/no-string-refs
79
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
79
+ // @ts-expect-error - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
80
80
  return _.extend({}, this.refs.editor.serialize(), {
81
81
  metadata: this.props.metadata,
82
82
  });
@@ -144,7 +144,7 @@ class IframeEditor extends React.Component<IframeEditorProps> {
144
144
  Url or Program ID:
145
145
  <BlurInput
146
146
  value={this.props.url}
147
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
147
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
148
148
  onChange={this.change("url")}
149
149
  />
150
150
  </label>
@@ -162,7 +162,7 @@ class IframeEditor extends React.Component<IframeEditorProps> {
162
162
  Width:
163
163
  <BlurInput
164
164
  value={this.props.width}
165
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
165
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
166
166
  onChange={this.change("width")}
167
167
  />
168
168
  </label>
@@ -170,7 +170,7 @@ class IframeEditor extends React.Component<IframeEditorProps> {
170
170
  Height:
171
171
  <BlurInput
172
172
  value={this.props.height}
173
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
173
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
174
174
  onChange={this.change("height")}
175
175
  />
176
176
  </label>
@@ -190,7 +190,7 @@ class IframeEditor extends React.Component<IframeEditorProps> {
190
190
  }
191
191
 
192
192
  handleSettingsChange: (arg1: any) => void = (settings) => {
193
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
193
+ // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
194
194
  this.change({settings: settings.pairs});
195
195
  };
196
196