@khanacademy/perseus-editor 1.1.0 → 2.0.0

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 (312) hide show
  1. package/.babelrc.js +1 -1
  2. package/.eslintrc.js +1 -0
  3. package/CHANGELOG.md +21 -0
  4. package/dist/all-editors.d.ts +2 -0
  5. package/dist/all-editors.js.flow +8 -0
  6. package/dist/all-widgets.d.ts +22 -0
  7. package/dist/all-widgets.js.flow +34 -0
  8. package/dist/article-editor.d.ts +59 -0
  9. package/dist/article-editor.js.flow +72 -0
  10. package/dist/components/blur-input.d.ts +19 -0
  11. package/dist/components/blur-input.js.flow +25 -0
  12. package/dist/components/checkbox.d.ts +20 -0
  13. package/dist/components/checkbox.js.flow +26 -0
  14. package/dist/components/device-framer.d.ts +15 -0
  15. package/dist/components/device-framer.js.flow +20 -0
  16. package/dist/components/drag-target.d.ts +2 -0
  17. package/dist/components/drag-target.js.flow +8 -0
  18. package/dist/components/dropdown-option.d.ts +35 -0
  19. package/dist/components/dropdown-option.js.flow +49 -0
  20. package/dist/components/form-wrapped-text-field.d.ts +48 -0
  21. package/dist/components/form-wrapped-text-field.js.flow +48 -0
  22. package/dist/components/graph-settings.d.ts +2 -0
  23. package/dist/components/graph-settings.js.flow +8 -0
  24. package/dist/components/hover-behavior.d.ts +85 -0
  25. package/dist/components/hover-behavior.js.flow +48 -0
  26. package/dist/components/json-editor.d.ts +2 -0
  27. package/dist/components/json-editor.js.flow +8 -0
  28. package/dist/components/link.d.ts +41 -0
  29. package/dist/components/link.js.flow +50 -0
  30. package/dist/components/simple-button.d.ts +16 -0
  31. package/dist/components/simple-button.js.flow +18 -0
  32. package/dist/components/sortable.d.ts +2 -0
  33. package/dist/components/sortable.js.flow +8 -0
  34. package/dist/components/util.d.ts +1 -0
  35. package/dist/components/util.js.flow +9 -0
  36. package/dist/components/viewport-resizer.d.ts +16 -0
  37. package/dist/components/viewport-resizer.js.flow +22 -0
  38. package/dist/diffs/__stories__/perseus-diff-wrapper.d.ts +5 -0
  39. package/dist/diffs/__stories__/perseus-diff-wrapper.js.flow +11 -0
  40. package/dist/diffs/article-diff.d.ts +50 -0
  41. package/dist/diffs/article-diff.js.flow +71 -0
  42. package/dist/diffs/item-diff.d.ts +23 -0
  43. package/dist/diffs/item-diff.js.flow +41 -0
  44. package/dist/diffs/renderer-diff.d.ts +22 -0
  45. package/dist/diffs/renderer-diff.js.flow +25 -0
  46. package/dist/diffs/split-diff.d.ts +2 -0
  47. package/dist/diffs/split-diff.js.flow +8 -0
  48. package/dist/diffs/string-array-diff.d.ts +2 -0
  49. package/dist/diffs/string-array-diff.js.flow +11 -0
  50. package/dist/diffs/structured-item-diff.d.ts +25 -0
  51. package/dist/diffs/structured-item-diff.js.flow +37 -0
  52. package/dist/diffs/tags-diff.d.ts +21 -0
  53. package/dist/diffs/tags-diff.js.flow +24 -0
  54. package/dist/diffs/text-diff.d.ts +15 -0
  55. package/dist/diffs/text-diff.js.flow +21 -0
  56. package/dist/diffs/widget-diff-performer.d.ts +2 -0
  57. package/dist/diffs/widget-diff-performer.js.flow +8 -0
  58. package/dist/diffs/widget-diff.d.ts +21 -0
  59. package/dist/diffs/widget-diff.js.flow +31 -0
  60. package/dist/editor-page.d.ts +57 -0
  61. package/dist/editor-page.js.flow +73 -0
  62. package/dist/editor.d.ts +82 -0
  63. package/dist/editor.js.flow +98 -0
  64. package/dist/es/index.js +1428 -2587
  65. package/dist/es/index.js.map +1 -1
  66. package/dist/hint-editor.d.ts +64 -0
  67. package/dist/hint-editor.js.flow +87 -0
  68. package/dist/i18n.d.ts +7 -0
  69. package/dist/i18n.js.flow +13 -0
  70. package/dist/iframe-content-renderer.d.ts +22 -0
  71. package/dist/iframe-content-renderer.js.flow +28 -0
  72. package/dist/index.d.ts +17 -2
  73. package/dist/index.js +1492 -2548
  74. package/dist/index.js.flow +23 -2
  75. package/dist/index.js.map +1 -1
  76. package/dist/item-editor.d.ts +36 -0
  77. package/dist/item-editor.js.flow +46 -0
  78. package/dist/item-extras-editor.d.ts +17 -0
  79. package/dist/item-extras-editor.js.flow +23 -0
  80. package/dist/katex-error-view.d.ts +16 -0
  81. package/dist/katex-error-view.js.flow +24 -0
  82. package/dist/multirenderer-editor.d.ts +32 -0
  83. package/dist/multirenderer-editor.js.flow +46 -0
  84. package/dist/section-control-button.d.ts +12 -0
  85. package/dist/section-control-button.js.flow +20 -0
  86. package/dist/stateful-article-editor.d.ts +10 -0
  87. package/dist/stateful-article-editor.js.flow +16 -0
  88. package/dist/stateful-editor-page.d.ts +2 -0
  89. package/dist/stateful-editor-page.js.flow +8 -0
  90. package/dist/testing-widgets.d.ts +22 -0
  91. package/dist/testing-widgets.js.flow +34 -0
  92. package/dist/util/register-all-widgets-and-editors-for-testing.d.ts +1 -0
  93. package/dist/util/register-all-widgets-and-editors-for-testing.js.flow +7 -0
  94. package/dist/widgets/categorizer-editor.d.ts +47 -0
  95. package/dist/widgets/categorizer-editor.js.flow +61 -0
  96. package/dist/widgets/cs-program-editor.d.ts +21 -0
  97. package/dist/widgets/cs-program-editor.js.flow +25 -0
  98. package/dist/widgets/definition-editor.d.ts +17 -0
  99. package/dist/widgets/definition-editor.js.flow +23 -0
  100. package/dist/widgets/dropdown-editor.d.ts +23 -0
  101. package/dist/widgets/dropdown-editor.js.flow +37 -0
  102. package/dist/widgets/example-graphie-widget-editor.d.ts +18 -0
  103. package/dist/widgets/example-graphie-widget-editor.js.flow +25 -0
  104. package/dist/widgets/example-graphie-widget.d.ts +87 -0
  105. package/dist/widgets/example-graphie-widget.js.flow +101 -0
  106. package/dist/widgets/example-widget-editor.d.ts +19 -0
  107. package/dist/widgets/example-widget-editor.js.flow +26 -0
  108. package/dist/widgets/example-widget.d.ts +71 -0
  109. package/dist/widgets/example-widget.js.flow +86 -0
  110. package/dist/widgets/explanation-editor.d.ts +21 -0
  111. package/dist/widgets/explanation-editor.js.flow +27 -0
  112. package/dist/widgets/expression-editor.d.ts +33 -0
  113. package/dist/widgets/expression-editor.js.flow +41 -0
  114. package/dist/widgets/graded-group-editor.d.ts +53 -0
  115. package/dist/widgets/graded-group-editor.js.flow +67 -0
  116. package/dist/widgets/graded-group-set-editor.d.ts +51 -0
  117. package/dist/widgets/graded-group-set-editor.js.flow +65 -0
  118. package/dist/widgets/grapher-editor.d.ts +14 -0
  119. package/dist/widgets/grapher-editor.js.flow +21 -0
  120. package/dist/widgets/group-editor.d.ts +49 -0
  121. package/dist/widgets/group-editor.js.flow +63 -0
  122. package/dist/widgets/iframe-editor.d.ts +18 -0
  123. package/dist/widgets/iframe-editor.js.flow +24 -0
  124. package/dist/widgets/image-editor.d.ts +2 -0
  125. package/dist/widgets/image-editor.js.flow +8 -0
  126. package/dist/widgets/input-number-editor.d.ts +47 -0
  127. package/dist/widgets/input-number-editor.js.flow +77 -0
  128. package/dist/widgets/interaction/constraint-editor.d.ts +26 -0
  129. package/dist/widgets/interaction/constraint-editor.js.flow +35 -0
  130. package/dist/widgets/interaction-editor.d.ts +28 -0
  131. package/dist/widgets/interaction-editor.js.flow +36 -0
  132. package/dist/widgets/interactive-graph-editor.d.ts +2 -0
  133. package/dist/widgets/interactive-graph-editor.js.flow +8 -0
  134. package/dist/widgets/label-image/answer-choices.d.ts +13 -0
  135. package/dist/widgets/label-image/answer-choices.js.flow +16 -0
  136. package/dist/widgets/label-image/behavior.d.ts +14 -0
  137. package/dist/widgets/label-image/behavior.js.flow +17 -0
  138. package/dist/widgets/label-image/marker.d.ts +30 -0
  139. package/dist/widgets/label-image/marker.js.flow +34 -0
  140. package/dist/widgets/label-image/question-markers.d.ts +22 -0
  141. package/dist/widgets/label-image/question-markers.js.flow +25 -0
  142. package/dist/widgets/label-image/select-image.d.ts +10 -0
  143. package/dist/widgets/label-image/select-image.js.flow +13 -0
  144. package/dist/widgets/label-image-editor.d.ts +45 -0
  145. package/dist/widgets/label-image-editor.js.flow +44 -0
  146. package/dist/widgets/lights-puzzle-editor.d.ts +24 -0
  147. package/dist/widgets/lights-puzzle-editor.js.flow +34 -0
  148. package/dist/widgets/matcher-editor.d.ts +19 -0
  149. package/dist/widgets/matcher-editor.js.flow +28 -0
  150. package/dist/widgets/matrix-editor.d.ts +20 -0
  151. package/dist/widgets/matrix-editor.js.flow +26 -0
  152. package/dist/widgets/measurer-editor.d.ts +32 -0
  153. package/dist/widgets/measurer-editor.js.flow +42 -0
  154. package/dist/widgets/molecule-editor.d.ts +17 -0
  155. package/dist/widgets/molecule-editor.js.flow +23 -0
  156. package/dist/widgets/number-line-editor.d.ts +36 -0
  157. package/dist/widgets/number-line-editor.js.flow +45 -0
  158. package/dist/widgets/numeric-input-editor.d.ts +2 -0
  159. package/dist/widgets/numeric-input-editor.js.flow +8 -0
  160. package/dist/widgets/orderer-editor.d.ts +20 -0
  161. package/dist/widgets/orderer-editor.js.flow +30 -0
  162. package/dist/widgets/passage-editor.d.ts +18 -0
  163. package/dist/widgets/passage-editor.js.flow +24 -0
  164. package/dist/widgets/passage-ref-editor.d.ts +11 -0
  165. package/dist/widgets/passage-ref-editor.js.flow +17 -0
  166. package/dist/widgets/passage-ref-target-editor.d.ts +16 -0
  167. package/dist/widgets/passage-ref-target-editor.js.flow +22 -0
  168. package/dist/widgets/plotter-editor.d.ts +45 -0
  169. package/dist/widgets/plotter-editor.js.flow +53 -0
  170. package/dist/widgets/radio/editor.d.ts +64 -0
  171. package/dist/widgets/radio/editor.js.flow +80 -0
  172. package/dist/widgets/reaction-diagram-editor.d.ts +20 -0
  173. package/dist/widgets/reaction-diagram-editor.js.flow +26 -0
  174. package/dist/widgets/sequence-editor.d.ts +56 -0
  175. package/dist/widgets/sequence-editor.js.flow +72 -0
  176. package/dist/widgets/simple-markdown-tester-editor.d.ts +14 -0
  177. package/dist/widgets/simple-markdown-tester-editor.js.flow +23 -0
  178. package/dist/widgets/simple-markdown-tester.d.ts +52 -0
  179. package/dist/widgets/simple-markdown-tester.js.flow +61 -0
  180. package/dist/widgets/simulator-editor.d.ts +20 -0
  181. package/dist/widgets/simulator-editor.js.flow +26 -0
  182. package/dist/widgets/sorter-editor.d.ts +16 -0
  183. package/dist/widgets/sorter-editor.js.flow +22 -0
  184. package/dist/widgets/table-editor.d.ts +18 -0
  185. package/dist/widgets/table-editor.js.flow +24 -0
  186. package/dist/widgets/transformer-editor.d.ts +11 -0
  187. package/dist/widgets/transformer-editor.js.flow +17 -0
  188. package/dist/widgets/unit-editor.d.ts +33 -0
  189. package/dist/widgets/unit-editor.js.flow +41 -0
  190. package/dist/widgets/video-editor.d.ts +19 -0
  191. package/dist/widgets/video-editor.js.flow +25 -0
  192. package/package.json +6 -5
  193. package/src/__stories__/{editor.stories.js → editor.stories.tsx} +4 -5
  194. package/src/__stories__/{section-control-button.stories.jsx → section-control-button.stories.tsx} +10 -11
  195. package/src/__testdata__/{input-number_testdata.js → input-number.testdata.ts} +2 -3
  196. package/src/__tests__/{editor_test.jsx → editor.test.tsx} +4 -7
  197. package/src/__tests__/{i18n_test.jsx → i18n.test.ts} +5 -5
  198. package/src/__tests__/{traversal_test.jsx → traversal.test.ts} +9 -10
  199. package/src/{all-editors_test.js → all-editors.test.ts} +1 -2
  200. package/src/all-editors.ts +83 -0
  201. package/src/all-widgets.ts +7 -0
  202. package/src/{article-editor.jsx → article-editor.tsx} +52 -42
  203. package/src/components/__stories__/{blur-input.stories.jsx → blur-input.stories.tsx} +2 -4
  204. package/src/components/{blur-input.jsx → blur-input.tsx} +12 -13
  205. package/src/components/{checkbox.jsx → checkbox.tsx} +18 -19
  206. package/src/components/{device-framer.jsx → device-framer.tsx} +4 -5
  207. package/src/components/{drag-target.jsx → drag-target.tsx} +0 -1
  208. package/src/components/{dropdown-option.jsx → dropdown-option.tsx} +40 -40
  209. package/src/components/{form-wrapped-text-field.jsx → form-wrapped-text-field.tsx} +47 -53
  210. package/src/components/{graph-settings.jsx → graph-settings.tsx} +4 -8
  211. package/src/components/{hover-behavior.jsx → hover-behavior.ts} +32 -33
  212. package/src/components/{json-editor.jsx → json-editor.tsx} +4 -3
  213. package/src/components/{link.jsx → link.ts} +33 -33
  214. package/src/components/{simple-button.jsx → simple-button.tsx} +3 -4
  215. package/src/components/{sortable.jsx → sortable.tsx} +3 -3
  216. package/src/components/{util.js → util.ts} +1 -2
  217. package/src/components/{viewport-resizer.jsx → viewport-resizer.tsx} +5 -6
  218. package/src/diffs/__stories__/{perseus-diff-wrapper.jsx → perseus-diff-wrapper.tsx} +3 -2
  219. package/src/diffs/__stories__/{structured-item-diff.stories.jsx → structured-item-diff.stories.tsx} +27 -22
  220. package/src/diffs/__stories__/{tags-diff.stories.jsx → tags-diff.stories.tsx} +12 -14
  221. package/src/diffs/__stories__/{text-diff.stories.jsx → text-diff.stories.tsx} +12 -14
  222. package/src/diffs/__tests__/{split-diff_test.js → split-diff.test.ts} +1 -2
  223. package/src/diffs/__tests__/{string-array-diff_test.js → string-array-diff.test.ts} +1 -2
  224. package/src/diffs/__tests__/{structured-item-diff_test.js → structured-item-diff.test.ts} +15 -14
  225. package/src/diffs/__tests__/{widget-diff-performer_test.js → widget-diff-performer.test.ts} +1 -2
  226. package/src/diffs/{article-diff.jsx → article-diff.tsx} +5 -6
  227. package/src/diffs/{item-diff.jsx → item-diff.tsx} +4 -5
  228. package/src/diffs/{renderer-diff.jsx → renderer-diff.tsx} +22 -28
  229. package/src/diffs/{split-diff.jsx → split-diff.ts} +4 -3
  230. package/src/diffs/{string-array-diff.jsx → string-array-diff.ts} +8 -9
  231. package/src/diffs/{structured-item-diff.jsx → structured-item-diff.tsx} +32 -27
  232. package/src/diffs/{tags-diff.jsx → tags-diff.tsx} +15 -16
  233. package/src/diffs/{text-diff.jsx → text-diff.tsx} +13 -13
  234. package/src/diffs/{widget-diff-performer.jsx → widget-diff-performer.ts} +3 -8
  235. package/src/diffs/{widget-diff.jsx → widget-diff.tsx} +15 -14
  236. package/src/{editor-page.jsx → editor-page.tsx} +52 -60
  237. package/src/{editor.jsx → editor.tsx} +315 -277
  238. package/src/{hint-editor.jsx → hint-editor.tsx} +105 -79
  239. package/src/{i18n.jsx → i18n.ts} +9 -6
  240. package/src/{iframe-content-renderer.jsx → iframe-content-renderer.tsx} +23 -17
  241. package/src/{index.js → index.ts} +15 -16
  242. package/src/{item-editor.jsx → item-editor.tsx} +35 -30
  243. package/src/{item-extras-editor.jsx → item-extras-editor.tsx} +3 -4
  244. package/src/{katex-error-view.jsx → katex-error-view.tsx} +4 -5
  245. package/src/{multirenderer-editor.jsx → multirenderer-editor.tsx} +132 -127
  246. package/src/{section-control-button.jsx → section-control-button.tsx} +10 -9
  247. package/src/{stateful-article-editor.jsx → stateful-article-editor.tsx} +2 -5
  248. package/src/{stateful-editor-page.jsx → stateful-editor-page.tsx} +1 -3
  249. package/src/{testing-widgets.js → testing-widgets.ts} +5 -6
  250. package/src/util/{register-all-widgets-and-editors-for-testing_test.js → register-all-widgets-and-editors-for-testing.test.ts} +1 -2
  251. package/src/util/{register-all-widgets-and-editors-for-testing.js → register-all-widgets-and-editors-for-testing.ts} +2 -3
  252. package/src/widgets/__stories__/{label-image-editor.stories.jsx → label-image-editor.stories.tsx} +22 -18
  253. package/src/widgets/__stories__/{radio-editor.stories.jsx → radio-editor.stories.tsx} +15 -10
  254. package/src/widgets/{categorizer-editor.jsx → categorizer-editor.tsx} +8 -6
  255. package/src/widgets/{cs-program-editor.jsx → cs-program-editor.tsx} +17 -17
  256. package/src/widgets/{definition-editor.jsx → definition-editor.tsx} +9 -8
  257. package/src/widgets/{dropdown-editor.jsx → dropdown-editor.tsx} +27 -19
  258. package/src/widgets/{example-graphie-widget-editor.jsx → example-graphie-widget-editor.tsx} +8 -8
  259. package/src/widgets/{example-graphie-widget.jsx → example-graphie-widget.tsx} +14 -17
  260. package/src/widgets/{example-widget-editor.jsx → example-widget-editor.tsx} +10 -7
  261. package/src/widgets/{example-widget.jsx → example-widget.tsx} +14 -12
  262. package/src/widgets/{explanation-editor.jsx → explanation-editor.tsx} +12 -10
  263. package/src/widgets/{expression-editor.jsx → expression-editor.tsx} +36 -26
  264. package/src/widgets/{graded-group-editor.jsx → graded-group-editor.tsx} +18 -10
  265. package/src/widgets/{graded-group-set-editor.jsx → graded-group-set-editor.tsx} +15 -12
  266. package/src/widgets/{grapher-editor.jsx → grapher-editor.tsx} +10 -9
  267. package/src/widgets/{group-editor.jsx → group-editor.tsx} +11 -9
  268. package/src/widgets/{iframe-editor.jsx → iframe-editor.tsx} +16 -13
  269. package/src/widgets/{image-editor.jsx → image-editor.tsx} +4 -7
  270. package/src/widgets/{input-number-editor.jsx → input-number-editor.tsx} +61 -47
  271. package/src/widgets/interaction/{constraint-editor.jsx → constraint-editor.tsx} +21 -24
  272. package/src/widgets/{interaction-editor.jsx → interaction-editor.tsx} +160 -61
  273. package/src/widgets/{interactive-graph-editor.jsx → interactive-graph-editor.tsx} +13 -10
  274. package/src/widgets/label-image/__stories__/{answer-choices.stories.jsx → answer-choices.stories.tsx} +22 -17
  275. package/src/widgets/label-image/__stories__/{behavior.stories.jsx → behavior.stories.tsx} +9 -10
  276. package/src/widgets/label-image/__stories__/{marker.stories.jsx → marker.stories.tsx} +11 -12
  277. package/src/widgets/label-image/__stories__/{question-markers.stories.jsx → question-markers.stories.tsx} +17 -16
  278. package/src/widgets/label-image/__stories__/{select-image.stories.jsx → select-image.stories.tsx} +12 -13
  279. package/src/widgets/label-image/{answer-choices.jsx → answer-choices.tsx} +18 -18
  280. package/src/widgets/label-image/{behavior.jsx → behavior.tsx} +9 -11
  281. package/src/widgets/label-image/{marker.jsx → marker.tsx} +17 -19
  282. package/src/widgets/label-image/{question-markers.jsx → question-markers.tsx} +16 -21
  283. package/src/widgets/label-image/{select-image.jsx → select-image.tsx} +5 -7
  284. package/src/widgets/{label-image-editor.jsx → label-image-editor.tsx} +38 -44
  285. package/src/widgets/{lights-puzzle-editor.jsx → lights-puzzle-editor.tsx} +34 -24
  286. package/src/widgets/{matcher-editor.jsx → matcher-editor.tsx} +9 -7
  287. package/src/widgets/{matrix-editor.jsx → matrix-editor.tsx} +10 -9
  288. package/src/widgets/{measurer-editor.jsx → measurer-editor.tsx} +21 -14
  289. package/src/widgets/{molecule-editor.jsx → molecule-editor.tsx} +9 -8
  290. package/src/widgets/{number-line-editor.jsx → number-line-editor.tsx} +19 -17
  291. package/src/widgets/{numeric-input-editor.jsx → numeric-input-editor.tsx} +10 -10
  292. package/src/widgets/{orderer-editor.jsx → orderer-editor.tsx} +17 -12
  293. package/src/widgets/{passage-editor.jsx → passage-editor.tsx} +9 -7
  294. package/src/widgets/{passage-ref-editor.jsx → passage-ref-editor.tsx} +8 -6
  295. package/src/widgets/{passage-ref-target-editor.jsx → passage-ref-target-editor.tsx} +9 -7
  296. package/src/widgets/{plotter-editor.jsx → plotter-editor.tsx} +34 -33
  297. package/src/widgets/radio/{editor.jsx → editor.tsx} +22 -21
  298. package/src/widgets/{reaction-diagram-editor.jsx → reaction-diagram-editor.tsx} +14 -10
  299. package/src/widgets/{sequence-editor.jsx → sequence-editor.tsx} +13 -13
  300. package/src/widgets/{simple-markdown-tester-editor.jsx → simple-markdown-tester-editor.tsx} +11 -9
  301. package/src/widgets/{simple-markdown-tester.jsx → simple-markdown-tester.tsx} +8 -7
  302. package/src/widgets/{simulator-editor.jsx → simulator-editor.tsx} +10 -8
  303. package/src/widgets/{sorter-editor.jsx → sorter-editor.tsx} +8 -6
  304. package/src/widgets/{table-editor.jsx → table-editor.tsx} +11 -10
  305. package/src/widgets/{transformer-editor.jsx → transformer-editor.tsx} +37 -35
  306. package/src/widgets/{unit-editor.jsx → unit-editor.tsx} +31 -25
  307. package/src/widgets/{video-editor.jsx → video-editor.tsx} +8 -9
  308. package/tsconfig.json +22 -0
  309. package/tsconfig.tsbuildinfo +1 -0
  310. package/src/all-editors.js +0 -85
  311. package/src/all-widgets.js +0 -10
  312. /package/dist/{strings.js → strings} +0 -0
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable react/sort-comp */
2
- // @flow
3
2
  import {Changeable, PerseusMarkdown} from "@khanacademy/perseus";
