@khanacademy/perseus-editor 1.1.1 → 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 +14 -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,4 +1,3 @@
1
- // @noflow
2
1
  import createReactClass from "create-react-class";
3
2
  import PropTypes from "prop-types";
4
3
  import * as React from "react";
@@ -80,10 +79,11 @@ const SortableArea = createReactClass({
80
79
  _setDragEvents: function () {
81
80
  this._dragItems = this._dragItems || [];
82
81
  const items =
82
+ // @ts-expect-error [FEI-5003] - TS2531 - Object is possibly 'null'
83
83
  ReactDOM.findDOMNode(this).querySelectorAll("[draggable=true]");
84
84
 
85
- const oldItems = [];
86
- const newItems = [];
85
+ const oldItems: Array<HTMLElement> = [];
86
+ const newItems: Array<HTMLElement> = [];
87
87
 
88
88
  for (let i = 0; i < this._dragItems.length; i++) {
89
89
  const item = this._dragItems[i];
@@ -1,4 +1,3 @@
1
- // @flow
2
1
  export function focusWithChromeStickyFocusBugWorkaround(element: Element) {
3
2
  // NOTE(marksandstrom) Chrome sticky focus bug.
4
3
  //
@@ -34,6 +33,6 @@ export function focusWithChromeStickyFocusBugWorkaround(element: Element) {
34
33
  // this is an issue, however, so there isn't currently a way to out of the
35
34
  // `preventScroll` behavior.
36
35
 
37
- // $FlowIgnore[prop-missing]
36
+ // @ts-expect-error [FEI-5003] - TS2339 - Property 'focus' does not exist on type 'Element'.
38
37
  element.focus({preventScroll: true});
39
38
  }
@@ -1,4 +1,3 @@
1
- // @flow
2
1
  /**
3
2
  * A component that displays controls for choosing a viewport size.
4
3
  * Renders three buttons: "Phone", "Tablet", and "Desktop".
@@ -13,10 +12,10 @@ const {ButtonGroup, InlineIcon} = components;
13
12
  const {devices} = constants;
14
13
  const {iconDesktop, iconMobilePhone, iconTablet} = icons;
15
14
 
16
- type Props = {|
17
- deviceType: DeviceType,
18
- onViewportSizeChanged: (DeviceType) => mixed,
19
- |};
15
+ type Props = {
16
+ deviceType: DeviceType;
17
+ onViewportSizeChanged: (arg1: DeviceType) => unknown;
18
+ };
20
19
 
21
20
  class ViewportResizer extends React.Component<Props> {
22
21
  static propTypes = {
@@ -31,7 +30,7 @@ class ViewportResizer extends React.Component<Props> {
31
30
  this.props.onViewportSizeChanged(value);
32
31
  };
33
32
 
34
- render(): React.Element<"span"> {
33
+ render(): React.ReactNode {
35
34
  const phoneButtonContents = (
36
35
  <span>
37
36
  <InlineIcon {...iconMobilePhone} /> Phone
@@ -1,7 +1,8 @@
1
- // @flow
2
1
  import * as React from "react";
3
2
 
4
- const Wrapper = ({children}: {|children: React.Node|}): React.Node => {
3
+ const Wrapper: React.FC<{
4
+ children: React.ReactNode;
5
+ }> = ({children}): React.ReactElement => {
5
6
  return <div className="perseus-diff">{children}</div>;
6
7
  };
7
8
 
@@ -1,23 +1,22 @@
1
- // @flow
2
-
3
1
  import * as React from "react";
4
2
 
5
- import StructuredItemDiff from "../structured-item-diff.jsx";
3
+ import StructuredItemDiff from "../structured-item-diff";
6
4
 
7
- import Wrapper from "./perseus-diff-wrapper.jsx";
5
+ import Wrapper from "./perseus-diff-wrapper";
8
6
 
7
+ // @ts-expect-error [FEI-5003] - TS2307 - Cannot find module '../../styles/perseus-editor.less' or its corresponding type declarations.
9
8
  import("../../styles/perseus-editor.less");
10
9
 
11
- type StoryArgs = {||};
10
+ type StoryArgs = Record<any, any>;
12
11
 
13
- type Story = {|
14
- title: string,
15
- decorators: $ReadOnlyArray<
16
- (StoryComponent: typeof React.Component) => React.Node,
17
- >,
18
- |};
12
+ type Story = {
13
+ title: string;
14
+ decorators: ReadonlyArray<
15
+ (StoryComponent: typeof React.Component) => React.ReactElement
16
+ >;
17
+ };
19
18
 
20
- export default ({
19
+ export default {
21
20
  title: "Perseus/Editor/Diffs/Structured Item Diff",
22
21
  decorators: [
23
22
  (StoryComponent) => (
@@ -26,15 +25,15 @@ export default ({
26
25
  </Wrapper>
27
26
  ),
28
27
  ],
29
- }: Story);
28
+ } as Story;
30
29
 
31
30
  const tags = {
32
31
  a: "a tag",
33
32
  b: "b tag",
34
33
  c: "c tag",
35
- };
34
+ } as const;
36
35
 
37
- export const ContentAdded = (args: StoryArgs): React.Node => {
36
+ export const ContentAdded: React.FC<StoryArgs> = (args): React.ReactElement => {
38
37
  const props = {
39
38
  before: {
40
39
  _multi: {
@@ -170,13 +169,15 @@ export const ContentAdded = (args: StoryArgs): React.Node => {
170
169
  nameToId: (name) => name[0],
171
170
  names: ["a tag", "b tag", "c tag"],
172
171
  },
173
- };
172
+ } as const;
174
173
 
175
174
  return <StructuredItemDiff {...props} />;
176
175
  };
177
176
 
178
177
  // second instance
179
- export const ContentAddedRemovedAndChanged = (args: StoryArgs): React.Node => {
178
+ export const ContentAddedRemovedAndChanged: React.FC<StoryArgs> = (
179
+ args,
180
+ ): React.ReactElement => {
180
181
  const props = {
181
182
  before: {
182
183
  _multi: {
@@ -377,12 +378,14 @@ export const ContentAddedRemovedAndChanged = (args: StoryArgs): React.Node => {
377
378
  nameToId: (name) => name[0],
378
379
  names: ["a tag", "b tag", "c tag"],
379
380
  },
380
- };
381
+ } as const;
381
382
  return <StructuredItemDiff {...props} />;
382
383
  };
383
384
 
384
385
  // third instance
385
- export const MiscContentChanges = (args: StoryArgs): React.Node => {
386
+ export const MiscContentChanges: React.FC<StoryArgs> = (
387
+ args,
388
+ ): React.ReactElement => {
386
389
  const props = {
387
390
  before: {
388
391
  _multi: {
@@ -672,13 +675,15 @@ export const MiscContentChanges = (args: StoryArgs): React.Node => {
672
675
  nameToId: (name) => name[0],
673
676
  names: ["a tag", "b tag", "c tag"],
674
677
  },
675
- };
678
+ } as const;
676
679
 
677
680
  return <StructuredItemDiff {...props} />;
678
681
  };
679
682
 
680
683
  // fourth
681
- export const ContentRemoved = (args: StoryArgs): React.Node => {
684
+ export const ContentRemoved: React.FC<StoryArgs> = (
685
+ args,
686
+ ): React.ReactElement => {
682
687
  const props = {
683
688
  before: {
684
689
  _multi: {
@@ -849,7 +854,7 @@ export const ContentRemoved = (args: StoryArgs): React.Node => {
849
854
  nameToId: (name) => name[0],
850
855
  names: ["a tag", "b tag", "c tag"],
851
856
  },
852
- };
857
+ } as const;
853
858
 
854
859
  return <StructuredItemDiff {...props} />;
855
860
  };
@@ -1,21 +1,19 @@
1
- // @flow
2
-
3
1
  import * as React from "react";
4
2
 
5
- import TagsDiff from "../tags-diff.jsx";
3
+ import TagsDiff from "../tags-diff";
6
4
 
7
- import Wrapper from "./perseus-diff-wrapper.jsx";
5
+ import Wrapper from "./perseus-diff-wrapper";
8
6
 
9
- type StoryArgs = {||};
7
+ type StoryArgs = Record<any, any>;
10
8
 
11
- type Story = {|
12
- title: string,
13
- decorators: $ReadOnlyArray<
14
- (StoryComponent: typeof React.Component) => React.Node,
15
- >,
16
- |};
9
+ type Story = {
10
+ title: string;
11
+ decorators: ReadonlyArray<
12
+ (StoryComponent: typeof React.Component) => React.ReactElement
13
+ >;
14
+ };
17
15
 
18
- export default ({
16
+ export default {
19
17
  title: "Perseus/Editor/Diffs/Tags Diff",
20
18
  decorators: [
21
19
  (StoryComponent) => (
@@ -24,9 +22,9 @@ export default ({
24
22
  </Wrapper>
25
23
  ),
26
24
  ],
27
- }: Story);
25
+ } as Story;
28
26
 
29
- export const Example = (args: StoryArgs): React.Node => {
27
+ export const Example: React.FC<StoryArgs> = (args): React.ReactElement => {
30
28
  return (
31
29
  <TagsDiff
32
30
  title="tags"
@@ -1,21 +1,19 @@
1
- // @flow
2
-
3
1
  import * as React from "react";
4
2
 
5
- import TextDiff from "../text-diff.jsx";
3
+ import TextDiff from "../text-diff";
6
4
 
7
- import Wrapper from "./perseus-diff-wrapper.jsx";
5
+ import Wrapper from "./perseus-diff-wrapper";
8
6
 
9
- type StoryArgs = {||};
7
+ type StoryArgs = Record<any, any>;
10
8
 
11
- type Story = {|
12
- title: string,
13
- decorators: $ReadOnlyArray<
14
- (StoryComponent: typeof React.Component) => React.Node,
15
- >,
16
- |};
9
+ type Story = {
10
+ title: string;
11
+ decorators: ReadonlyArray<
12
+ (StoryComponent: typeof React.Component) => React.ReactElement
13
+ >;
14
+ };
17
15
 
18
- export default ({
16
+ export default {
19
17
  title: "Perseus/Editor/Diffs/Text Diff",
20
18
  decorators: [
21
19
  (StoryComponent) => (
@@ -24,9 +22,9 @@ export default ({
24
22
  </Wrapper>
25
23
  ),
26
24
  ],
27
- }: Story);
25
+ } as Story;
28
26
 
29
- export const Example = (args: StoryArgs): React.Node => {
27
+ export const Example: React.FC<StoryArgs> = (args): React.ReactElement => {
30
28
  return (
31
29
  <TextDiff
32
30
  title="A day in the life of a text diff"
@@ -1,5 +1,4 @@
1
- // @flow
2
- import splitDiff from "../split-diff.jsx";
1
+ import splitDiff from "../split-diff";
3
2
 
4
3
  describe("split diff", function () {
5
4
  it("splits an empty diff", function () {
@@ -1,5 +1,4 @@
1
- // @flow
2
- import stringArrayDiff from "../string-array-diff.jsx";
1
+ import stringArrayDiff from "../string-array-diff";
3
2
 
4
3
  describe("string array diff", function () {
5
4
  it("diffs an empty diff", function () {
@@ -1,7 +1,8 @@
1
- // @flow
2
1
  import {buildEmptyItemTreeForShape, shapes} from "@khanacademy/perseus";
3
2
 
4
- import StructuredItemDiff from "../structured-item-diff.jsx";
3
+ import StructuredItemDiff from "../structured-item-diff";
4
+
5
+ import type {Path} from "@khanacademy/perseus";
5
6
 
6
7
  const gtpPassageShape = shapes.shape({
7
8
  directions: shapes.content,
@@ -59,8 +60,9 @@ describe("StructuredItemDiff", function () {
59
60
  [emptyHint, ["questions", 1, "hints", 1]],
60
61
  ];
61
62
 
62
- const addingResult = [];
63
+ const addingResult: Array<Path> = [];
63
64
  StructuredItemDiff.generateCompletePathsList(
65
+ // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'any[][]' is not assignable to parameter of type 'ItemList[]'.
64
66
  beforeList.slice(),
65
67
  afterList.slice(),
66
68
  addingResult,
@@ -70,6 +72,7 @@ describe("StructuredItemDiff", function () {
70
72
 
71
73
  const removingResult = [];
72
74
  StructuredItemDiff.generateCompletePathsList(
75
+ // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'any[][]' is not assignable to parameter of type 'ItemList[]'.
73
76
  afterList,
74
77
  beforeList,
75
78
  removingResult,
@@ -121,16 +124,12 @@ describe("StructuredItemDiff", function () {
121
124
  */
122
125
  it("test editing items", function () {
123
126
  const passage = buildEmptyItemTreeForShape(shapes.content);
124
- // $FlowFixMe[prop-missing]
125
127
  passage.content = "passage";
126
128
  const firstQuestion = buildEmptyItemTreeForShape(shapes.content);
127
- // $FlowFixMe[prop-missing]
128
129
  firstQuestion.content = "question 1";
129
130
  const firstHint = buildEmptyItemTreeForShape(shapes.hint);
130
- // $FlowFixMe[prop-missing]
131
131
  firstHint.content = "hint 1";
132
132
  const secondQuestionFirstHint = buildEmptyItemTreeForShape(shapes.hint);
133
- // $FlowFixMe[prop-missing]
134
133
  secondQuestionFirstHint.content = "question 1 hint 1";
135
134
  const beforeList = [
136
135
  [emptyContent, ["directions"]],
@@ -151,18 +150,14 @@ describe("StructuredItemDiff", function () {
151
150
  ];
152
151
 
153
152
  const passageEdited = buildEmptyItemTreeForShape(shapes.content);
154
- // $FlowFixMe[prop-missing]
155
153
  passageEdited.content = "passage edited";
156
154
  const firstQuestionEdited = buildEmptyItemTreeForShape(shapes.content);
157
- // $FlowFixMe[prop-missing]
158
155
  firstQuestionEdited.content = "question edited 1";
159
156
  const firstHintEdited = buildEmptyItemTreeForShape(shapes.hint);
160
- // $FlowFixMe[prop-missing]
161
157
  firstHintEdited.content = "edited hint 1";
162
158
  const secondQuestionFirstHintEdited = buildEmptyItemTreeForShape(
163
159
  shapes.hint,
164
160
  );
165
- // $FlowFixMe[prop-missing]
166
161
  secondQuestionFirstHintEdited.content = "question 1 hint 1 edited";
167
162
  const afterList = [
168
163
  [emptyContent, ["directions"]],
@@ -182,8 +177,9 @@ describe("StructuredItemDiff", function () {
182
177
  [emptyHint, ["questions", 1, "hints", 1]],
183
178
  ];
184
179
 
185
- const firstResult = [];
180
+ const firstResult: Array<Path> = [];
186
181
  StructuredItemDiff.generateCompletePathsList(
182
+ // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'any[][]' is not assignable to parameter of type 'ItemList[]'.
187
183
  beforeList.slice(),
188
184
  afterList.slice(),
189
185
  firstResult,
@@ -193,6 +189,7 @@ describe("StructuredItemDiff", function () {
193
189
 
194
190
  const secondResult = [];
195
191
  StructuredItemDiff.generateCompletePathsList(
192
+ // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'any[][]' is not assignable to parameter of type 'ItemList[]'.
196
193
  afterList,
197
194
  beforeList,
198
195
  secondResult,
@@ -302,8 +299,9 @@ describe("StructuredItemDiff", function () {
302
299
  // removed question 2, added two hints to question 3
303
300
  ];
304
301
 
305
- const firstResult = [];
302
+ const firstResult: Array<Path> = [];
306
303
  StructuredItemDiff.generateCompletePathsList(
304
+ // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'any[][]' is not assignable to parameter of type 'ItemList[]'.
307
305
  beforeList.slice(),
308
306
  afterList.slice(),
309
307
  firstResult,
@@ -311,8 +309,9 @@ describe("StructuredItemDiff", function () {
311
309
  [],
312
310
  );
313
311
 
314
- const secondResult = [];
312
+ const secondResult: Array<Path> = [];
315
313
  StructuredItemDiff.generateCompletePathsList(
314
+ // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'any[][]' is not assignable to parameter of type 'ItemList[]'.
316
315
  afterList,
317
316
  beforeList,
318
317
  secondResult,
@@ -399,6 +398,7 @@ describe("StructuredItemDiff", function () {
399
398
 
400
399
  const firstResult = [];
401
400
  StructuredItemDiff.generateCompletePathsList(
401
+ // @ts-expect-error [FEI-5003] - 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,6 +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
412
  afterList,
412
413
  beforeList,
413
414
  secondResult,
@@ -1,5 +1,4 @@
1
- // @flow
2
- import diff from "../widget-diff-performer.jsx";
1
+ import diff from "../widget-diff-performer";
3
2
 
4
3
  describe("widget-diff-performer", function () {
5
4
  it("diffs a same single value", function () {
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable react/no-unsafe */
2
- // @flow
3
2
  /**
4
3
  * A side by side diff view for Perseus articles.
5
4
  */
@@ -8,7 +7,7 @@ import PropTypes from "prop-types";
8
7
  import * as React from "react";
9
8
  import _ from "underscore";
10
9
 
11
- import RendererDiff from "./renderer-diff.jsx";
10
+ import RendererDiff from "./renderer-diff";
12
11
 
13
12
  const rendererProps = PropTypes.shape({
14
13
  content: PropTypes.string,
@@ -16,8 +15,8 @@ const rendererProps = PropTypes.shape({
16
15
  widgets: PropTypes.objectOf(PropTypes.any),
17
16
  });
18
17
 
19
- type Props = $FlowFixMe;
20
- type State = $FlowFixMe;
18
+ type Props = any;
19
+ type State = any;
21
20
 
22
21
  class ArticleDiff extends React.Component<Props, State> {
23
22
  static propTypes = {
@@ -33,7 +32,7 @@ class ArticleDiff extends React.Component<Props, State> {
33
32
  ]).isRequired,
34
33
  };
35
34
 
36
- static _stateFromProps: (Props) => State = (props) => {
35
+ static _stateFromProps: (arg1: Props) => State = (props) => {
37
36
  const {before, after} = props;
38
37
  return {
39
38
  before: Array.isArray(before) ? before : [before],
@@ -47,7 +46,7 @@ class ArticleDiff extends React.Component<Props, State> {
47
46
  this.setState(ArticleDiff._stateFromProps(nextProps));
48
47
  }
49
48
 
50
- render(): React.Node {
49
+ render(): React.ReactNode {
51
50
  const {before, after} = this.state;
52
51
 
53
52
  const sectionCount = Math.max(before.length, after.length);
@@ -1,4 +1,3 @@
1
- // @flow
2
1
  /**
3
2
  * A side by side diff view for Perseus exercise items
4
3
  * in the standard layout.
@@ -8,8 +7,8 @@ import PropTypes from "prop-types";
8
7
  import * as React from "react";
9
8
  import _ from "underscore";
10
9
 
11
- import RendererDiff from "./renderer-diff.jsx";
12
- import WidgetDiff from "./widget-diff.jsx";
10
+ import RendererDiff from "./renderer-diff";
11
+ import WidgetDiff from "./widget-diff";
13
12
 
14
13
  const itemProps = PropTypes.shape({
15
14
  question: PropTypes.shape({}).isRequired,
@@ -17,7 +16,7 @@ const itemProps = PropTypes.shape({
17
16
  hints: PropTypes.arrayOf(PropTypes.any).isRequired,
18
17
  });
19
18
 
20
- type Props = $FlowFixMe;
19
+ type Props = any;
21
20
 
22
21
  class ItemDiff extends React.Component<Props> {
23
22
  static propTypes = {
@@ -25,7 +24,7 @@ class ItemDiff extends React.Component<Props> {
25
24
  before: itemProps.isRequired,
26
25
  };
27
26
 
28
- render(): React.Node {
27
+ render(): React.ReactNode {
29
28
  const {before, after} = this.props;
30
29
 
31
30
  const hintCount = Math.max(before.hints.length, after.hints.length);
@@ -1,38 +1,37 @@
1
- // @flow
1
+ import {Widgets} from "@khanacademy/perseus";
2
2
  /**
3
3
  * A side by side diff view for Perseus renderers.
4
4
  */
5
- import {Widgets} from "@khanacademy/perseus";
6
5
  import * as React from "react";
7
6
  import _ from "underscore";
8
7
 
9
- import TextDiff from "./text-diff.jsx";
10
- import WidgetDiff from "./widget-diff.jsx";
8
+ import TextDiff from "./text-diff";
9
+ import WidgetDiff from "./widget-diff";
11
10
 
12
11
  import type {PerseusRenderer} from "@khanacademy/perseus";
13
12
 
14
13
  // In diffs, only show the widgetInfo props that can change
15
- const filterWidgetInfo = function (widgetInfo, showAlignmentOptions) {
14
+ const filterWidgetInfo = function (widgetInfo, showAlignmentOptions: boolean) {
16
15
  const {alignment, graded, options, type} = widgetInfo || {};
17
16
 
18
- const filteredWidgetInfo = {options};
17
+ const filteredWidgetInfo = {options} as const;
19
18
 
20
19
  // Show alignment options iff multiple valid ones exist for this widget
21
20
  if (
22
21
  showAlignmentOptions &&
23
22
  Widgets.getSupportedAlignments(type).length > 1
24
23
  ) {
25
- // $FlowFixMe[prop-missing]
24
+ // @ts-expect-error [FEI-5003] - TS2339 - Property 'alignment' does not exist on type '{ readonly options: any; }'.
26
25
  filteredWidgetInfo.alignment = alignment;
27
26
  }
28
27
 
29
28
  if (type === "transformer") {
30
- // $FlowFixMe[prop-missing]
29
+ // @ts-expect-error [FEI-5003] - TS2339 - Property 'graded' does not exist on type '{ readonly options: any; }'.
31
30
  filteredWidgetInfo.graded = graded;
32
31
  }
33
32
 
34
33
  if (Widgets.supportsStaticMode(type)) {
35
- // $FlowFixMe[prop-missing]
34
+ // @ts-expect-error [FEI-5003] - TS2339 - Property 'static' does not exist on type '{ readonly options: any; }'.
36
35
  filteredWidgetInfo.static = widgetInfo?.static ?? undefined;
37
36
  }
38
37
 
@@ -41,35 +40,30 @@ const filterWidgetInfo = function (widgetInfo, showAlignmentOptions) {
41
40
 
42
41
  // TODO(michaelpolyak): This type is very similar to `PerseusRenderer` type
43
42
  // found in `perseus-all-package/perseus-type.js`, consider just using it.
44
- type RendererProps = {|
45
- content: string,
46
-
43
+ type RendererProps = {
44
+ content: string;
47
45
  // NOTE: images and widgets may not be set for some items hints,
48
46
  // specifically in old revisions, which may only be loaded for diffing.
49
- widgets: ?PerseusRenderer["widgets"],
50
- images: ?PerseusRenderer["images"],
51
- |};
47
+ widgets: PerseusRenderer["widgets"] | null | undefined;
48
+ images: PerseusRenderer["images"] | null | undefined;
49
+ };
52
50
 
53
- type Props = {|
51
+ type Props = {
54
52
  // The "after" props of the renderer. Will be displayed on the right.
55
- after: RendererProps,
56
-
53
+ after: RendererProps;
57
54
  // The "before" props of the renderer. Will be displayed on the left.
58
- before: RendererProps,
59
-
55
+ before: RendererProps;
60
56
  // If true, show widget alignment options in the diff.
61
- showAlignmentOptions: boolean,
62
-
57
+ showAlignmentOptions: boolean;
63
58
  // If true, render a horizontal rule after this diff.
64
- showSeparator: boolean,
65
-
59
+ showSeparator: boolean;
66
60
  // The heading to render above the side by side diff.
67
61
  // (In a code review tool this would be the filename.)
68
- title: string,
69
- |};
62
+ title: string;
63
+ };
70
64
 
71
65
  class RendererDiff extends React.Component<Props> {
72
- static defaultProps: $Rest<Props, {|title: string|}> = {
66
+ static defaultProps: Partial<Omit<Props, "title">> = {
73
67
  after: {
74
68
  content: "",
75
69
  images: {},
@@ -84,7 +78,7 @@ class RendererDiff extends React.Component<Props> {
84
78
  showSeparator: false,
85
79
  };
86
80
 
87
- render(): React.Node {
81
+ render(): React.ReactNode {
88
82
  const {after, before, showAlignmentOptions, showSeparator, title} =
89
83
  this.props;
90
84
 
@@ -1,18 +1,18 @@
1
- // @flow
2
1
  import _ from "underscore";
3
2
 
4
3
  // Split a word-wise diff generated by jsdiff into multiple lines, for the
5
4
  // purpose of breaking up the diffs into lines, so that modified lines can be
6
5
  // faintly highlighted
7
6
 
8
- const splitDiff = function (diffEntries: $FlowFixMe): $FlowFixMe {
7
+ const splitDiff = function (diffEntries: any): any {
9
8
  const lines = [];
10
- let currentLine = [];
9
+ let currentLine: Array<any> = [];
11
10
  _.each(diffEntries, (entry) => {
12
11
  const values = entry.value.split("\n");
13
12
  _.each(values, (value, i) => {
14
13
  const isNewline = i > 0;
15
14
  if (isNewline) {
15
+ // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'any[]' is not assignable to parameter of type 'never'.
16
16
  lines.push(currentLine);
17
17
  currentLine = [];
18
18
  }
@@ -22,6 +22,7 @@ const splitDiff = function (diffEntries: $FlowFixMe): $FlowFixMe {
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
26
  lines.push(currentLine);
26
27
  }
27
28
  return lines;