@khanacademy/perseus-editor 2.6.1 → 2.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/article-editor.d.ts +1 -2
- package/dist/components/form-wrapped-text-field.d.ts +1 -10
- package/dist/components/graph-points-count-selector.d.ts +1 -1
- package/dist/es/index.js +373 -364
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +375 -366
- package/dist/index.js.map +1 -1
- package/dist/widgets/input-number-editor.d.ts +1 -2
- package/dist/widgets/interactive-graph-editor.d.ts +140 -139
- package/package.json +12 -12
- package/src/__stories__/editor.stories.tsx +3 -1
- package/src/__tests__/i18n.test.ts +1 -1
- package/src/article-editor.tsx +13 -14
- package/src/components/checkbox.tsx +1 -1
- package/src/components/dropdown-option.tsx +12 -12
- package/src/components/form-wrapped-text-field.tsx +4 -2
- package/src/components/graph-points-count-selector.tsx +3 -1
- package/src/components/graph-settings.tsx +1 -1
- package/src/components/hover-behavior.ts +2 -2
- package/src/components/json-editor.tsx +2 -2
- package/src/components/sortable.tsx +1 -1
- package/src/components/util.ts +1 -1
- package/src/components/widget-editor.tsx +7 -7
- package/src/diffs/__tests__/structured-item-diff.test.ts +8 -8
- package/src/diffs/renderer-diff.tsx +3 -3
- package/src/diffs/split-diff.ts +2 -2
- package/src/diffs/structured-item-diff.tsx +10 -10
- package/src/diffs/text-diff.tsx +1 -1
- package/src/diffs/widget-diff.tsx +2 -2
- package/src/editor-page.tsx +8 -8
- package/src/editor.tsx +36 -36
- package/src/hint-editor.tsx +27 -27
- package/src/i18n.ts +4 -4
- package/src/iframe-content-renderer.tsx +10 -10
- package/src/item-editor.tsx +4 -4
- package/src/multirenderer-editor.tsx +17 -11
- package/src/widgets/categorizer-editor.tsx +3 -3
- package/src/widgets/cs-program-editor.tsx +2 -2
- package/src/widgets/definition-editor.tsx +2 -2
- package/src/widgets/dropdown-editor.tsx +8 -8
- package/src/widgets/example-graphie-widget-editor.tsx +1 -1
- package/src/widgets/example-graphie-widget.tsx +2 -2
- package/src/widgets/example-widget-editor.tsx +2 -2
- package/src/widgets/example-widget.tsx +3 -3
- package/src/widgets/explanation-editor.tsx +3 -3
- package/src/widgets/expression-editor.tsx +9 -9
- package/src/widgets/graded-group-editor.tsx +6 -6
- package/src/widgets/graded-group-set-editor.tsx +3 -3
- package/src/widgets/grapher-editor.tsx +2 -2
- package/src/widgets/group-editor.tsx +3 -3
- package/src/widgets/iframe-editor.tsx +4 -4
- package/src/widgets/input-number-editor.tsx +6 -6
- package/src/widgets/interaction-editor.tsx +102 -102
- package/src/widgets/interactive-graph-editor.tsx +12 -8
- package/src/widgets/label-image/marker.tsx +1 -1
- package/src/widgets/label-image/question-markers.tsx +1 -1
- package/src/widgets/lights-puzzle-editor.tsx +4 -4
- package/src/widgets/matrix-editor.tsx +2 -2
- package/src/widgets/measurer-editor.tsx +6 -6
- package/src/widgets/molecule-editor.tsx +2 -2
- package/src/widgets/number-line-editor.tsx +1 -1
- package/src/widgets/numeric-input-editor.tsx +2 -2
- package/src/widgets/orderer-editor.tsx +2 -2
- package/src/widgets/passage-editor.tsx +3 -3
- package/src/widgets/passage-ref-editor.tsx +3 -3
- package/src/widgets/passage-ref-target-editor.tsx +1 -1
- package/src/widgets/plotter-editor.tsx +4 -4
- package/src/widgets/radio/editor.tsx +3 -3
- package/src/widgets/reaction-diagram-editor.tsx +5 -5
- package/src/widgets/sequence-editor.tsx +1 -1
- package/src/widgets/simple-markdown-tester-editor.tsx +3 -3
- package/src/widgets/simple-markdown-tester.tsx +2 -2
- package/src/widgets/simulator-editor.tsx +1 -1
- package/src/widgets/sorter-editor.tsx +1 -1
- package/src/widgets/table-editor.tsx +1 -1
- package/src/widgets/transformer-editor.tsx +10 -10
- package/src/widgets/unit-editor.tsx +5 -5
- package/tsconfig-build.tsbuildinfo +1 -1
- package/dist/all-editors.js.flow +0 -8
- package/dist/all-widgets.js.flow +0 -34
- package/dist/article-editor.js.flow +0 -72
- package/dist/components/blur-input.js.flow +0 -25
- package/dist/components/checkbox.js.flow +0 -26
- package/dist/components/device-framer.js.flow +0 -20
- package/dist/components/drag-target.js.flow +0 -8
- package/dist/components/dropdown-option.js.flow +0 -49
- package/dist/components/form-wrapped-text-field.js.flow +0 -45
- package/dist/components/graph-points-count-selector.js.flow +0 -12
- package/dist/components/graph-settings.js.flow +0 -8
- package/dist/components/graph-type-selector.js.flow +0 -12
- package/dist/components/hover-behavior.js.flow +0 -48
- package/dist/components/json-editor.js.flow +0 -8
- package/dist/components/link.js.flow +0 -50
- package/dist/components/section-control-button.js.flow +0 -25
- package/dist/components/segment-count-selector.js.flow +0 -11
- package/dist/components/simple-button.js.flow +0 -18
- package/dist/components/sortable.js.flow +0 -8
- package/dist/components/util.js.flow +0 -9
- package/dist/components/viewport-resizer.js.flow +0 -22
- package/dist/components/widget-editor.js.flow +0 -91
- package/dist/components/widget-select.js.flow +0 -16
- package/dist/diffs/article-diff.js.flow +0 -71
- package/dist/diffs/item-diff.js.flow +0 -41
- package/dist/diffs/renderer-diff.js.flow +0 -25
- package/dist/diffs/split-diff.js.flow +0 -8
- package/dist/diffs/string-array-diff.js.flow +0 -11
- package/dist/diffs/structured-item-diff.js.flow +0 -37
- package/dist/diffs/tags-diff.js.flow +0 -24
- package/dist/diffs/text-diff.js.flow +0 -21
- package/dist/diffs/widget-diff-performer.js.flow +0 -8
- package/dist/diffs/widget-diff.js.flow +0 -31
- package/dist/editor-page.js.flow +0 -72
- package/dist/editor.js.flow +0 -96
- package/dist/hint-editor.js.flow +0 -87
- package/dist/i18n.js.flow +0 -13
- package/dist/iframe-content-renderer.js.flow +0 -28
- package/dist/index.js.flow +0 -23
- package/dist/item-editor.js.flow +0 -46
- package/dist/item-extras-editor.js.flow +0 -23
- package/dist/katex-error-view.js.flow +0 -24
- package/dist/multirenderer-editor.js.flow +0 -46
- package/dist/stateful-article-editor.js.flow +0 -16
- package/dist/stateful-editor-page.js.flow +0 -8
- package/dist/testing-widgets.js.flow +0 -34
- package/dist/util/points.js.flow +0 -9
- package/dist/util/register-all-widgets-and-editors-for-testing.js.flow +0 -7
- package/dist/widgets/categorizer-editor.js.flow +0 -62
- package/dist/widgets/cs-program-editor.js.flow +0 -25
- package/dist/widgets/definition-editor.js.flow +0 -23
- package/dist/widgets/dropdown-editor.js.flow +0 -37
- package/dist/widgets/example-graphie-widget-editor.js.flow +0 -25
- package/dist/widgets/example-graphie-widget.js.flow +0 -102
- package/dist/widgets/example-widget-editor.js.flow +0 -26
- package/dist/widgets/example-widget.js.flow +0 -86
- package/dist/widgets/explanation-editor.js.flow +0 -27
- package/dist/widgets/expression-editor.js.flow +0 -43
- package/dist/widgets/graded-group-editor.js.flow +0 -68
- package/dist/widgets/graded-group-set-editor.js.flow +0 -66
- package/dist/widgets/grapher-editor.js.flow +0 -21
- package/dist/widgets/group-editor.js.flow +0 -64
- package/dist/widgets/iframe-editor.js.flow +0 -24
- package/dist/widgets/image-editor.js.flow +0 -8
- package/dist/widgets/input-number-editor.js.flow +0 -77
- package/dist/widgets/interaction/constraint-editor.js.flow +0 -35
- package/dist/widgets/interaction-editor.js.flow +0 -36
- package/dist/widgets/interactive-graph-editor.js.flow +0 -5803
- package/dist/widgets/label-image/answer-choices.js.flow +0 -16
- package/dist/widgets/label-image/behavior.js.flow +0 -17
- package/dist/widgets/label-image/marker.js.flow +0 -32
- package/dist/widgets/label-image/question-markers.js.flow +0 -23
- package/dist/widgets/label-image/select-image.js.flow +0 -13
- package/dist/widgets/label-image-editor.js.flow +0 -44
- package/dist/widgets/lights-puzzle-editor.js.flow +0 -34
- package/dist/widgets/matcher-editor.js.flow +0 -28
- package/dist/widgets/matrix-editor.js.flow +0 -26
- package/dist/widgets/measurer-editor.js.flow +0 -42
- package/dist/widgets/molecule-editor.js.flow +0 -23
- package/dist/widgets/number-line-editor.js.flow +0 -45
- package/dist/widgets/numeric-input-editor.js.flow +0 -8
- package/dist/widgets/orderer-editor.js.flow +0 -30
- package/dist/widgets/passage-editor.js.flow +0 -24
- package/dist/widgets/passage-ref-editor.js.flow +0 -17
- package/dist/widgets/passage-ref-target-editor.js.flow +0 -22
- package/dist/widgets/plotter-editor.js.flow +0 -75
- package/dist/widgets/radio/editor.js.flow +0 -81
- package/dist/widgets/reaction-diagram-editor.js.flow +0 -26
- package/dist/widgets/sequence-editor.js.flow +0 -73
- package/dist/widgets/simple-markdown-tester-editor.js.flow +0 -23
- package/dist/widgets/simple-markdown-tester.js.flow +0 -61
- package/dist/widgets/simulator-editor.js.flow +0 -26
- package/dist/widgets/sorter-editor.js.flow +0 -22
- package/dist/widgets/table-editor.js.flow +0 -24
- package/dist/widgets/transformer-editor.js.flow +0 -17
- package/dist/widgets/unit-editor.js.flow +0 -41
- package/dist/widgets/video-editor.js.flow +0 -25
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Perseus editors",
|
|
4
4
|
"author": "Khan Academy",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "2.6.
|
|
6
|
+
"version": "2.6.3",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -22,36 +22,36 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@khanacademy/kas": "^0.3.1",
|
|
25
|
-
"@khanacademy/kmath": "^0.1.
|
|
26
|
-
"@khanacademy/perseus": "^
|
|
25
|
+
"@khanacademy/kmath": "^0.1.2",
|
|
26
|
+
"@khanacademy/perseus": "^9.0.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@khanacademy/wonder-blocks-button": "^4.
|
|
30
|
-
"@khanacademy/wonder-blocks-clickable": "^
|
|
29
|
+
"@khanacademy/wonder-blocks-button": "^4.1.3",
|
|
30
|
+
"@khanacademy/wonder-blocks-clickable": "^4.0.0",
|
|
31
31
|
"@khanacademy/wonder-blocks-color": "^2.0.1",
|
|
32
|
-
"@khanacademy/wonder-blocks-core": "^
|
|
32
|
+
"@khanacademy/wonder-blocks-core": "^6.0.0",
|
|
33
33
|
"@khanacademy/wonder-blocks-i18n": "^2.0.2",
|
|
34
34
|
"@khanacademy/wonder-blocks-spacing": "^4.0.1",
|
|
35
|
-
"@khanacademy/wonder-blocks-typography": "^2.
|
|
35
|
+
"@khanacademy/wonder-blocks-typography": "^2.1.3",
|
|
36
36
|
"aphrodite": "^1.2.5",
|
|
37
37
|
"classnames": "^1.1.4",
|
|
38
38
|
"create-react-class": "^15.6.3",
|
|
39
39
|
"jquery": "^2.1.1",
|
|
40
40
|
"katex": "^0.11.1",
|
|
41
|
-
"perseus-build-settings": "^0.
|
|
41
|
+
"perseus-build-settings": "^0.2.0",
|
|
42
42
|
"prop-types": "^15.6.1",
|
|
43
43
|
"react": "16.14.0",
|
|
44
44
|
"react-dom": "16.14.0",
|
|
45
45
|
"underscore": "^1.4.4"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@khanacademy/wonder-blocks-button": "^4.
|
|
49
|
-
"@khanacademy/wonder-blocks-clickable": "^
|
|
48
|
+
"@khanacademy/wonder-blocks-button": "^4.1.3",
|
|
49
|
+
"@khanacademy/wonder-blocks-clickable": "^4.0.0",
|
|
50
50
|
"@khanacademy/wonder-blocks-color": "^2.0.1",
|
|
51
|
-
"@khanacademy/wonder-blocks-core": "^
|
|
51
|
+
"@khanacademy/wonder-blocks-core": "^6.0.0",
|
|
52
52
|
"@khanacademy/wonder-blocks-i18n": "^2.0.2",
|
|
53
53
|
"@khanacademy/wonder-blocks-spacing": "^4.0.1",
|
|
54
|
-
"@khanacademy/wonder-blocks-typography": "^2.
|
|
54
|
+
"@khanacademy/wonder-blocks-typography": "^2.1.3",
|
|
55
55
|
"aphrodite": "^1.2.5",
|
|
56
56
|
"classnames": "^1.1.4",
|
|
57
57
|
"create-react-class": "^15.6.3",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable react/prop-types */
|
|
2
|
-
import {ApiOptions
|
|
2
|
+
import {ApiOptions} from "@khanacademy/perseus";
|
|
3
3
|
import {View} from "@khanacademy/wonder-blocks-core";
|
|
4
4
|
import {action} from "@storybook/addon-actions";
|
|
5
5
|
import * as React from "react";
|
|
@@ -9,6 +9,8 @@ import {question1} from "../__testdata__/input-number.testdata";
|
|
|
9
9
|
import Editor from "../editor";
|
|
10
10
|
import {registerAllWidgetsAndEditorsForTesting} from "../util/register-all-widgets-and-editors-for-testing";
|
|
11
11
|
|
|
12
|
+
import type {PerseusRenderer} from "@khanacademy/perseus";
|
|
13
|
+
|
|
12
14
|
registerAllWidgetsAndEditorsForTesting(); // SIDE_EFFECTY!!!! :cry:
|
|
13
15
|
|
|
14
16
|
export default {
|
|
@@ -449,7 +449,7 @@ const exerciseImagesEverywhere = {
|
|
|
449
449
|
// from exerciseImagesEverywhere, but include the question and hints as if they
|
|
450
450
|
// were paragraphs in the article.
|
|
451
451
|
const articleImagesEverywhere = [exerciseImagesEverywhere.question].concat(
|
|
452
|
-
// @ts-expect-error
|
|
452
|
+
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
453
453
|
exerciseImagesEverywhere.hints,
|
|
454
454
|
);
|
|
455
455
|
|
package/src/article-editor.tsx
CHANGED
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
components,
|
|
9
9
|
icons,
|
|
10
10
|
ApiOptions,
|
|
11
|
-
Changeable,
|
|
12
11
|
Errors,
|
|
13
12
|
PerseusError,
|
|
14
13
|
} from "@khanacademy/perseus";
|
|
@@ -21,7 +20,7 @@ import SectionControlButton from "./components/section-control-button";
|
|
|
21
20
|
import Editor from "./editor";
|
|
22
21
|
import IframeContentRenderer from "./iframe-content-renderer";
|
|
23
22
|
|
|
24
|
-
import type {APIOptions} from "@khanacademy/perseus";
|
|
23
|
+
import type {APIOptions, Changeable} from "@khanacademy/perseus";
|
|
25
24
|
|
|
26
25
|
const {HUD, InlineIcon} = components;
|
|
27
26
|
const {iconCircleArrowDown, iconCircleArrowUp, iconPlus, iconTrash} = icons;
|
|
@@ -78,7 +77,7 @@ export default class ArticleEditor extends React.Component<Props, State> {
|
|
|
78
77
|
_updatePreviewFrames() {
|
|
79
78
|
if (this.props.mode === "preview") {
|
|
80
79
|
// eslint-disable-next-line react/no-string-refs
|
|
81
|
-
// @ts-expect-error
|
|
80
|
+
// @ts-expect-error - TS2339 - Property 'sendNewData' does not exist on type 'ReactInstance'.
|
|
82
81
|
this.refs["frame-all"].sendNewData({
|
|
83
82
|
type: "article-all",
|
|
84
83
|
data: this._sections().map((section, i) => {
|
|
@@ -88,7 +87,7 @@ export default class ArticleEditor extends React.Component<Props, State> {
|
|
|
88
87
|
} else if (this.props.mode === "edit") {
|
|
89
88
|
this._sections().forEach((section, i) => {
|
|
90
89
|
// eslint-disable-next-line react/no-string-refs
|
|
91
|
-
// @ts-expect-error
|
|
90
|
+
// @ts-expect-error - TS2339 - Property 'sendNewData' does not exist on type 'ReactInstance'.
|
|
92
91
|
this.refs["frame-" + i].sendNewData({
|
|
93
92
|
type: "article",
|
|
94
93
|
data: this._apiOptionsForSection(section, i),
|
|
@@ -117,7 +116,7 @@ export default class ArticleEditor extends React.Component<Props, State> {
|
|
|
117
116
|
highlightLint: this.state.highlightLint,
|
|
118
117
|
paths: this.props.contentPaths,
|
|
119
118
|
},
|
|
120
|
-
// @ts-expect-error
|
|
119
|
+
// @ts-expect-error - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
|
|
121
120
|
legacyPerseusLint: editor ? editor.getSaveWarnings() : [],
|
|
122
121
|
};
|
|
123
122
|
}
|
|
@@ -304,7 +303,7 @@ export default class ArticleEditor extends React.Component<Props, State> {
|
|
|
304
303
|
newProps,
|
|
305
304
|
) => {
|
|
306
305
|
const sections = _.clone(this._sections());
|
|
307
|
-
// @ts-expect-error
|
|
306
|
+
// @ts-expect-error - TS2542 - Index signature in type 'readonly RendererProps[]' only permits reading.
|
|
308
307
|
sections[i] = _.extend({}, sections[i], newProps);
|
|
309
308
|
this.props.onChange({json: sections});
|
|
310
309
|
};
|
|
@@ -315,9 +314,9 @@ export default class ArticleEditor extends React.Component<Props, State> {
|
|
|
315
314
|
}
|
|
316
315
|
const sections = _.clone(this._sections());
|
|
317
316
|
const section = sections[i];
|
|
318
|
-
// @ts-expect-error
|
|
317
|
+
// @ts-expect-error - TS2551 - Property 'splice' does not exist on type 'readonly RendererProps[]'. Did you mean 'slice'?
|
|
319
318
|
sections.splice(i, 1);
|
|
320
|
-
// @ts-expect-error
|
|
319
|
+
// @ts-expect-error - TS2551 - Property 'splice' does not exist on type 'readonly RendererProps[]'. Did you mean 'slice'?
|
|
321
320
|
sections.splice(i - 1, 0, section);
|
|
322
321
|
this.props.onChange({
|
|
323
322
|
json: sections,
|
|
@@ -330,9 +329,9 @@ export default class ArticleEditor extends React.Component<Props, State> {
|
|
|
330
329
|
return;
|
|
331
330
|
}
|
|
332
331
|
const section = sections[i];
|
|
333
|
-
// @ts-expect-error
|
|
332
|
+
// @ts-expect-error - TS2551 - Property 'splice' does not exist on type 'readonly RendererProps[]'. Did you mean 'slice'?
|
|
334
333
|
sections.splice(i, 1);
|
|
335
|
-
// @ts-expect-error
|
|
334
|
+
// @ts-expect-error - TS2551 - Property 'splice' does not exist on type 'readonly RendererProps[]'. Did you mean 'slice'?
|
|
336
335
|
sections.splice(i + 1, 0, section);
|
|
337
336
|
this.props.onChange({
|
|
338
337
|
json: sections,
|
|
@@ -355,7 +354,7 @@ export default class ArticleEditor extends React.Component<Props, State> {
|
|
|
355
354
|
widgets: sections[i].widgets,
|
|
356
355
|
}
|
|
357
356
|
: {};
|
|
358
|
-
// @ts-expect-error
|
|
357
|
+
// @ts-expect-error - TS2339 - Property 'splice' does not exist on type 'JsonType'.
|
|
359
358
|
sections.splice(i + 1, 0, newSection);
|
|
360
359
|
this.props.onChange({
|
|
361
360
|
json: sections,
|
|
@@ -364,7 +363,7 @@ export default class ArticleEditor extends React.Component<Props, State> {
|
|
|
364
363
|
|
|
365
364
|
_handleRemoveSection(i: number) {
|
|
366
365
|
const sections = _.clone(this._sections());
|
|
367
|
-
// @ts-expect-error
|
|
366
|
+
// @ts-expect-error - TS2551 - Property 'splice' does not exist on type 'readonly RendererProps[]'. Did you mean 'slice'?
|
|
368
367
|
sections.splice(i, 1);
|
|
369
368
|
this.props.onChange({
|
|
370
369
|
json: sections,
|
|
@@ -375,7 +374,7 @@ export default class ArticleEditor extends React.Component<Props, State> {
|
|
|
375
374
|
if (this.props.mode === "edit") {
|
|
376
375
|
return this._sections().map((section, i) => {
|
|
377
376
|
// eslint-disable-next-line react/no-string-refs
|
|
378
|
-
// @ts-expect-error
|
|
377
|
+
// @ts-expect-error - TS2339 - Property 'serialize' does not exist on type 'ReactInstance'.
|
|
379
378
|
return this.refs["editor" + i].serialize();
|
|
380
379
|
});
|
|
381
380
|
}
|
|
@@ -406,7 +405,7 @@ export default class ArticleEditor extends React.Component<Props, State> {
|
|
|
406
405
|
|
|
407
406
|
return this._sections().map((section, i) => {
|
|
408
407
|
// eslint-disable-next-line react/no-string-refs
|
|
409
|
-
// @ts-expect-error
|
|
408
|
+
// @ts-expect-error - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
|
|
410
409
|
return this.refs["editor" + i].getSaveWarnings();
|
|
411
410
|
});
|
|
412
411
|
}
|
|
@@ -131,7 +131,7 @@ export default class Checkbox extends React.Component<CheckboxProps> {
|
|
|
131
131
|
)}
|
|
132
132
|
disabled={disabled}
|
|
133
133
|
onChange={onChange}
|
|
134
|
-
// @ts-expect-error
|
|
134
|
+
// @ts-expect-error - TS2322 - Type 'string | number | undefined' is not assignable to type 'number | undefined'.
|
|
135
135
|
tabIndex={tabIndex}
|
|
136
136
|
/>
|
|
137
137
|
</div>
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
130
|
+
// @ts-expect-error - TS2554 - Expected 0 arguments, but got 1.
|
|
131
131
|
onClick(value);
|
|
132
132
|
}
|
|
133
133
|
}}
|
|
134
|
-
// @ts-expect-error
|
|
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
|
|
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
|
|
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
|
|
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
|
|
234
|
+
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
235
235
|
return React.cloneElement(child, {
|
|
236
|
-
// @ts-expect-error
|
|
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
|
|
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
|
|
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
|
|
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 {
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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> = [];
|
package/src/components/util.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
package/src/diffs/split-diff.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
220
|
+
// @ts-expect-error - TS2532 - Object is possibly 'undefined'.
|
|
221
221
|
if (Array.isArray(after[0])) {
|
|
222
|
-
// @ts-expect-error
|
|
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
|
|
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
|
|
261
|
+
// @ts-expect-error - TS2532 - Object is possibly 'undefined'.
|
|
262
262
|
after={after[0] as any}
|
|
263
263
|
title={currentTitle}
|
|
264
264
|
showAlignmentOptions={false}
|