@khanacademy/perseus-editor 2.6.1 → 2.6.2

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 +13 -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 +364 -364
  6. package/dist/es/index.js.map +1 -1
  7. package/dist/index.js +366 -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 +48 -47
  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 +11 -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
@@ -26,7 +26,7 @@ const findAndFocusElement = (component?: Element | null) => {
26
26
  const DOMNode: Element | Text | null | undefined =
27
27
  ReactDOM.findDOMNode(component);
28
28
  const button = DOMNode as HTMLInputElement;
29
- // @ts-expect-error [FEI-5003] - TS2774 - This condition will always return true since this function is always defined. Did you mean to call it instead?
29
+ // @ts-expect-error - TS2774 - This condition will always return true since this function is always defined. Did you mean to call it instead?
30
30
  if (button.focus) {
31
31
  focusWithChromeStickyFocusBugWorkaround(button);
32
32
  }
@@ -67,7 +67,7 @@ const check = `M10,3.8C10,4,9.9,4.2,9.8,4.3L5.1,8.9L4.3,9.8C4.2,9.9,4,10,3.8,10
67
67
  export const optionHeight = 30;
68
68
 
69
69
  class Option extends React.Component<Props> {
70
- // @ts-expect-error [FEI-5003] - TS2564 - Property 'node' has no initializer and is not definitely assigned in the constructor.
70
+ // @ts-expect-error - TS2564 - Property 'node' has no initializer and is not definitely assigned in the constructor.
71
71
  node: HTMLDivElement;
72
72
 
73
73
  handleKeyDown(event: any): void {
@@ -114,7 +114,7 @@ class Option extends React.Component<Props> {
114
114
 
115
115
  return (
116
116
  <button
117
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'HTMLButtonElement | null' is not assignable to type 'HTMLDivElement'.
117
+ // @ts-expect-error - TS2322 - Type 'HTMLButtonElement | null' is not assignable to type 'HTMLDivElement'.
118
118
  ref={(node) => (this.node = node)}
119
119
  value={value}
120
120
  role="menuitemradio"
@@ -124,14 +124,14 @@ class Option extends React.Component<Props> {
124
124
  disabled && styles.cursorDefault,
125
125
  hideFocusState && styles.noFocus,
126
126
  )}
127
- // @ts-expect-error [FEI-5003] - TS2322 - Type '(value: string) => void' is not assignable to type 'MouseEventHandler<HTMLButtonElement>'.
127
+ // @ts-expect-error - TS2322 - Type '(value: string) => void' is not assignable to type 'MouseEventHandler<HTMLButtonElement>'.
128
128
  onClick={(value: string) => {
129
129
  if (!disabled && onClick) {
130
- // @ts-expect-error [FEI-5003] - TS2554 - Expected 0 arguments, but got 1.
130
+ // @ts-expect-error - TS2554 - Expected 0 arguments, but got 1.
131
131
  onClick(value);
132
132
  }
133
133
  }}
134
- // @ts-expect-error [FEI-5003] - TS2322 - Type '(event: KeyboardEvent) => void' is not assignable to type 'KeyboardEventHandler<HTMLButtonElement>'.
134
+ // @ts-expect-error - TS2322 - Type '(event: KeyboardEvent) => void' is not assignable to type 'KeyboardEventHandler<HTMLButtonElement>'.
135
135
  onKeyDown={(event: KeyboardEvent) => this.handleKeyDown(event)}
136
136
  aria-disabled={disabled}
137
137
  aria-label={ariaLabel}
@@ -193,7 +193,7 @@ class OptionGroup extends React.Component<{
193
193
  // they're focused on in order to interact with the product!
194
194
  hideFocusState?: boolean;
195
195
  }> {
196
- // @ts-expect-error [FEI-5003] - TS2564 - Property 'focusedElement' has no initializer and is not definitely assigned in the constructor.
196
+ // @ts-expect-error - TS2564 - Property 'focusedElement' has no initializer and is not definitely assigned in the constructor.
197
197
  focusedElement: Element;
198
198
 
199
199
  componentDidMount() {
@@ -215,7 +215,7 @@ class OptionGroup extends React.Component<{
215
215
 
216
216
  return (
217
217
  <div
218
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'Window | null' is not assignable to type 'Top<string | number> | undefined'.
218
+ // @ts-expect-error - TS2322 - Type 'Window | null' is not assignable to type 'Top<string | number> | undefined'.
219
219
  style={{top}}
220
220
  className={css(
221
221
  styles.optionGroup,
@@ -223,7 +223,7 @@ class OptionGroup extends React.Component<{
223
223
  )}
224
224
  >
225
225
  {React.Children.map(children, (child, index) => {
226
- // @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'.
226
+ // @ts-expect-error - TS2532 - Object is possibly 'undefined'.
227
227
  const selected = selectedValues.includes(child.props.value);
228
228
 
229
229
  const reference =
@@ -231,13 +231,13 @@ class OptionGroup extends React.Component<{
231
231
  ? (node: Element) => (this.focusedElement = node)
232
232
  : null;
233
233
 
234
- // @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
234
+ // @ts-expect-error - TS2769 - No overload matches this call.
235
235
  return React.cloneElement(child, {
236
- // @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'.
236
+ // @ts-expect-error - TS2532 - Object is possibly 'undefined'.
237
237
  ...child.props,
238
238
  key: index,
239
239
  selected: selected,
240
- // @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'.
240
+ // @ts-expect-error - TS2532 - Object is possibly 'undefined'.
241
241
  onClick: () => onSelected(child.props.value),
242
242
  optionRenderer: optionRenderer,
243
243
  ref: reference,
@@ -8,11 +8,13 @@
8
8
  * If you need to handle `onSubmit`, please use <TextField> directly with your
9
9
  * own <form> that wraps all text fields in the form.
10
10
  **/
11
- import {globalStyles, components} from "@khanacademy/perseus";
11
+ import {globalStyles} from "@khanacademy/perseus";
12
12
  import Color from "@khanacademy/wonder-blocks-color";
13
13
  import {StyleSheet, css} from "aphrodite";
14
14
  import * as React from "react";
15
15
 
16
+ import type {components} from "@khanacademy/perseus";
17
+
16
18
  type Props = {
17
19
  // This id is used to tie the input field to the label that describes it.
18
20
  // TODO(diedra): Instead of passing in this id to connect the label and input
@@ -165,7 +167,7 @@ class FormWrappedTextField extends React.Component<PropsWithForwardRef, State> {
165
167
  <form
166
168
  className={css(...spanStyle)}
167
169
  style={extraStyles}
168
- // @ts-expect-error [FEI-5003] - TS2322 - Type '((arg1: ChangeEvent<HTMLInputElement>) => unknown) | ((e: Event) => void)' is not assignable to type 'FormEventHandler<HTMLFormElement> | undefined'.
170
+ // @ts-expect-error - TS2322 - Type '((arg1: ChangeEvent<HTMLInputElement>) => unknown) | ((e: Event) => void)' is not assignable to type 'FormEventHandler<HTMLFormElement> | undefined'.
169
171
  onSubmit={onSubmit || this.disableDefault}
170
172
  >
171
173
  {leftSideIcon && wrappedIcon}
@@ -1,6 +1,8 @@
1
1
  import * as React from "react";
2
2
 
3
- import {PointValue, UNLIMITED, parsePointCount} from "../util/points";
3
+ import {UNLIMITED, parsePointCount} from "../util/points";
4
+
5
+ import type {PointValue} from "../util/points";
4
6
 
5
7
  const GraphPointsCountSelector = ({
6
8
  numPoints = 1,
@@ -151,7 +151,7 @@ const GraphSettings = createReactClass({
151
151
  );
152
152
  };
153
153
 
154
- // @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'value' does not exist on type 'Element | Text'.
154
+ // @ts-expect-error - TS2531 - Object is possibly 'null'. | TS2339 - Property 'value' does not exist on type 'Element | Text'.
155
155
  const url = ReactDOM.findDOMNode(this.refs["bg-url"]).value; // eslint-disable-line react/no-string-refs
156
156
  if (url) {
157
157
  Util.getImageSize(url, (width, height) => {
@@ -87,9 +87,9 @@ export default class HoverBehavior extends React.Component<Props, State> {
87
87
  };
88
88
  }
89
89
 
90
- // @ts-expect-error [FEI-5003] - TS2564 - Property 'focusFlag' has no initializer and is not definitely assigned in the constructor.
90
+ // @ts-expect-error - TS2564 - Property 'focusFlag' has no initializer and is not definitely assigned in the constructor.
91
91
  focusFlag: boolean;
92
- // @ts-expect-error [FEI-5003] - TS2564 - Property 'waitingForClick' has no initializer and is not definitely assigned in the constructor.
92
+ // @ts-expect-error - TS2564 - Property 'waitingForClick' has no initializer and is not definitely assigned in the constructor.
93
93
  waitingForClick: boolean;
94
94
 
95
95
  handleClick: (e: React.MouseEvent) => void = (e: React.MouseEvent) => {
@@ -74,7 +74,7 @@ const JsonEditor: any = createReactClass({
74
74
  valid: true,
75
75
  },
76
76
  function () {
77
- // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
77
+ // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
78
78
  this.props.onChange(json);
79
79
  },
80
80
  );
@@ -105,7 +105,7 @@ const JsonEditor: any = createReactClass({
105
105
  valid: true,
106
106
  },
107
107
  function () {
108
- // @ts-expect-error [FEI-5003] - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
108
+ // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
109
109
  this.props.onChange(json);
110
110
  },
111
111
  );
@@ -79,7 +79,7 @@ const SortableArea = createReactClass({
79
79
  _setDragEvents: function () {
80
80
  this._dragItems = this._dragItems || [];
81
81
  const items =
82
- // @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'
82
+ // @ts-expect-error - TS2531 - Object is possibly 'null'
83
83
  ReactDOM.findDOMNode(this).querySelectorAll("[draggable=true]");
84
84
 
85
85
  const oldItems: Array<HTMLElement> = [];
@@ -33,6 +33,6 @@ export function focusWithChromeStickyFocusBugWorkaround(element: Element) {
33
33
  // this is an issue, however, so there isn't currently a way to out of the
34
34
  // `preventScroll` behavior.
35
35
 
36
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'Element'.
36
+ // @ts-expect-error - TS2339 - Property 'focus' does not exist on type 'Element'.
37
37
  element.focus({preventScroll: true});
38
38
  }
@@ -36,7 +36,7 @@ const _upgradeWidgetInfo = (props: WidgetEditorProps): React.ReactElement => {
36
36
  // We can't call serialize here because this.refs.widget
37
37
  // doesn't exist before this component is mounted.
38
38
  const filteredProps = _.omit(props, WIDGET_PROP_DENYLIST);
39
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'PerseusWidget' is not assignable to type 'ReactElement<any, string | JSXElementConstructor<any>>'. | TS2345 - Argument of type 'Partial<{ id: string; onChange: (widgetInfo: PerseusWidget, cb?: (() => unknown) | undefined, silent?: boolean | undefined) => unknown; onRemove: () => unknown; apiOptions: any; } & CategorizerWidget & { ...; }> | ... 38 more ... | Partial<...>' is not assignable to parameter of type 'PerseusWidget'.
39
+ // @ts-expect-error - TS2322 - Type 'PerseusWidget' is not assignable to type 'ReactElement<any, string | JSXElementConstructor<any>>'. | TS2345 - Argument of type 'Partial<{ id: string; onChange: (widgetInfo: PerseusWidget, cb?: (() => unknown) | undefined, silent?: boolean | undefined) => unknown; onRemove: () => unknown; apiOptions: any; } & CategorizerWidget & { ...; }> | ... 38 more ... | Partial<...>' is not assignable to parameter of type 'PerseusWidget'.
40
40
  return Widgets.upgradeWidgetInfoToLatestVersion(filteredProps);
41
41
  };
42
42
 
@@ -53,13 +53,13 @@ class WidgetEditor extends React.Component<
53
53
  super(props);
54
54
  this.state = {
55
55
  showWidget: false,
56
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'ReactElement<any, any> | null' is not assignable to type 'PerseusWidget'.
56
+ // @ts-expect-error - TS2322 - Type 'ReactElement<any, any> | null' is not assignable to type 'PerseusWidget'.
57
57
  widgetInfo: _upgradeWidgetInfo(props),
58
58
  };
59
59
  }
60
60
 
61
61
  UNSAFE_componentWillReceiveProps(nextProps: WidgetEditorProps) {
62
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'ReactElement<any, any> | null' is not assignable to type 'PerseusWidget'.
62
+ // @ts-expect-error - TS2322 - Type 'ReactElement<any, any> | null' is not assignable to type 'PerseusWidget'.
63
63
  this.setState({widgetInfo: _upgradeWidgetInfo(nextProps)});
64
64
  }
65
65
 
@@ -79,7 +79,7 @@ class WidgetEditor extends React.Component<
79
79
  ) as WidgetInfo;
80
80
  newWidgetInfo.options = Object.assign(
81
81
  // eslint-disable-next-line react/no-string-refs
82
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
82
+ // @ts-expect-error - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
83
83
  this.refs.widget.serialize(),
84
84
  newProps,
85
85
  );
@@ -106,7 +106,7 @@ class WidgetEditor extends React.Component<
106
106
 
107
107
  getSaveWarnings = () => {
108
108
  // eslint-disable-next-line react/no-string-refs
109
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
109
+ // @ts-expect-error - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
110
110
  const issuesFunc = this.refs.widget.getSaveWarnings;
111
111
  return issuesFunc ? issuesFunc() : [];
112
112
  };
@@ -122,7 +122,7 @@ class WidgetEditor extends React.Component<
122
122
  static: widgetInfo.static,
123
123
  graded: widgetInfo.graded,
124
124
  // eslint-disable-next-line react/no-string-refs
125
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
125
+ // @ts-expect-error - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
126
126
  options: this.refs.widget.serialize(),
127
127
  version: widgetInfo.version,
128
128
  };
@@ -178,7 +178,7 @@ class WidgetEditor extends React.Component<
178
178
  {supportsStaticMode && (
179
179
  <input
180
180
  type="button"
181
- // @ts-expect-error [FEI-5003] - TS2322 - Type '(e: Event) => void' is not assignable to type 'MouseEventHandler<HTMLInputElement>'.
181
+ // @ts-expect-error - TS2322 - Type '(e: Event) => void' is not assignable to type 'MouseEventHandler<HTMLInputElement>'.
182
182
  onClick={this._toggleStatic}
183
183
  className="simple-button--small"
184
184
  value={
@@ -62,7 +62,7 @@ describe("StructuredItemDiff", function () {
62
62
 
63
63
  const addingResult: Array<Path> = [];
64
64
  StructuredItemDiff.generateCompletePathsList(
65
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'any[][]' is not assignable to parameter of type 'ItemList[]'.
65
+ // @ts-expect-error - TS2345 - Argument of type 'any[][]' is not assignable to parameter of type 'ItemList[]'.
66
66
  beforeList.slice(),
67
67
  afterList.slice(),
68
68
  addingResult,
@@ -72,7 +72,7 @@ describe("StructuredItemDiff", function () {
72
72
 
73
73
  const removingResult = [];
74
74
  StructuredItemDiff.generateCompletePathsList(
75
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'any[][]' is not assignable to parameter of type 'ItemList[]'.
75
+ // @ts-expect-error - TS2345 - Argument of type 'any[][]' is not assignable to parameter of type 'ItemList[]'.
76
76
  afterList,
77
77
  beforeList,
78
78
  removingResult,
@@ -179,7 +179,7 @@ describe("StructuredItemDiff", function () {
179
179
 
180
180
  const firstResult: Array<Path> = [];
181
181
  StructuredItemDiff.generateCompletePathsList(
182
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'any[][]' is not assignable to parameter of type 'ItemList[]'.
182
+ // @ts-expect-error - TS2345 - Argument of type 'any[][]' is not assignable to parameter of type 'ItemList[]'.
183
183
  beforeList.slice(),
184
184
  afterList.slice(),
185
185
  firstResult,
@@ -189,7 +189,7 @@ describe("StructuredItemDiff", function () {
189
189
 
190
190
  const secondResult = [];
191
191
  StructuredItemDiff.generateCompletePathsList(
192
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'any[][]' is not assignable to parameter of type 'ItemList[]'.
192
+ // @ts-expect-error - TS2345 - Argument of type 'any[][]' is not assignable to parameter of type 'ItemList[]'.
193
193
  afterList,
194
194
  beforeList,
195
195
  secondResult,
@@ -301,7 +301,7 @@ describe("StructuredItemDiff", function () {
301
301
 
302
302
  const firstResult: Array<Path> = [];
303
303
  StructuredItemDiff.generateCompletePathsList(
304
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'any[][]' is not assignable to parameter of type 'ItemList[]'.
304
+ // @ts-expect-error - TS2345 - Argument of type 'any[][]' is not assignable to parameter of type 'ItemList[]'.
305
305
  beforeList.slice(),
306
306
  afterList.slice(),
307
307
  firstResult,
@@ -311,7 +311,7 @@ describe("StructuredItemDiff", function () {
311
311
 
312
312
  const secondResult: Array<Path> = [];
313
313
  StructuredItemDiff.generateCompletePathsList(
314
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'any[][]' is not assignable to parameter of type 'ItemList[]'.
314
+ // @ts-expect-error - TS2345 - Argument of type 'any[][]' is not assignable to parameter of type 'ItemList[]'.
315
315
  afterList,
316
316
  beforeList,
317
317
  secondResult,
@@ -398,7 +398,7 @@ describe("StructuredItemDiff", function () {
398
398
 
399
399
  const firstResult = [];
400
400
  StructuredItemDiff.generateCompletePathsList(
401
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'any[][]' is not assignable to parameter of type 'ItemList[]'.
401
+ // @ts-expect-error - TS2345 - Argument of type 'any[][]' is not assignable to parameter of type 'ItemList[]'.
402
402
  beforeList.slice(),
403
403
  afterList.slice(),
404
404
  firstResult,
@@ -408,7 +408,7 @@ describe("StructuredItemDiff", function () {
408
408
 
409
409
  const secondResult = [];
410
410
  StructuredItemDiff.generateCompletePathsList(
411
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'any[][]' is not assignable to parameter of type 'ItemList[]'.
411
+ // @ts-expect-error - TS2345 - Argument of type 'any[][]' is not assignable to parameter of type 'ItemList[]'.
412
412
  afterList,
413
413
  beforeList,
414
414
  secondResult,
@@ -21,17 +21,17 @@ const filterWidgetInfo = function (widgetInfo, showAlignmentOptions: boolean) {
21
21
  showAlignmentOptions &&
22
22
  Widgets.getSupportedAlignments(type).length > 1
23
23
  ) {
24
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'alignment' does not exist on type '{ readonly options: any; }'.
24
+ // @ts-expect-error - TS2339 - Property 'alignment' does not exist on type '{ readonly options: any; }'.
25
25
  filteredWidgetInfo.alignment = alignment;
26
26
  }
27
27
 
28
28
  if (type === "transformer") {
29
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'graded' does not exist on type '{ readonly options: any; }'.
29
+ // @ts-expect-error - TS2339 - Property 'graded' does not exist on type '{ readonly options: any; }'.
30
30
  filteredWidgetInfo.graded = graded;
31
31
  }
32
32
 
33
33
  if (Widgets.supportsStaticMode(type)) {
34
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'static' does not exist on type '{ readonly options: any; }'.
34
+ // @ts-expect-error - TS2339 - Property 'static' does not exist on type '{ readonly options: any; }'.
35
35
  filteredWidgetInfo.static = widgetInfo?.static ?? undefined;
36
36
  }
37
37
 
@@ -12,7 +12,7 @@ const splitDiff = function (diffEntries: any): any {
12
12
  _.each(values, (value, i) => {
13
13
  const isNewline = i > 0;
14
14
  if (isNewline) {
15
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'any[]' is not assignable to parameter of type 'never'.
15
+ // @ts-expect-error - TS2345 - Argument of type 'any[]' is not assignable to parameter of type 'never'.
16
16
  lines.push(currentLine);
17
17
  currentLine = [];
18
18
  }
@@ -22,7 +22,7 @@ const splitDiff = function (diffEntries: any): any {
22
22
  });
23
23
 
24
24
  if (currentLine.length) {
25
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'any[]' is not assignable to parameter of type 'never'.
25
+ // @ts-expect-error - TS2345 - Argument of type 'any[]' is not assignable to parameter of type 'never'.
26
26
  lines.push(currentLine);
27
27
  }
28
28
  return lines;
@@ -56,10 +56,10 @@ function getTitle(path: Path): string {
56
56
  const title: Array<string> = [];
57
57
  for (let i = 0; i < path.length; i++) {
58
58
  if (typeof path[i] === "number") {
59
- // @ts-expect-error [FEI-5003] - TS2365 - Operator '+' cannot be applied to types 'string | number' and 'number'.
59
+ // @ts-expect-error - TS2365 - Operator '+' cannot be applied to types 'string | number' and 'number'.
60
60
  title.push((path[i] + 1).toString() + ":");
61
61
  } else {
62
- // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'string | number' is not assignable to parameter of type 'string'.
62
+ // @ts-expect-error - TS2345 - Argument of type 'string | number' is not assignable to parameter of type 'string'.
63
63
  title.push(path[i]);
64
64
  }
65
65
  }
@@ -164,11 +164,11 @@ class StructuredItemDiff extends React.Component<Props> {
164
164
  .mapTree(itemToTree(before), shape);
165
165
 
166
166
  buildMapper()
167
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'unknown' is not assignable to type 'never'. | TS2322 - Type 'Path' is not assignable to type 'never'.
167
+ // @ts-expect-error - TS2322 - Type 'unknown' is not assignable to type 'never'. | TS2322 - Type 'Path' is not assignable to type 'never'.
168
168
  .setContentMapper((c, _, p) => afterList.push([c, p]))
169
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'unknown' is not assignable to type 'never'. | TS2322 - Type 'Path' is not assignable to type 'never'.
169
+ // @ts-expect-error - TS2322 - Type 'unknown' is not assignable to type 'never'. | TS2322 - Type 'Path' is not assignable to type 'never'.
170
170
  .setHintMapper((c, _, p) => afterList.push([c, p]))
171
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'unknown' is not assignable to type 'never'. | TS2322 - Type 'Path' is not assignable to type 'never'.
171
+ // @ts-expect-error - TS2322 - Type 'unknown' is not assignable to type 'never'. | TS2322 - Type 'Path' is not assignable to type 'never'.
172
172
  .setTagsMapper((c, _, p) => afterList.push([c, p]))
173
173
  .mapTree(itemToTree(after), shape);
174
174
 
@@ -204,7 +204,7 @@ class StructuredItemDiff extends React.Component<Props> {
204
204
  before = [[], path];
205
205
  }
206
206
  if (!after) {
207
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'Path[]' is not assignable to type 'undefined'.
207
+ // @ts-expect-error - TS2322 - Type 'Path[]' is not assignable to type 'undefined'.
208
208
  after = [[], path];
209
209
  }
210
210
 
@@ -217,9 +217,9 @@ class StructuredItemDiff extends React.Component<Props> {
217
217
  });
218
218
  }
219
219
  const afterTags: Array<string> = [];
220
- // @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'.
220
+ // @ts-expect-error - TS2532 - Object is possibly 'undefined'.
221
221
  if (Array.isArray(after[0])) {
222
- // @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'.
222
+ // @ts-expect-error - TS2532 - Object is possibly 'undefined'.
223
223
  after[0].forEach((tagId) => {
224
224
  if (typeof tagId === "string") {
225
225
  afterTags.push(tags.idToName(tagId));
@@ -252,13 +252,13 @@ class StructuredItemDiff extends React.Component<Props> {
252
252
  before = [buildEmptyItemTreeForShape(shapes.content), path];
253
253
  }
254
254
  if (!after) {
255
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'any[]' is not assignable to type 'undefined'.
255
+ // @ts-expect-error - TS2322 - Type 'any[]' is not assignable to type 'undefined'.
256
256
  after = [buildEmptyItemTreeForShape(shapes.content), path];
257
257
  }
258
258
  return (
259
259
  <RendererDiff
260
260
  before={before[0] as any}
261
- // @ts-expect-error [FEI-5003] - TS2532 - Object is possibly 'undefined'.
261
+ // @ts-expect-error - TS2532 - Object is possibly 'undefined'.
262
262
  after={after[0] as any}
263
263
  title={currentTitle}
264
264
  showAlignmentOptions={false}
@@ -49,7 +49,7 @@ class ImageDiffSide extends React.Component<any> {
49
49
  return (
50
50
  <div key={index}>
51
51
  <div className={className}>
52
- {/* @ts-expect-error [FEI-5003] - TS2741 - Property 'alt' is missing in type '{ src: any; title: any; }' but required in type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "children" | "height" | "width" | "title" | "alt" | "trackInteraction" | "preloader" | "allowFullBleed" | "extraGraphie" | "overrideAriaHidden">'. */}
52
+ {/* @ts-expect-error - TS2741 - Property 'alt' is missing in type '{ src: any; title: any; }' but required in type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "children" | "height" | "width" | "title" | "alt" | "trackInteraction" | "preloader" | "allowFullBleed" | "extraGraphie" | "overrideAriaHidden">'. */}
53
53
  <SvgImage
54
54
  src={entry.value}
55
55
  title={entry.value}
@@ -227,7 +227,7 @@ class ImageWidgetDiff extends React.Component<any> {
227
227
  "image-removed": beforeSrc !== afterSrc,
228
228
  })}
229
229
  >
230
- {/* @ts-expect-error [FEI-5003] - TS2741 - Property 'alt' is missing in type '{ src: any; title: any; }' but required in type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "children" | "height" | "width" | "title" | "alt" | "trackInteraction" | "preloader" | "allowFullBleed" | "extraGraphie" | "overrideAriaHidden">'. */}
230
+ {/* @ts-expect-error - TS2741 - Property 'alt' is missing in type '{ src: any; title: any; }' but required in type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "children" | "height" | "width" | "title" | "alt" | "trackInteraction" | "preloader" | "allowFullBleed" | "extraGraphie" | "overrideAriaHidden">'. */}
231
231
  <SvgImage src={beforeSrc} title={beforeSrc} />
232
232
  </div>
233
233
  )}
@@ -241,7 +241,7 @@ class ImageWidgetDiff extends React.Component<any> {
241
241
  "image-added": beforeSrc !== afterSrc,
242
242
  })}
243
243
  >
244
- {/* @ts-expect-error [FEI-5003] - TS2741 - Property 'alt' is missing in type '{ src: any; title: any; }' but required in type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "children" | "height" | "width" | "title" | "alt" | "trackInteraction" | "preloader" | "allowFullBleed" | "extraGraphie" | "overrideAriaHidden">'. */}
244
+ {/* @ts-expect-error - TS2741 - Property 'alt' is missing in type '{ src: any; title: any; }' but required in type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "children" | "height" | "width" | "title" | "alt" | "trackInteraction" | "preloader" | "allowFullBleed" | "extraGraphie" | "overrideAriaHidden">'. */}
245
245
  <SvgImage src={afterSrc} title={afterSrc} />
246
246
  </div>
247
247
  )}
@@ -69,7 +69,7 @@ type State = {
69
69
 
70
70
  class EditorPage extends React.Component<Props, State> {
71
71
  _isMounted: boolean;
72
- // @ts-expect-error [FEI-5003] - TS2564 - Property 'rendererMountNode' has no initializer and is not definitely assigned in the constructor.
72
+ // @ts-expect-error - TS2564 - Property 'rendererMountNode' has no initializer and is not definitely assigned in the constructor.
73
73
  rendererMountNode: HTMLDivElement;
74
74
  renderer: RendererInterface | null | undefined;
75
75
 
@@ -87,7 +87,7 @@ class EditorPage extends React.Component<Props, State> {
87
87
  super(props);
88
88
 
89
89
  this.state = {
90
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "hints" | "question" | "answerArea" | "itemDataVersion">' is not assignable to type 'PerseusJson'.
90
+ // @ts-expect-error - TS2322 - Type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "hints" | "question" | "answerArea" | "itemDataVersion">' is not assignable to type 'PerseusJson'.
91
91
  json: _.pick(
92
92
  this.props,
93
93
  "question",
@@ -161,7 +161,7 @@ class EditorPage extends React.Component<Props, State> {
161
161
  };
162
162
 
163
163
  // eslint-disable-next-line react/no-string-refs
164
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'triggerPreviewUpdate' does not exist on type 'ReactInstance'.
164
+ // @ts-expect-error - TS2339 - Property 'triggerPreviewUpdate' does not exist on type 'ReactInstance'.
165
165
  this.refs.itemEditor.triggerPreviewUpdate({
166
166
  type: "question",
167
167
  data: _({
@@ -177,7 +177,7 @@ class EditorPage extends React.Component<Props, State> {
177
177
  },
178
178
  reviewMode: true,
179
179
  // eslint-disable-next-line react/no-string-refs
180
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
180
+ // @ts-expect-error - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
181
181
  legacyPerseusLint: this.refs.itemEditor.getSaveWarnings(),
182
182
  }).extend(
183
183
  _(this.props).pick(
@@ -199,10 +199,10 @@ class EditorPage extends React.Component<Props, State> {
199
199
 
200
200
  getSaveWarnings(): any {
201
201
  // eslint-disable-next-line react/no-string-refs
202
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
202
+ // @ts-expect-error - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
203
203
  const issues1 = this.refs.itemEditor.getSaveWarnings();
204
204
  // eslint-disable-next-line react/no-string-refs
205
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
205
+ // @ts-expect-error - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
206
206
  const issues2 = this.refs.hintsEditor.getSaveWarnings();
207
207
  return issues1.concat(issues2);
208
208
  }
@@ -212,10 +212,10 @@ class EditorPage extends React.Component<Props, State> {
212
212
  return this.state.json;
213
213
  }
214
214
  // eslint-disable-next-line react/no-string-refs
215
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
215
+ // @ts-expect-error - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
216
216
  return _.extend(this.refs.itemEditor.serialize(options), {
217
217
  // eslint-disable-next-line react/no-string-refs
218
- // @ts-expect-error [FEI-5003] - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
218
+ // @ts-expect-error - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
219
219
  hints: this.refs.hintsEditor.serialize(options),
220
220
  });
221
221
  }