4
3
  import PropTypes from "prop-types";
5
4
  import * as React from "react";
@@ -8,7 +7,7 @@ import _ from "underscore";
8
7
  const mdParse = PerseusMarkdown.parse;
9
8
  const mdOutput = PerseusMarkdown.basicOutput;
10
9
 
11
- type Props = $FlowFixMe;
10
+ type Props = any;
12
11
 
13
12
  class SimpleMarkdownTester extends React.Component<Props> {
14
13
  static propTypes = {
@@ -28,7 +27,7 @@ class SimpleMarkdownTester extends React.Component<Props> {
28
27
  * state is usually the result of toJSON on the widget
29
28
  * rubric is the result of calling toJSON() on the editor
30
29
  */
31
- static validate(state: $FlowFixMe, rubric: $FlowFixMe): $FlowFixMe {
30
+ static validate(state: any, rubric: any): any {
32
31
  return {
33
32
  type: "points",
34
33
  earned: 0,
@@ -37,15 +36,16 @@ class SimpleMarkdownTester extends React.Component<Props> {
37
36
  };
38
37
  }
39
38
 
40
- change: ($FlowFixMe, $FlowFixMe, $FlowFixMe) => $FlowFixMe = (...args) => {
39
+ change: (arg1: any, arg2: any, arg3: any) => any = (...args) => {
41
40
  return Changeable.change.apply(this, args);
42
41
  };
43
42
 
44
- toJSON: () => {...} = () => {
43
+ toJSON: () => Record<any, any> = () => {
45
44
  return {};
46
45
  };
47
46
 
48
- render(): React.Node {
47
+ render(): React.ReactNode {
48
+ // @ts-expect-error [FEI-5003] - TS2554 - Expected 2 arguments, but got 1.
49
49
  const parsed = mdParse(this.props.value);
50
50
  const output = mdOutput(parsed);
51
51
  return <div>{output}</div>;
@@ -58,6 +58,7 @@ class SimpleMarkdownTester extends React.Component<Props> {
58
58
  */
59
59
  focus: () => boolean = () => {
60
60
  // eslint-disable-next-line react/no-string-refs
61
+ // @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'ReactInstance'.
61
62
  this.refs.input.focus();
62
63
  return true;
63
64
  };
@@ -74,7 +75,7 @@ class SimpleMarkdownTester extends React.Component<Props> {
74
75
  * message: null
75
76
  * }
76
77
  */
77
- simpleValidate: ($FlowFixMe) => $FlowFixMe = (rubric) => {
78
+ simpleValidate: (arg1: any) => any = (rubric) => {
78
79
  return SimpleMarkdownTester.validate(this.toJSON(), rubric);
79
80
  };
80
81
  }
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable react/sort-comp */
2
- // @flow
3
2
  import {components, Changeable, EditorJsonify} from "@khanacademy/perseus";
4
3
  import * as i18n from "@khanacademy/wonder-blocks-i18n";
5
4
  import PropTypes from "prop-types";
@@ -10,7 +9,7 @@ const {InfoTip, NumberInput} = components;
10
9
 
11
10
  const maxTrials = 5000;
12
11
 
13
- type Props = $FlowFixMe;
12
+ type Props = any;
14
13
 
15
14
  class SimulatorEditor extends React.Component<Props> {
16
15
  static propTypes = {
@@ -22,7 +21,7 @@ class SimulatorEditor extends React.Component<Props> {
22
21
  proportionOrPercentage: PropTypes.string,
23
22
  };
24
23
 
25
- static widgetName: string = "simulator";
24
+ static widgetName = "simulator" as const;
26
25
 
27
26
  static defaultProps: Props = {
28
27
  xAxisLabel: "Proportion (%)",
@@ -32,7 +31,7 @@ class SimulatorEditor extends React.Component<Props> {
32
31
  proportionOrPercentage: "proportion",
33
32
  };
34
33
 
35
- render(): React.Node {
34
+ render(): React.ReactNode {
36
35
  return (
37
36
  <div className="perseus-widget-simulator">
38
37
  <div>
@@ -127,16 +126,19 @@ class SimulatorEditor extends React.Component<Props> {
127
126
  );
128
127
  }
129
128
 
130
- change: (...args: $ReadOnlyArray<mixed>) => $FlowFixMe = (...args) => {
131
- // $FlowFixMe[incompatible-call]
129
+ change: (...args: ReadonlyArray<unknown>) => any = (...args) => {
130
+ // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'readonly unknown[]' is not assignable to parameter of type 'any[]'.
132
131
  return Changeable.change.apply(this, args);
133
132
  };
134
133
 
135
- handleTargetValueChange: (string, $FlowFixMe) => void = (propName, e) => {
134
+ handleTargetValueChange: (arg1: string, arg2: any) => void = (
135
+ propName,
136
+ e,
137
+ ) => {
136
138
  this.change(propName, e.target.value);
137
139
  };
138
140
 
139
- serialize: () => $FlowFixMe = () => {
141
+ serialize: () => any = () => {
140
142
  return EditorJsonify.serialize.call(this);
141
143
  };
142
144
  }
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable react/forbid-prop-types */
2
- // @flow
3
2
  import {components} from "@khanacademy/perseus";
4
3
  import PropTypes from "prop-types";
5
4
  import * as React from "react";
@@ -10,7 +9,7 @@ const {InfoTip, PropCheckBox, TextListEditor} = components;
10
9
  const HORIZONTAL = "horizontal";
11
10
  const VERTICAL = "vertical";
12
11
 
13
- type Props = $FlowFixMe;
12
+ type Props = any;
14
13
 
15
14
  class SorterEditor extends React.Component<Props> {
16
15
  static propTypes = {
@@ -19,7 +18,7 @@ class SorterEditor extends React.Component<Props> {
19
18
  padding: PropTypes.bool,
20
19
  };
21
20
 
22
- static widgetName: "sorter" = "sorter";
21
+ static widgetName = "sorter" as const;
23
22
 
24
23
  static defaultProps: Props = {
25
24
  correct: ["$x$", "$y$", "$z$"],
@@ -27,15 +26,17 @@ class SorterEditor extends React.Component<Props> {
27
26
  padding: true,
28
27
  };
29
28
 
30
- onLayoutChange: (SyntheticInputEvent<>) => void = (e) => {
29
+ onLayoutChange: (arg1: React.ChangeEvent<HTMLInputElement>) => void = (
30
+ e,
31
+ ) => {
31
32
  this.props.onChange({layout: e.target.value});
32
33
  };
33
34
 
34
- serialize: ($FlowFixMe) => void = () => {
35
+ serialize: (arg1: any) => void = () => {
35
36
  return _.pick(this.props, "correct", "layout", "padding");
36
37
  };
37
38
 
38
- render(): React.Node {
39
+ render(): React.ReactNode {
39
40
  const editor = this;
40
41
 
41
42
  return (
@@ -66,6 +67,7 @@ class SorterEditor extends React.Component<Props> {
66
67
  Layout:{" "}
67
68
  <select
68
69
  value={this.props.layout}
70
+ // @ts-expect-error [FEI-5003] - TS2322 - Type '(arg1: ChangeEvent<HTMLInputElement>) => void' is not assignable to type 'ChangeEventHandler<HTMLSelectElement>'.
69
71
  onChange={this.onLayoutChange}
70
72
  >
71
73
  <option value={HORIZONTAL}>Horizontal</option>
@@ -1,17 +1,16 @@
1
1
  /* eslint-disable react/sort-comp */
2
- // @flow
3
2
  import {components, TableWidget, Util} from "@khanacademy/perseus";
4
3
  import PropTypes from "prop-types";
5
4
  import * as React from "react";
6
5
  import ReactDOM from "react-dom";
7
6
  import _ from "underscore";
8
7
 
9
- import Editor from "../editor.jsx";
8
+ import Editor from "../editor";
10
9
 
11
10
  const {InfoTip, NumberInput} = components;
12
11
  const Table = TableWidget.widget;
13
12
 
14
- type Props = $FlowFixMe;
13
+ type Props = any;
15
14
 
16
15
  class TableEditor extends React.Component<Props> {
17
16
  static propTypes = {
@@ -21,7 +20,7 @@ class TableEditor extends React.Component<Props> {
21
20
  answers: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.string)),
22
21
  };
23
22
 
24
- static widgetName: "table" = "table";
23
+ static widgetName = "table" as const;
25
24
 
26
25
  static defaultProps: Props = (function () {
27
26
  const defaultRows = 4;
@@ -38,12 +37,11 @@ class TableEditor extends React.Component<Props> {
38
37
  })();
39
38
 
40
39
  focus: () => void = () => {
41
- // $FlowFixMe[incompatible-use]
42
- // $FlowFixMe[prop-missing]
40
+ // @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'. | TS2339 - Property 'focus' does not exist on type 'Element | Text'.
43
41
  ReactDOM.findDOMNode(this.refs.numberOfColumns).focus(); // eslint-disable-line react/no-string-refs
44
42
  };
45
43
 
46
- render(): React.Node {
44
+ render(): React.ReactNode {
47
45
  const tableProps = _.pick(
48
46
  this.props,
49
47
  "headers",
@@ -111,7 +109,10 @@ class TableEditor extends React.Component<Props> {
111
109
  );
112
110
  }
113
111
 
114
- onSizeInput: (number, number) => void = (numRawRows, numRawColumns) => {
112
+ onSizeInput: (arg1: number, arg2: number) => void = (
113
+ numRawRows,
114
+ numRawColumns,
115
+ ) => {
115
116
  let rows = +numRawRows || 0;
116
117
  let columns = +numRawColumns || 0;
117
118
  rows = Math.min(Math.max(1, rows), 30);
@@ -129,7 +130,7 @@ class TableEditor extends React.Component<Props> {
129
130
  });
130
131
  }
131
132
 
132
- function fixColumnSizing(array) {
133
+ function fixColumnSizing(array: any) {
133
134
  // Truncate if necessary; else, append
134
135
  if (columns <= oldColumns) {
135
136
  array.length = columns;
@@ -152,7 +153,7 @@ class TableEditor extends React.Component<Props> {
152
153
  });
153
154
  };
154
155
 
155
- serialize: () => $FlowFixMe = () => {
156
+ serialize: () => any = () => {
156
157
  const json = _.pick(this.props, "headers", "rows", "columns");
157
158
 
158
159
  return _.extend({}, json, {
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable camelcase, react/sort-comp */
2
- // @flow
3
2
  import {
4
3
  line as kline,
5
4
  number as knumber,
@@ -19,7 +18,7 @@ import {
19
18
  import * as React from "react";
20
19
  import _ from "underscore";
21
20
 
22
- import GraphSettings from "../components/graph-settings.jsx";
21
+ import GraphSettings from "../components/graph-settings";
23
22
 
24
23
  const {Graph, InfoTip, PropCheckBox} = components;
25
24
  const Transformer = TransformerWidget.widget;
@@ -37,7 +36,7 @@ function arraySum(array) {
37
36
 
38
37
  const defaultBackgroundImage = {
39
38
  url: null,
40
- };
39
+ } as const;
41
40
 
42
41
  /* Scales a distance from the default range of
43
42
  * [-10, 10] to a given props.range pair
@@ -45,14 +44,14 @@ const defaultBackgroundImage = {
45
44
  * Used for sizing various transformation tools
46
45
  * (rotation handle, dilation circle)
47
46
  */
48
- function scaleToRange(dist, range) {
47
+ function scaleToRange(dist: number, range: any) {
49
48
  const spreadX = range[0][1] - range[0][0];
50
49
  const spreadY = range[1][1] - range[1][0];
51
50
 
52
51
  return (dist * Math.max(spreadX, spreadY)) / 20;
53
52
  }
54
53
 
55
- function orderInsensitiveCoordsEqual(coords1, coords2) {
54
+ function orderInsensitiveCoordsEqual(coords1: any, coords2: any) {
56
55
  coords1 = _.clone(coords1).sort(kpoint.compare);
57
56
  coords2 = _.clone(coords2).sort(kpoint.compare);
58
57
  return _.all(
@@ -63,7 +62,7 @@ function orderInsensitiveCoordsEqual(coords1, coords2) {
63
62
  );
64
63
  }
65
64
 
66
- const defaultGraphProps = function (setProps, boxSize) {
65
+ const defaultGraphProps = function (setProps: any, boxSize: number) {
67
66
  setProps = setProps || {};
68
67
  const labels = setProps.labels || ["x", "y"];
69
68
  const range = setProps.range || [
@@ -148,14 +147,14 @@ const defaultTransformerProps = {
148
147
  },
149
148
  transformations: [],
150
149
  },
151
- };
150
+ } as const;
152
151
 
153
- class ToolSettings extends React.Component<$FlowFixMe> {
152
+ class ToolSettings extends React.Component<any> {
154
153
  static defaultProps = {
155
154
  allowFixed: true,
156
155
  };
157
156
 
158
- render(): React.Node {
157
+ render(): React.ReactNode {
159
158
  return (
160
159
  <div>
161
160
  {this.props.name}:{" "}
@@ -203,8 +202,8 @@ class ToolSettings extends React.Component<$FlowFixMe> {
203
202
  };
204
203
  }
205
204
 
206
- class TransformationExplorerSettings extends React.Component<$FlowFixMe> {
207
- render(): React.Node {
205
+ class TransformationExplorerSettings extends React.Component<any> {
206
+ render(): React.ReactNode {
208
207
  return (
209
208
  <div className="transformer-settings">
210
209
  <div>
@@ -292,8 +291,8 @@ class TransformationExplorerSettings extends React.Component<$FlowFixMe> {
292
291
  });
293
292
  };
294
293
 
295
- changeHandlerFor = (toolName) => {
296
- return (change) => {
294
+ changeHandlerFor = (toolName: string) => {
295
+ return (change: any) => {
297
296
  const newTools = _.clone(this.props.tools);
298
297
  newTools[toolName] = _.extend(
299
298
  {},
@@ -308,7 +307,7 @@ class TransformationExplorerSettings extends React.Component<$FlowFixMe> {
308
307
  };
309
308
  }
310
309
 
311
- const ShapeTypes: $FlowFixMe = {
310
+ const ShapeTypes: any = {
312
311
  getPointCountForType: function (type) {
313
312
  const splitType = type.split("-");
314
313
  if (splitType[0] === "polygon") {
@@ -343,7 +342,7 @@ const ShapeTypes: $FlowFixMe = {
343
342
  let isMoving = false;
344
343
  let previousCoord = coord;
345
344
 
346
- const onMove = function (x, y) {
345
+ const onMove = function (x: any, y) {
347
346
  if (!isMoving) {
348
347
  previousCoord = currentPoint.coord;
349
348
  isMoving = true;
@@ -653,6 +652,7 @@ const ShapeTypes: $FlowFixMe = {
653
652
  const coord0 = points[0].coord || points[0];
654
653
  const coord1 = points[1].coord || points[1];
655
654
  const radius = kpoint.distanceToPoint(coord0, coord1);
655
+ // @ts-expect-error [FEI-5003] - TS2554 - Expected 1 arguments, but got 0.
656
656
  perimeter.remove();
657
657
  perimeter = graphie.circle(
658
658
  coord0,
@@ -677,6 +677,7 @@ const ShapeTypes: $FlowFixMe = {
677
677
  remove: function () {
678
678
  // Not _.bind because the remove function changes
679
679
  // when the perimeter is redrawn
680
+ // @ts-expect-error [FEI-5003] - TS2554 - Expected 1 arguments, but got 0.
680
681
  perimeter.remove();
681
682
  },
682
683
  };
@@ -725,8 +726,10 @@ const ShapeTypes: $FlowFixMe = {
725
726
  const line2_2 = [points2[1], points2[2]];
726
727
 
727
728
  const equalUnflipped =
729
+ // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'any[]' is not assignable to parameter of type 'Ray'. | TS2345 - Argument of type 'any[]' is not assignable to parameter of type 'Ray'.
728
730
  kray.equal(line1_0, line2_0) && kray.equal(line1_2, line2_2);
729
731
  const equalFlipped =
732
+ // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'any[]' is not assignable to parameter of type 'Ray'. | TS2345 - Argument of type 'any[]' is not assignable to parameter of type 'Ray'.
730
733
  kray.equal(line1_0, line2_2) && kray.equal(line1_2, line2_0);
731
734
 
732
735
  return equalUnflipped || equalFlipped;
@@ -753,8 +756,8 @@ const ShapeTypes: $FlowFixMe = {
753
756
  },
754
757
  };
755
758
 
756
- class TransformationsShapeEditor extends React.Component<$FlowFixMe> {
757
- render(): React.Node {
759
+ class TransformationsShapeEditor extends React.Component<any> {
760
+ render(): React.ReactNode {
758
761
  return (
759
762
  <div>
760
763
  <Graph
@@ -793,7 +796,7 @@ class TransformationsShapeEditor extends React.Component<$FlowFixMe> {
793
796
  }
794
797
 
795
798
  /* Return the option string for a given type */
796
- getTypeString = (type) => {
799
+ getTypeString = (type: any) => {
797
800
  if (_.isArray(type)) {
798
801
  return _.map(type, this.getTypeString).join(",");
799
802
  }
@@ -807,13 +810,14 @@ class TransformationsShapeEditor extends React.Component<$FlowFixMe> {
807
810
  *
808
811
  * e.target.value is the new type string
809
812
  */
810
- changeType = (e) => {
813
+ changeType = (e: any) => {
811
814
  const types = String(e.target.value).split(",");
812
815
  const pointCount = arraySum(
813
816
  _.map(types, ShapeTypes.getPointCountForType),
814
817
  );
815
818
 
816
819
  // eslint-disable-next-line react/no-string-refs
820
+ // @ts-expect-error [FEI-5003] - TS2339 - Property 'props' does not exist on type 'ReactInstance'.
817
821
  const radius = scaleToRange(4, this.refs.graph.props.range);
818
822
  const offset = (1 / 2 - 1 / pointCount) * 180;
819
823
  const coords = _.times(pointCount, function (i) {
@@ -834,12 +838,14 @@ class TransformationsShapeEditor extends React.Component<$FlowFixMe> {
834
838
 
835
839
  componentDidMount() {
836
840
  // eslint-disable-next-line react/no-string-refs
841
+ // @ts-expect-error [FEI-5003] - TS2339 - Property 'graphie' does not exist on type 'ReactInstance'.
837
842
  this.setupGraphie(this.refs.graph.graphie());
838
843
  }
839
844
 
840
845
  componentDidUpdate(prevProps) {
841
846
  if (!deepEq(prevProps.shape, this.props.shape)) {
842
847
  // eslint-disable-next-line react/no-string-refs
848
+ // @ts-expect-error [FEI-5003] - TS2339 - Property 'reset' does not exist on type 'ReactInstance'.
843
849
  this.refs.graph.reset();
844
850
  }
845
851
  }
@@ -847,12 +853,13 @@ class TransformationsShapeEditor extends React.Component<$FlowFixMe> {
847
853
  updateCoords = () => {
848
854
  this.props.onChange({
849
855
  // $FlowFixMe[prop-missing]
856
+ // @ts-expect-error [FEI-5003] - TS2339 - Property 'shape' does not exist on type 'TransformationsShapeEditor'.
850
857
  shape: this.shape.toJSON(),
851
858
  });
852
859
  };
853
860
 
854
- setupGraphie = (graphie) => {
855
- // $FlowFixMe[prop-missing]
861
+ setupGraphie = (graphie: any) => {
862
+ // @ts-expect-error [FEI-5003] - TS2339 - Property 'shape' does not exist on type 'TransformationsShapeEditor'.
856
863
  this.shape = ShapeTypes.addMovableShape(graphie, {
857
864
  editable: true,
858
865
  snap: graphie.snap,
@@ -862,14 +869,14 @@ class TransformationsShapeEditor extends React.Component<$FlowFixMe> {
862
869
  };
863
870
  }
864
871
 
865
- class TransformerEditor extends React.Component<$FlowFixMe> {
872
+ class TransformerEditor extends React.Component<any> {
866
873
  // TODO (jack): These should be refactored into a nice object at the top
867
874
  // so that we don't have all this duplication
868
- static defaultProps: $FlowFixMe = defaultTransformerProps;
875
+ static defaultProps: any = defaultTransformerProps;
869
876
 
870
- static widgetName: string = "transformer";
877
+ static widgetName = "transformer" as const;
871
878
 
872
- render(): React.Node {
879
+ render(): React.ReactNode {
873
880
  // Fill in any missing value in this.props.graph
874
881
  // this can happen because the graph json doesn't include
875
882
  // box, for example
@@ -957,10 +964,7 @@ class TransformerEditor extends React.Component<$FlowFixMe> {
957
964
 
958
965
  // propagate a props change on our graph settings to
959
966
  // this.props.graph
960
- changeGraph: ($FlowFixMe, $FlowFixMe) => void = (
961
- graphChanges,
962
- callback,
963
- ) => {
967
+ changeGraph: (arg1: any, arg2: any) => void = (graphChanges, callback) => {
964
968
  const newGraph = _.extend({}, this.props.graph, graphChanges);
965
969
  this.props.onChange(
966
970
  {
@@ -972,7 +976,7 @@ class TransformerEditor extends React.Component<$FlowFixMe> {
972
976
 
973
977
  // propagate a props change on our starting graph to
974
978
  // this.props.starting
975
- changeStarting: ($FlowFixMe) => void = (startingChanges) => {
979
+ changeStarting: (arg1: any) => void = (startingChanges) => {
976
980
  const newStarting = _.extend({}, this.props.starting, startingChanges);
977
981
  this.props.onChange({
978
982
  starting: newStarting,
@@ -980,10 +984,7 @@ class TransformerEditor extends React.Component<$FlowFixMe> {
980
984
  };
981
985
 
982
986
  // propagate a transformations change onto correct.transformations
983
- changeTransformer: ($FlowFixMe, $FlowFixMe) => void = (
984
- changes,
985
- callback,
986
- ) => {
987
+ changeTransformer: (arg1: any, arg2: any) => void = (changes, callback) => {
987
988
  if (changes.transformations) {
988
989
  changes.correct = {
989
990
  ...this.props.correct,
@@ -994,8 +995,9 @@ class TransformerEditor extends React.Component<$FlowFixMe> {
994
995
  this.props.onChange(changes, callback);
995
996
  };
996
997
 
997
- serialize: () => $FlowFixMe = () => {
998
+ serialize: () => any = () => {
998
999
  // eslint-disable-next-line react/no-string-refs
1000
+ // @ts-expect-error [FEI-5003] - TS2339 - Property 'getEditorJSON' does not exist on type 'ReactInstance'.
999
1001
  const json = this.refs.explorer.getEditorJSON();
1000
1002
  json.correct = json.answer;
1001
1003
  delete json.answer;
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable react/no-unsafe */
2
- // @flow
3
2
  import * as KAS from "@khanacademy/kas";
4
3
  import {
5
4
  components,
@@ -20,22 +19,22 @@ const {iconOk, iconRemove} = icons;
20
19
  // TODO(joel): Allow sigfigs within a range rather than an exact expected
21
20
  // value?
22
21
 
23
- const ALL = ("all": "all");
24
- const SOME = ("some": "some");
22
+ const ALL = "all" as const;
23
+ const SOME = "some" as const;
25
24
  const MAX_SIGFIGS = 10;
26
25
 
27
- const sigfigPrint = function (num, sigfigs) {
26
+ const sigfigPrint = function (num: any, sigfigs: any) {
28
27
  return displaySigFigs(num, sigfigs, -MAX_SIGFIGS, false);
29
28
  };
30
29
 
31
30
  // Extract the primitive units from a unit expression. This first simplifies
32
31
  // `expr` to a `Mul` like "5 kg m / s^2" then removes the first term.
33
- const primUnits = function (expr) {
32
+ const primUnits = function (expr: any) {
34
33
  return expr.simplify().asMul().partition()[1].flatten().simplify();
35
34
  };
36
35
 
37
- type UnitExampleProps = $FlowFixMe;
38
- type UnitExampleState = $FlowFixMe;
36
+ type UnitExampleProps = any;
37
+ type UnitExampleState = any;
39
38
 
40
39
  // Show the name of a unit and whether it's recognized by KAS.
41
40
  //
@@ -44,10 +43,11 @@ type UnitExampleState = $FlowFixMe;
44
43
  class UnitExample extends React.Component<UnitExampleProps, UnitExampleState> {
45
44
  // TODO(jangmi, CP-3288): Remove usage of `UNSAFE_componentWillMount`
46
45
  UNSAFE_componentWillMount() {
46
+ // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'Readonly<any> & Readonly<{ children?: ReactNode; }>' is not assignable to parameter of type '{ name: any; original: any; sigfigs: any; }'.
47
47
  this._checkValidity(this.props);
48
48
  }
49
49
 
50
- UNSAFE_componentWillReceiveProps(nextProps) {
50
+ UNSAFE_componentWillReceiveProps(nextProps: UnitExampleProps) {
51
51
  this._checkValidity(nextProps);
52
52
  }
53
53
 
@@ -73,7 +73,7 @@ class UnitExample extends React.Component<UnitExampleProps, UnitExampleState> {
73
73
  solvedExample = sigfigPrint(answer.eval(), sigfigs);
74
74
 
75
75
  valid = KAS.compare(primUnits(original), primUnits(unit)).equal;
76
- } catch (e) {
76
+ } catch (e: any) {
77
77
  valid = false;
78
78
  }
79
79
  } else {
@@ -86,7 +86,7 @@ class UnitExample extends React.Component<UnitExampleProps, UnitExampleState> {
86
86
  });
87
87
  };
88
88
 
89
- render(): React.Node {
89
+ render(): React.ReactNode {
90
90
  let icon;
91
91
  if (this.state.valid) {
92
92
  icon = (
@@ -113,12 +113,12 @@ class UnitExample extends React.Component<UnitExampleProps, UnitExampleState> {
113
113
  }
114
114
  }
115
115
 
116
- type UnitInputEditorProps = $FlowFixMe;
116
+ type UnitInputEditorProps = any;
117
117
 
118
118
  class UnitInputEditor extends React.Component<UnitInputEditorProps> {
119
- parsed: ?boolean;
119
+ parsed: boolean | null | undefined;
120
120
  groupId: string;
121
- original: ?$FlowFixMe;
121
+ original: any | null | undefined;
122
122
 
123
123
  static propTypes = {
124
124
  ...Changeable.propTypes,
@@ -128,7 +128,7 @@ class UnitInputEditor extends React.Component<UnitInputEditorProps> {
128
128
  sigfigs: PropTypes.number,
129
129
  };
130
130
 
131
- static widgetName: "unit-input" = "unit-input";
131
+ static widgetName = "unit-input" as const;
132
132
 
133
133
  static defaultProps: UnitInputEditorProps = {
134
134
  value: "5x10^5 kg m / s^2",
@@ -147,31 +147,36 @@ class UnitInputEditor extends React.Component<UnitInputEditorProps> {
147
147
  this._doOriginal(nextProps);
148
148
  }
149
149
 
150
- change: ($FlowFixMe, $FlowFixMe, $FlowFixMe) => $FlowFixMe = (...args) => {
150
+ change: (arg1: any, arg2: any, arg3: any) => any = (...args) => {
151
151
  return Changeable.change.apply(this, args);
152
152
  };
153
153
 
154
- handleAcceptingUnitsChange: (SyntheticInputEvent<>) => void = (event) => {
154
+ handleAcceptingUnitsChange: (
155
+ arg1: React.ChangeEvent<HTMLInputElement>,
156
+ ) => void = (event) => {
155
157
  const acceptingUnits = event.target.value
156
158
  .split(",")
157
159
  .map((str) => str.trim())
158
160
  .filter((str) => str !== "");
161
+ // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
159
162
  this.change({acceptingUnits});
160
163
  };
161
164
 
162
- handleSigfigChange: (number) => void = (sigfigs) => {
165
+ handleSigfigChange: (arg1: number) => void = (sigfigs) => {
166
+ // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
163
167
  this.change({sigfigs});
164
168
  };
165
169
 
166
- _checkSigfigValidity: (number) => boolean = (sigfigs) => {
170
+ _checkSigfigValidity: (arg1: number) => boolean = (sigfigs) => {
167
171
  return sigfigs > 0 && sigfigs <= MAX_SIGFIGS;
168
172
  };
169
173
 
170
- _setAccepting: (typeof SOME | typeof ALL) => void = (val) => {
174
+ _setAccepting: (arg1: typeof SOME | typeof ALL) => void = (val) => {
175
+ // @ts-expect-error [FEI-5003] - TS2554 - Expected 3 arguments, but got 1.
171
176
  this.change({accepting: val});
172
177
  };
173
178
 
174
- _doOriginal: (UnitExampleProps) => void = (props) => {
179
+ _doOriginal: (arg1: UnitExampleProps) => void = (props) => {
175
180
  const tryParse = KAS.unitParse(props.value);
176
181
  this.parsed = false;
177
182
 
@@ -184,13 +189,13 @@ class UnitInputEditor extends React.Component<UnitInputEditorProps> {
184
189
  }
185
190
  };
186
191
 
187
- onChange: (SyntheticInputEvent<>) => void = (event) => {
192
+ onChange: (arg1: React.ChangeEvent<HTMLInputElement>) => void = (event) => {
188
193
  this.props.onChange({value: event.target.value});
189
194
  };
190
195
 
191
- getSaveWarnings: () => $ReadOnlyArray<string> = () => {
196
+ getSaveWarnings: () => ReadonlyArray<string> = () => {
192
197
  const {value, accepting, acceptingUnits} = this.props;
193
- const warnings = [];
198
+ const warnings: Array<string> = [];
194
199
 
195
200
  const tryParse = KAS.unitParse(value);
196
201
  if (!tryParse.parsed) {
@@ -204,11 +209,11 @@ class UnitInputEditor extends React.Component<UnitInputEditorProps> {
204
209
  return warnings;
205
210
  };
206
211
 
207
- serialize: () => $FlowFixMe = () => {
212
+ serialize: () => any = () => {
208
213
  return EditorJsonify.serialize.call(this);
209
214
  };
210
215
 
211
- render(): React.Node {
216
+ render(): React.ReactNode {
212
217
  const {acceptingUnits = [], accepting} = this.props;
213
218
  let acceptingElem = null;
214
219
  if (accepting === SOME) {
@@ -221,6 +226,7 @@ class UnitInputEditor extends React.Component<UnitInputEditorProps> {
221
226
  />
222
227
  ));
223
228
 
229
+ // @ts-expect-error [FEI-5003] - TS2322 - Type 'Element' is not assignable to type 'null'.
224
230
  acceptingElem = (
225
231
  <div>
226
232
  <input