@khanacademy/perseus 7.2.1 → 9.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.
- package/CHANGELOG.md +47 -0
- package/dist/article-renderer.d.ts +27 -40
- package/dist/components/math-input.d.ts +1 -1
- package/dist/components/sortable.d.ts +1 -1
- package/dist/components/tex-buttons.d.ts +1 -1
- package/dist/dependencies.d.ts +7 -1
- package/dist/es/index.js +1205 -1218
- package/dist/es/index.js.map +1 -1
- package/dist/hints-renderer.d.ts +1 -1
- package/dist/index.js +1207 -1221
- package/dist/index.js.map +1 -1
- package/dist/interaction-tracker.d.ts +3 -3
- package/dist/item-renderer.d.ts +2 -1
- package/dist/mixins/provide-keypad.d.ts +15 -12
- package/dist/multi-items/multi-renderer.d.ts +2 -1
- package/dist/perseus-api.d.ts +2 -2
- package/dist/renderer.d.ts +1 -1
- package/dist/server-item-renderer.d.ts +3 -1
- package/dist/types.d.ts +32 -11
- package/dist/widgets/expression.d.ts +410 -13
- package/dist/widgets/graded-group.d.ts +3 -3
- package/dist/widgets/interactive-graph.d.ts +1 -1
- package/dist/widgets/sequence.d.ts +3 -3
- package/dist/widgets/table.d.ts +8 -1
- package/dist/widgets.d.ts +1 -1
- package/package.json +34 -34
- package/src/__stories__/article-renderer.stories.tsx +35 -2
- package/src/__testdata__/article-renderer.testdata.ts +74 -1
- package/src/__testdata__/item-renderer.testdata.ts +1 -1
- package/src/__testdata__/renderer.testdata.ts +1 -1
- package/src/__tests__/item-renderer.test.tsx +13 -2
- package/src/__tests__/mock-asset-loading-widget.tsx +1 -1
- package/src/__tests__/perseus-markdown.test.ts +17 -17
- package/src/__tests__/renderer-api.test.tsx +21 -21
- package/src/__tests__/renderer.test.tsx +13 -13
- package/src/__tests__/server-item-renderer.test.tsx +12 -4
- package/src/__tests__/tex-wrangler.test.ts +1 -1
- package/src/article-renderer.tsx +75 -66
- package/src/components/__tests__/number-input.test.tsx +4 -4
- package/src/components/__tests__/sortable.test.tsx +2 -2
- package/src/components/fixed-to-responsive.tsx +1 -1
- package/src/components/graph.tsx +11 -11
- package/src/components/graphie-classes.ts +7 -7
- package/src/components/graphie.tsx +14 -14
- package/src/components/highlighting/highlightable-content.tsx +1 -1
- package/src/components/highlighting/ui/highlight-renderer.tsx +1 -1
- package/src/components/highlighting/ui/util.ts +2 -2
- package/src/components/highlighting/word-indexer.tsx +4 -4
- package/src/components/icon.tsx +1 -1
- package/src/components/image-loader.tsx +4 -4
- package/src/components/input-with-examples.tsx +2 -2
- package/src/components/lint.tsx +1 -1
- package/src/components/math-input.tsx +5 -5
- package/src/components/math-output.tsx +1 -1
- package/src/components/multi-button-group.tsx +1 -1
- package/src/components/number-input.tsx +10 -10
- package/src/components/prop-check-box.tsx +1 -1
- package/src/components/simple-keypad-input.tsx +4 -4
- package/src/components/sortable.tsx +42 -41
- package/src/components/svg-image.tsx +12 -12
- package/src/components/tex-buttons.tsx +4 -3
- package/src/components/text-input.tsx +8 -8
- package/src/components/text-list-editor.tsx +11 -11
- package/src/components/visibility-observer/create-visibility-observer.ts +1 -1
- package/src/components/visibility-observer/visibility-observer.tsx +2 -2
- package/src/components/zoomable-tex.tsx +3 -3
- package/src/components/zoomable.tsx +8 -8
- package/src/dependencies.ts +16 -1
- package/src/hint-renderer.tsx +3 -3
- package/src/hints-renderer.tsx +11 -11
- package/src/init.ts +1 -1
- package/src/interaction-tracker.ts +7 -7
- package/src/interactive2/__tests__/movable-point.test.ts +1 -1
- package/src/interactive2/interactive-util.ts +6 -6
- package/src/interactive2/movable-helper-methods.ts +2 -2
- package/src/interactive2/movable-line-options.ts +37 -37
- package/src/interactive2/movable-line.ts +2 -2
- package/src/interactive2/movable-point-options.ts +29 -29
- package/src/interactive2/movable-point.tsx +2 -2
- package/src/interactive2/movable-polygon-options.ts +45 -45
- package/src/interactive2/movable-polygon.ts +2 -2
- package/src/interactive2/movable.ts +2 -2
- package/src/interactive2/objective_.ts +1 -1
- package/src/interactive2/wrapped-defaults.ts +2 -2
- package/src/interactive2/wrapped-ellipse.ts +9 -9
- package/src/interactive2/wrapped-line.ts +8 -8
- package/src/interactive2/wrapped-path.ts +5 -5
- package/src/item-renderer.tsx +66 -48
- package/src/mixins/changeable.ts +2 -2
- package/src/mixins/editor-jsonify.ts +1 -1
- package/src/mixins/provide-keypad.tsx +23 -37
- package/src/mixins/widget-jsonify-deprecated.ts +1 -1
- package/src/multi-items/__tests__/items.test.ts +1 -1
- package/src/multi-items/__tests__/multi-renderer.test.tsx +13 -8
- package/src/multi-items/__tests__/trees.test.ts +12 -12
- package/src/multi-items/item-types.ts +2 -2
- package/src/multi-items/items.ts +1 -1
- package/src/multi-items/multi-renderer.tsx +30 -18
- package/src/multi-items/prop-type-builders.ts +2 -2
- package/src/multi-items/tree-types.ts +4 -4
- package/src/multi-items/trees.ts +16 -16
- package/src/perseus-env.ts +2 -2
- package/src/perseus-markdown.tsx +5 -5
- package/src/renderer.tsx +39 -39
- package/src/server-item-renderer.tsx +26 -21
- package/src/sigfigs.ts +1 -1
- package/src/traversal.ts +1 -1
- package/src/types.ts +52 -16
- package/src/util/answer-types.ts +14 -14
- package/src/util/geometry.ts +7 -7
- package/src/util/graphie.ts +32 -32
- package/src/util/interactive.ts +118 -118
- package/src/util/math.ts +4 -4
- package/src/util/react-render.tsx +1 -1
- package/src/util/scroll-utils.ts +2 -2
- package/src/util/tex.ts +3 -3
- package/src/util.ts +15 -15
- package/src/widget-container.tsx +1 -1
- package/src/widgets/__stories__/definition.stories.tsx +8 -1
- package/src/widgets/__stories__/expression.stories.tsx +2 -2
- package/src/widgets/__stories__/test-keypad-context-wrapper.tsx +3 -3
- package/src/widgets/__testdata__/numeric-input.testdata.ts +1 -1
- package/src/widgets/__tests__/__snapshots__/video.test.ts.snap +2 -2
- package/src/widgets/__tests__/{expression.test.ts → expression.test.tsx} +77 -11
- package/src/widgets/__tests__/grapher.cypress.ts +32 -32
- package/src/widgets/__tests__/group.test.tsx +1 -1
- package/src/widgets/__tests__/interactive-graph.cypress.ts +40 -40
- package/src/widgets/__tests__/interactive-graph.test.ts +1 -1
- package/src/widgets/__tests__/numeric-input.test.ts +1 -1
- package/src/widgets/__tests__/passage.test.tsx +2 -2
- package/src/widgets/__tests__/plotter.test.tsx +2 -1
- package/src/widgets/__tests__/radio/base-radio.test.tsx +7 -7
- package/src/widgets/__tests__/renderQuestion.tsx +29 -21
- package/src/widgets/categorizer.tsx +4 -4
- package/src/widgets/cs-program.tsx +2 -2
- package/src/widgets/dropdown.tsx +1 -1
- package/src/widgets/expression.tsx +92 -57
- package/src/widgets/graded-group-set.tsx +5 -5
- package/src/widgets/graded-group.tsx +29 -21
- package/src/widgets/grapher/util.tsx +6 -6
- package/src/widgets/grapher.tsx +10 -10
- package/src/widgets/group.tsx +3 -3
- package/src/widgets/iframe.tsx +2 -2
- package/src/widgets/image.tsx +1 -1
- package/src/widgets/input-number.tsx +4 -4
- package/src/widgets/interaction.tsx +77 -77
- package/src/widgets/interactive-graph.tsx +109 -107
- package/src/widgets/label-image/marker.tsx +2 -2
- package/src/widgets/label-image.test.ts +1 -1
- package/src/widgets/label-image.tsx +7 -7
- package/src/widgets/lights-puzzle.tsx +2 -2
- package/src/widgets/matcher.tsx +6 -6
- package/src/widgets/matrix.tsx +20 -20
- package/src/widgets/measurer.tsx +3 -3
- package/src/widgets/molecule/__tests__/layout.test.ts +4 -4
- package/src/widgets/molecule/__tests__/parser.test.ts +14 -14
- package/src/widgets/molecule/smiles-parser.ts +3 -3
- package/src/widgets/molecule.tsx +4 -4
- package/src/widgets/number-line.tsx +11 -11
- package/src/widgets/numeric-input.tsx +11 -11
- package/src/widgets/orderer.tsx +38 -38
- package/src/widgets/passage/__tests__/passage-markdown.test.ts +1 -1
- package/src/widgets/passage/passage-markdown.tsx +4 -4
- package/src/widgets/passage-ref-target.tsx +1 -1
- package/src/widgets/passage-ref.tsx +4 -6
- package/src/widgets/passage.tsx +11 -11
- package/src/widgets/plotter.tsx +9 -9
- package/src/widgets/radio/base-radio.tsx +11 -11
- package/src/widgets/radio/choice-icon/choice-icon.tsx +2 -2
- package/src/widgets/radio/choice.tsx +1 -1
- package/src/widgets/radio/option-status.tsx +1 -1
- package/src/widgets/radio/widget.tsx +6 -6
- package/src/widgets/radio.ts +1 -1
- package/src/widgets/reaction-diagram.tsx +8 -8
- package/src/widgets/sequence.tsx +12 -4
- package/src/widgets/simulator.tsx +14 -14
- package/src/widgets/sorter.tsx +4 -4
- package/src/widgets/table.tsx +8 -8
- package/src/widgets/transformer.tsx +92 -92
- package/src/widgets/unit.tsx +17 -17
- package/src/widgets/video-transcript-link.test.tsx +3 -3
- package/src/widgets/video-transcript-link.tsx +1 -1
- package/src/widgets/video.tsx +1 -1
- package/src/widgets.ts +5 -5
- package/src/zoom.ts +22 -22
- package/tsconfig-build.tsbuildinfo +1 -1
- package/dist/a11y.js.flow +0 -11
- package/dist/all-widgets.js.flow +0 -33
- package/dist/article-renderer.js.flow +0 -73
- package/dist/asset-context.js.flow +0 -15
- package/dist/basic-widgets.js.flow +0 -33
- package/dist/components/button-group.js.flow +0 -33
- package/dist/components/constants.js.flow +0 -13
- package/dist/components/fixed-to-responsive.js.flow +0 -34
- package/dist/components/graph.js.flow +0 -66
- package/dist/components/graphie-classes.js.flow +0 -19
- package/dist/components/graphie-movables.js.flow +0 -22
- package/dist/components/graphie.js.flow +0 -69
- package/dist/components/highlighting/highlightable-content.js.flow +0 -56
- package/dist/components/highlighting/highlights.js.flow +0 -54
- package/dist/components/highlighting/ranges.js.flow +0 -60
- package/dist/components/highlighting/types.js.flow +0 -70
- package/dist/components/highlighting/ui/highlight-renderer.js.flow +0 -43
- package/dist/components/highlighting/ui/highlight-set-renderer.js.flow +0 -41
- package/dist/components/highlighting/ui/highlight-tooltip.js.flow +0 -22
- package/dist/components/highlighting/ui/highlighting-ui.js.flow +0 -30
- package/dist/components/highlighting/ui/selection-tracker.js.flow +0 -54
- package/dist/components/highlighting/ui/types.js.flow +0 -22
- package/dist/components/highlighting/ui/util.js.flow +0 -42
- package/dist/components/highlighting/word-indexer.js.flow +0 -21
- package/dist/components/hud.js.flow +0 -14
- package/dist/components/icon.js.flow +0 -31
- package/dist/components/image-loader.js.flow +0 -49
- package/dist/components/info-tip/info-tip.js.flow +0 -20
- package/dist/components/info-tip.js.flow +0 -18
- package/dist/components/inline-icon.js.flow +0 -39
- package/dist/components/input-with-examples.js.flow +0 -58
- package/dist/components/lint.js.flow +0 -58
- package/dist/components/math-input.js.flow +0 -49
- package/dist/components/math-output.js.flow +0 -33
- package/dist/components/multi-button-group.js.flow +0 -35
- package/dist/components/number-input.js.flow +0 -42
- package/dist/components/prop-check-box.js.flow +0 -8
- package/dist/components/range-input.js.flow +0 -20
- package/dist/components/simple-keypad-input.js.flow +0 -16
- package/dist/components/sortable.js.flow +0 -91
- package/dist/components/stub-tag-editor.js.flow +0 -18
- package/dist/components/svg-image.js.flow +0 -85
- package/dist/components/tex-buttons.js.flow +0 -26
- package/dist/components/tex.js.flow +0 -25
- package/dist/components/text-input.js.flow +0 -39
- package/dist/components/text-list-editor.js.flow +0 -22
- package/dist/components/tooltip.js.flow +0 -51
- package/dist/components/visibility-observer/create-visibility-observer.js.flow +0 -23
- package/dist/components/visibility-observer/get-scroll-parent.js.flow +0 -7
- package/dist/components/visibility-observer/visibility-observer.js.flow +0 -36
- package/dist/components/zoomable-tex.js.flow +0 -18
- package/dist/components/zoomable.js.flow +0 -70
- package/dist/components.js.flow +0 -22
- package/dist/definition-context.js.flow +0 -25
- package/dist/dependencies.js.flow +0 -9
- package/dist/error-boundary.js.flow +0 -19
- package/dist/extra-widgets.js.flow +0 -33
- package/dist/hint-renderer.js.flow +0 -32
- package/dist/hints-renderer.js.flow +0 -41
- package/dist/icon-paths.js.flow +0 -123
- package/dist/index.js.flow +0 -134
- package/dist/init.js.flow +0 -20
- package/dist/interaction-tracker.js.flow +0 -35
- package/dist/interactive2/interactive-util.js.flow +0 -50
- package/dist/interactive2/movable-helper-methods.js.flow +0 -15
- package/dist/interactive2/movable-line-options.js.flow +0 -44
- package/dist/interactive2/movable-line.js.flow +0 -8
- package/dist/interactive2/movable-point-options.js.flow +0 -44
- package/dist/interactive2/movable-point.js.flow +0 -8
- package/dist/interactive2/movable-polygon-options.js.flow +0 -47
- package/dist/interactive2/movable-polygon.js.flow +0 -8
- package/dist/interactive2/movable.js.flow +0 -8
- package/dist/interactive2/objective_.js.flow +0 -25
- package/dist/interactive2/types.js.flow +0 -8
- package/dist/interactive2/wrapped-defaults.js.flow +0 -11
- package/dist/interactive2/wrapped-ellipse.js.flow +0 -14
- package/dist/interactive2/wrapped-line.js.flow +0 -14
- package/dist/interactive2/wrapped-path.js.flow +0 -13
- package/dist/interactive2.js.flow +0 -16
- package/dist/item-renderer.js.flow +0 -132
- package/dist/item-version.js.flow +0 -11
- package/dist/jipt-paragraphs.js.flow +0 -14
- package/dist/loading-context.js.flow +0 -12
- package/dist/logging/log.js.flow +0 -62
- package/dist/mixins/changeable.js.flow +0 -33
- package/dist/mixins/editor-jsonify.js.flow +0 -10
- package/dist/mixins/provide-keypad.js.flow +0 -33
- package/dist/mixins/widget-jsonify-deprecated.js.flow +0 -11
- package/dist/mixins/widget-prop-denylist.js.flow +0 -20
- package/dist/multi-items/item-types.js.flow +0 -55
- package/dist/multi-items/items.js.flow +0 -66
- package/dist/multi-items/multi-renderer.js.flow +0 -213
- package/dist/multi-items/prop-type-builders.js.flow +0 -22
- package/dist/multi-items/shape-types.js.flow +0 -60
- package/dist/multi-items/shapes.js.flow +0 -25
- package/dist/multi-items/tree-types.js.flow +0 -45
- package/dist/multi-items/trees.js.flow +0 -147
- package/dist/multi-items.js.flow +0 -36
- package/dist/perseus-api.js.flow +0 -151
- package/dist/perseus-env.js.flow +0 -6
- package/dist/perseus-error.js.flow +0 -16
- package/dist/perseus-markdown.js.flow +0 -20
- package/dist/perseus-types.js.flow +0 -1041
- package/dist/question-paragraph.js.flow +0 -17
- package/dist/renderability.js.flow +0 -19
- package/dist/renderer.js.flow +0 -325
- package/dist/server-item-renderer.js.flow +0 -132
- package/dist/sigfigs.js.flow +0 -41
- package/dist/styles/constants.js.flow +0 -62
- package/dist/styles/global-constants.js.flow +0 -348
- package/dist/styles/global-styles.js.flow +0 -53
- package/dist/styles/media-queries.js.flow +0 -35
- package/dist/styles/shared.js.flow +0 -8
- package/dist/tex-wrangler.js.flow +0 -13
- package/dist/translation-linter.js.flow +0 -32
- package/dist/traversal.js.flow +0 -26
- package/dist/types.js.flow +0 -318
- package/dist/util/a11y.js.flow +0 -8
- package/dist/util/answer-types.js.flow +0 -49
- package/dist/util/colors.js.flow +0 -95
- package/dist/util/fix-passage-refs.js.flow +0 -8
- package/dist/util/geometry.js.flow +0 -37
- package/dist/util/graph-utils.js.flow +0 -9
- package/dist/util/graphie.js.flow +0 -8
- package/dist/util/interactive.js.flow +0 -11
- package/dist/util/katex-preprocess.js.flow +0 -12
- package/dist/util/math.js.flow +0 -62
- package/dist/util/mobile-native-utils.js.flow +0 -12
- package/dist/util/react-render.js.flow +0 -12
- package/dist/util/register-all-widgets-for-testing.js.flow +0 -7
- package/dist/util/scroll-utils.js.flow +0 -19
- package/dist/util/sizing-utils.js.flow +0 -20
- package/dist/util/tex.js.flow +0 -17
- package/dist/util/url-utils.js.flow +0 -11
- package/dist/util.graphie.js.flow +0 -14
- package/dist/util.js.flow +0 -319
- package/dist/version.js.flow +0 -17
- package/dist/widget-container.js.flow +0 -33
- package/dist/widgets/categorizer.js.flow +0 -70
- package/dist/widgets/cs-program.js.flow +0 -54
- package/dist/widgets/definition.js.flow +0 -57
- package/dist/widgets/dropdown.js.flow +0 -63
- package/dist/widgets/explanation.js.flow +0 -58
- package/dist/widgets/expression.js.flow +0 -116
- package/dist/widgets/graded-group-answer-bar.js.flow +0 -24
- package/dist/widgets/graded-group-set.js.flow +0 -65
- package/dist/widgets/graded-group.js.flow +0 -78
- package/dist/widgets/grapher/util.js.flow +0 -38
- package/dist/widgets/grapher.js.flow +0 -102
- package/dist/widgets/group.js.flow +0 -60
- package/dist/widgets/iframe.js.flow +0 -53
- package/dist/widgets/image.js.flow +0 -73
- package/dist/widgets/input-number.js.flow +0 -94
- package/dist/widgets/interaction/arrow-picker.js.flow +0 -21
- package/dist/widgets/interaction/color-picker.js.flow +0 -23
- package/dist/widgets/interaction/dash-picker.js.flow +0 -21
- package/dist/widgets/interaction/element-container.js.flow +0 -28
- package/dist/widgets/interaction.js.flow +0 -60
- package/dist/widgets/interactive-graph.js.flow +0 -239
- package/dist/widgets/label-image/answer-choices.js.flow +0 -55
- package/dist/widgets/label-image/marker.js.flow +0 -31
- package/dist/widgets/label-image/types.js.flow +0 -23
- package/dist/widgets/label-image.js.flow +0 -142
- package/dist/widgets/lights-puzzle.js.flow +0 -58
- package/dist/widgets/matcher.js.flow +0 -106
- package/dist/widgets/matrix.js.flow +0 -80
- package/dist/widgets/measurer.js.flow +0 -30
- package/dist/widgets/molecule/molecule-drawing.js.flow +0 -11
- package/dist/widgets/molecule/molecule-layout.js.flow +0 -96
- package/dist/widgets/molecule/smiles-parser.js.flow +0 -26
- package/dist/widgets/molecule.js.flow +0 -60
- package/dist/widgets/number-line.js.flow +0 -102
- package/dist/widgets/numeric-input.js.flow +0 -105
- package/dist/widgets/orderer.js.flow +0 -81
- package/dist/widgets/passage/passage-markdown.js.flow +0 -33
- package/dist/widgets/passage-ref-target.js.flow +0 -52
- package/dist/widgets/passage-ref.js.flow +0 -85
- package/dist/widgets/passage.js.flow +0 -157
- package/dist/widgets/plotter.js.flow +0 -112
- package/dist/widgets/radio/base-radio.js.flow +0 -50
- package/dist/widgets/radio/choice-a11y-text.js.flow +0 -14
- package/dist/widgets/radio/choice-icon/choice-icon.js.flow +0 -22
- package/dist/widgets/radio/choice-icon/cross-out-line.js.flow +0 -16
- package/dist/widgets/radio/choice-icon/shared-styles.js.flow +0 -11
- package/dist/widgets/radio/choice-none-above.js.flow +0 -16
- package/dist/widgets/radio/choice.js.flow +0 -29
- package/dist/widgets/radio/choice.jsx.fixture.js.flow +0 -7
- package/dist/widgets/radio/focus-ring.js.flow +0 -22
- package/dist/widgets/radio/option-status.js.flow +0 -16
- package/dist/widgets/radio/util.js.flow +0 -12
- package/dist/widgets/radio/widget.js.flow +0 -80
- package/dist/widgets/radio.js.flow +0 -31
- package/dist/widgets/reaction-diagram.js.flow +0 -46
- package/dist/widgets/sequence.js.flow +0 -53
- package/dist/widgets/simulator.js.flow +0 -107
- package/dist/widgets/sorter.js.flow +0 -102
- package/dist/widgets/table.js.flow +0 -67
- package/dist/widgets/transformer.js.flow +0 -127
- package/dist/widgets/unit.js.flow +0 -93
- package/dist/widgets/video-transcript-link.js.flow +0 -15
- package/dist/widgets/video.js.flow +0 -57
- package/dist/widgets.js.flow +0 -108
- package/dist/zoom.js.flow +0 -7
- package/src/multi-items/item-types.js.flow +0 -55
|
@@ -14,9 +14,6 @@ import {PerseusError} from "../perseus-error";
|
|
|
14
14
|
import Util from "../util";
|
|
15
15
|
import KhanColors from "../util/colors";
|
|
16
16
|
import {
|
|
17
|
-
QuadraticCoefficient,
|
|
18
|
-
SineCoefficient,
|
|
19
|
-
Range,
|
|
20
17
|
angleMeasures,
|
|
21
18
|
ccw,
|
|
22
19
|
collinear,
|
|
@@ -44,6 +41,11 @@ import type {
|
|
|
44
41
|
PerseusInteractiveGraphWidgetOptions,
|
|
45
42
|
} from "../perseus-types";
|
|
46
43
|
import type {PerseusScore, WidgetExports, WidgetProps} from "../types";
|
|
44
|
+
import type {
|
|
45
|
+
QuadraticCoefficient,
|
|
46
|
+
SineCoefficient,
|
|
47
|
+
Range,
|
|
48
|
+
} from "../util/geometry";
|
|
47
49
|
|
|
48
50
|
const {DeprecationMixin} = Util;
|
|
49
51
|
|
|
@@ -91,7 +93,7 @@ const deprecatedProps = {
|
|
|
91
93
|
const _getShouldShowInstructions: (arg1: Props) => boolean = (props) => {
|
|
92
94
|
return (
|
|
93
95
|
_isClickToAddPoints(props) &&
|
|
94
|
-
// @ts-expect-error
|
|
96
|
+
// @ts-expect-error - TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'. | TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'.
|
|
95
97
|
(props.graph.coords == null || props.graph.coords.length === 0)
|
|
96
98
|
);
|
|
97
99
|
};
|
|
@@ -143,10 +145,10 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
143
145
|
pointA: any | null | undefined;
|
|
144
146
|
pointB: any | null | undefined;
|
|
145
147
|
pointC: any | null | undefined;
|
|
146
|
-
// @ts-expect-error
|
|
148
|
+
// @ts-expect-error - TS2564 - Property 'points' has no initializer and is not definitely assigned in the constructor.
|
|
147
149
|
points: Array<any>;
|
|
148
150
|
polygon: any | null | undefined;
|
|
149
|
-
// @ts-expect-error
|
|
151
|
+
// @ts-expect-error - TS2564 - Property 'shouldResetGraphie' has no initializer and is not definitely assigned in the constructor.
|
|
150
152
|
shouldResetGraphie: boolean;
|
|
151
153
|
sinusoid: any | null | undefined;
|
|
152
154
|
trashCan: any | null | undefined;
|
|
@@ -182,7 +184,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
182
184
|
|
|
183
185
|
componentDidMount() {
|
|
184
186
|
// eslint-disable-next-line react/no-string-refs
|
|
185
|
-
// @ts-expect-error
|
|
187
|
+
// @ts-expect-error - TS2339 - Property 'graphie' does not exist on type 'ReactInstance'.
|
|
186
188
|
this.setGraphie(this.refs.graph.graphie());
|
|
187
189
|
}
|
|
188
190
|
|
|
@@ -242,7 +244,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
242
244
|
props = props || this.props;
|
|
243
245
|
return (
|
|
244
246
|
this.isClickToAddPoints(props) &&
|
|
245
|
-
// @ts-expect-error
|
|
247
|
+
// @ts-expect-error - TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'. | TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'.
|
|
246
248
|
(props.graph.coords == null || props.graph.coords.length === 0)
|
|
247
249
|
);
|
|
248
250
|
};
|
|
@@ -313,7 +315,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
313
315
|
this.parabola = null;
|
|
314
316
|
this.sinusoid = null;
|
|
315
317
|
// eslint-disable-next-line react/no-string-refs
|
|
316
|
-
// @ts-expect-error
|
|
318
|
+
// @ts-expect-error - TS2339 - Property 'reset' does not exist on type 'ReactInstance'.
|
|
317
319
|
this.refs.graph.reset();
|
|
318
320
|
};
|
|
319
321
|
|
|
@@ -451,7 +453,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
451
453
|
["stroke-width"]?: number;
|
|
452
454
|
} = () => {
|
|
453
455
|
// This should probably use: this.props.apiOptions.isMobile
|
|
454
|
-
// @ts-expect-error
|
|
456
|
+
// @ts-expect-error - TS2339 - Property 'isMobile' does not exist on type 'Readonly<Props> & Readonly<{ children?: ReactNode; }>'.
|
|
455
457
|
return this.props.isMobile ? {"stroke-width": 3} : {};
|
|
456
458
|
};
|
|
457
459
|
|
|
@@ -467,9 +469,9 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
467
469
|
return Interactive2.addMaybeMobileMovablePoint(this, {
|
|
468
470
|
coord: coord,
|
|
469
471
|
constraints: [
|
|
470
|
-
// @ts-expect-error
|
|
472
|
+
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
471
473
|
Interactive2.MovablePoint.constraints.bound(),
|
|
472
|
-
// @ts-expect-error
|
|
474
|
+
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
473
475
|
Interactive2.MovablePoint.constraints.snap(),
|
|
474
476
|
],
|
|
475
477
|
onMove: () => {
|
|
@@ -493,10 +495,10 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
493
495
|
} as const;
|
|
494
496
|
|
|
495
497
|
if (type === "line") {
|
|
496
|
-
// @ts-expect-error
|
|
498
|
+
// @ts-expect-error - TS2339 - Property 'extendLine' does not exist on type '{ readonly points: any[]; readonly static: true; readonly normalStyle: { readonly "stroke-width"?: number | undefined; readonly stroke: "#71B307" | "#63D9EA"; }; }'.
|
|
497
499
|
lineConfig.extendLine = true;
|
|
498
500
|
} else if (type === "ray") {
|
|
499
|
-
// @ts-expect-error
|
|
501
|
+
// @ts-expect-error - TS2339 - Property 'extendRay' does not exist on type '{ readonly points: any[]; readonly static: true; readonly normalStyle: { readonly "stroke-width"?: number | undefined; readonly stroke: "#71B307" | "#63D9EA"; }; }'.
|
|
500
502
|
lineConfig.extendRay = true;
|
|
501
503
|
}
|
|
502
504
|
|
|
@@ -536,7 +538,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
536
538
|
|
|
537
539
|
const onMoveHandler = () => {
|
|
538
540
|
const graph = _.extend({}, this.props.graph, {
|
|
539
|
-
// @ts-expect-error
|
|
541
|
+
// @ts-expect-error - TS2531 - Object is possibly 'null'. | TS2531 - Object is possibly 'null'. | TS2531 - Object is possibly 'null'.
|
|
540
542
|
coords: [pointA.coord(), pointB.coord(), pointC.coord()],
|
|
541
543
|
});
|
|
542
544
|
this.onChange({graph});
|
|
@@ -550,16 +552,16 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
550
552
|
pointA = this.pointA = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
551
553
|
coord: coords[0],
|
|
552
554
|
constraints: [
|
|
553
|
-
// @ts-expect-error
|
|
555
|
+
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
554
556
|
Interactive2.MovablePoint.constraints.bound(),
|
|
555
|
-
// @ts-expect-error
|
|
557
|
+
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
556
558
|
Interactive2.MovablePoint.constraints.snap(),
|
|
557
559
|
(coord) => {
|
|
558
560
|
return (
|
|
559
561
|
!pointA ||
|
|
560
|
-
// @ts-expect-error
|
|
562
|
+
// @ts-expect-error - TS2531 - Object is possibly 'null'.
|
|
561
563
|
(coord[0] !== pointB.coord()[0] &&
|
|
562
|
-
// @ts-expect-error
|
|
564
|
+
// @ts-expect-error - TS2531 - Object is possibly 'null'.
|
|
563
565
|
coord[0] !== pointC.coord()[0])
|
|
564
566
|
);
|
|
565
567
|
},
|
|
@@ -574,16 +576,16 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
574
576
|
pointB = this.pointB = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
575
577
|
coord: coords[1],
|
|
576
578
|
constraints: [
|
|
577
|
-
// @ts-expect-error
|
|
579
|
+
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
578
580
|
Interactive2.MovablePoint.constraints.bound(),
|
|
579
|
-
// @ts-expect-error
|
|
581
|
+
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
580
582
|
Interactive2.MovablePoint.constraints.snap(),
|
|
581
583
|
(coord: any) => {
|
|
582
584
|
return (
|
|
583
585
|
!pointB ||
|
|
584
|
-
// @ts-expect-error
|
|
586
|
+
// @ts-expect-error - TS2531 - Object is possibly 'null'.
|
|
585
587
|
(coord[0] !== pointA.coord()[0] &&
|
|
586
|
-
// @ts-expect-error
|
|
588
|
+
// @ts-expect-error - TS2531 - Object is possibly 'null'.
|
|
587
589
|
coord[0] !== pointC.coord()[0])
|
|
588
590
|
);
|
|
589
591
|
},
|
|
@@ -598,16 +600,16 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
598
600
|
pointC = this.pointC = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
599
601
|
coord: coords[2],
|
|
600
602
|
constraints: [
|
|
601
|
-
// @ts-expect-error
|
|
603
|
+
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
602
604
|
Interactive2.MovablePoint.constraints.bound(),
|
|
603
|
-
// @ts-expect-error
|
|
605
|
+
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
604
606
|
Interactive2.MovablePoint.constraints.snap(),
|
|
605
607
|
(coord: any) => {
|
|
606
608
|
return (
|
|
607
609
|
!pointC ||
|
|
608
|
-
// @ts-expect-error
|
|
610
|
+
// @ts-expect-error - TS2531 - Object is possibly 'null'.
|
|
609
611
|
(coord[0] !== pointA.coord()[0] &&
|
|
610
|
-
// @ts-expect-error
|
|
612
|
+
// @ts-expect-error - TS2531 - Object is possibly 'null'.
|
|
611
613
|
coord[0] !== pointB.coord()[0])
|
|
612
614
|
);
|
|
613
615
|
},
|
|
@@ -668,7 +670,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
668
670
|
|
|
669
671
|
const onMoveHandler = () => {
|
|
670
672
|
const graph = _.extend({}, this.props.graph, {
|
|
671
|
-
// @ts-expect-error
|
|
673
|
+
// @ts-expect-error - TS2531 - Object is possibly 'null'.
|
|
672
674
|
coords: [pointA.coord(), pointB.coord()],
|
|
673
675
|
});
|
|
674
676
|
this.onChange({graph: graph});
|
|
@@ -682,9 +684,9 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
682
684
|
pointA = this.pointA = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
683
685
|
coord: coords[0],
|
|
684
686
|
constraints: [
|
|
685
|
-
// @ts-expect-error
|
|
687
|
+
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
686
688
|
Interactive2.MovablePoint.constraints.bound(),
|
|
687
|
-
// @ts-expect-error
|
|
689
|
+
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
688
690
|
Interactive2.MovablePoint.constraints.snap(),
|
|
689
691
|
(coord: any) => {
|
|
690
692
|
return !pointA || coord[0] !== pointB.coord()[0];
|
|
@@ -698,12 +700,12 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
698
700
|
{
|
|
699
701
|
coord: coords[1],
|
|
700
702
|
constraints: [
|
|
701
|
-
// @ts-expect-error
|
|
703
|
+
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
702
704
|
Interactive2.MovablePoint.constraints.bound(),
|
|
703
|
-
// @ts-expect-error
|
|
705
|
+
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
704
706
|
Interactive2.MovablePoint.constraints.snap(),
|
|
705
707
|
(coord: any) => {
|
|
706
|
-
// @ts-expect-error
|
|
708
|
+
// @ts-expect-error - TS2339 - Property 'coord' does not exist on type 'never'.
|
|
707
709
|
return !pointA || coord[0] !== pointA.coord()[0];
|
|
708
710
|
},
|
|
709
711
|
],
|
|
@@ -757,9 +759,9 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
757
759
|
const minSnap = _.min(graphie.snap);
|
|
758
760
|
|
|
759
761
|
const circle = (this.circle = graphie?.addCircleGraph({
|
|
760
|
-
// @ts-expect-error
|
|
762
|
+
// @ts-expect-error - TS2339 - Property 'center' does not exist on type 'PerseusGraphType'.
|
|
761
763
|
center: this.props.graph.center || [0, 0],
|
|
762
|
-
// @ts-expect-error
|
|
764
|
+
// @ts-expect-error - TS2339 - Property 'radius' does not exist on type 'PerseusGraphType'.
|
|
763
765
|
radius: this.props.graph.radius || _.min(this.props.step),
|
|
764
766
|
snapX: graphie.snap[0],
|
|
765
767
|
snapY: graphie.snap[1],
|
|
@@ -803,9 +805,9 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
803
805
|
Interactive2.addMaybeMobileMovablePoint(this, {
|
|
804
806
|
coord: coord,
|
|
805
807
|
constraints: [
|
|
806
|
-
// @ts-expect-error
|
|
808
|
+
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
807
809
|
Interactive2.MovablePoint.constraints.bound(),
|
|
808
|
-
// @ts-expect-error
|
|
810
|
+
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
809
811
|
Interactive2.MovablePoint.constraints.snap(),
|
|
810
812
|
(coord) => {
|
|
811
813
|
const otherSegment = segmentPoints[1 - i];
|
|
@@ -855,7 +857,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
855
857
|
};
|
|
856
858
|
|
|
857
859
|
removeLinearSystemControls: () => void = () => {
|
|
858
|
-
// @ts-expect-error
|
|
860
|
+
// @ts-expect-error - TS2345 - Argument of type 'readonly (readonly Coord[])[] | null | undefined' is not assignable to parameter of type 'Collection<any>'.
|
|
859
861
|
_.invoke(this.lines, "remove");
|
|
860
862
|
_.map(this.points, (segment) => _.invoke(segment, "remove"));
|
|
861
863
|
};
|
|
@@ -891,7 +893,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
891
893
|
// said point's onMoveEnd method so its state is
|
|
892
894
|
// consistent throughout this method call
|
|
893
895
|
// TODO(jeff, CP-3128): Use Wonder Blocks Timing API.
|
|
894
|
-
// @ts-expect-error
|
|
896
|
+
// @ts-expect-error - TS2531 - Object is possibly 'null'.
|
|
895
897
|
setTimeout(point.remove.bind(point), 0); // eslint-disable-line no-restricted-syntax
|
|
896
898
|
};
|
|
897
899
|
|
|
@@ -902,9 +904,9 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
902
904
|
point = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
903
905
|
coord: coord,
|
|
904
906
|
constraints: [
|
|
905
|
-
// @ts-expect-error
|
|
907
|
+
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
906
908
|
Interactive2.MovablePoint.constraints.bound(),
|
|
907
|
-
// @ts-expect-error
|
|
909
|
+
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
908
910
|
Interactive2.MovablePoint.constraints.snap(),
|
|
909
911
|
function (coord) {
|
|
910
912
|
// TODO(jack): There ought to be a
|
|
@@ -944,7 +946,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
944
946
|
let index = null;
|
|
945
947
|
this.points = _.filter(this.points, function (pt, i) {
|
|
946
948
|
if (pt === point) {
|
|
947
|
-
// @ts-expect-error
|
|
949
|
+
// @ts-expect-error - TS2322 - Type 'number' is not assignable to type 'null'.
|
|
948
950
|
index = i;
|
|
949
951
|
return false;
|
|
950
952
|
}
|
|
@@ -980,7 +982,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
980
982
|
const index = this.removePoint(point);
|
|
981
983
|
if (this.polygon?.closed()) {
|
|
982
984
|
// We should be checking if this.points is defined before rotating them.
|
|
983
|
-
// @ts-expect-error
|
|
985
|
+
// @ts-expect-error - TS4104 - The type 'readonly any[]' is 'readonly' and cannot be assigned to the mutable type 'any[]'. | TS2345 - Argument of type 'number | null | undefined' is not assignable to parameter of type 'number | undefined'.
|
|
984
986
|
this.points = rotate(this.points, index);
|
|
985
987
|
this.polygon?.update({closed: false});
|
|
986
988
|
}
|
|
@@ -1147,7 +1149,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1147
1149
|
|
|
1148
1150
|
for (let k = 0; k < others.length; k++) {
|
|
1149
1151
|
const other = others[k];
|
|
1150
|
-
// @ts-expect-error
|
|
1152
|
+
// @ts-expect-error - TS2345 - Argument of type 'any[]' is not assignable to parameter of type 'Line'.
|
|
1151
1153
|
if (intersects(segment, other)) {
|
|
1152
1154
|
return false;
|
|
1153
1155
|
}
|
|
@@ -1157,7 +1159,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1157
1159
|
}
|
|
1158
1160
|
|
|
1159
1161
|
if (
|
|
1160
|
-
// @ts-expect-error
|
|
1162
|
+
// @ts-expect-error - TS2339 - Property 'snapTo' does not exist on type 'PerseusGraphType'.
|
|
1161
1163
|
this.props.graph.snapTo === "angles" &&
|
|
1162
1164
|
this.points.length > 2
|
|
1163
1165
|
) {
|
|
@@ -1196,7 +1198,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1196
1198
|
}
|
|
1197
1199
|
|
|
1198
1200
|
const knownSide = magnitude(
|
|
1199
|
-
// @ts-expect-error
|
|
1201
|
+
// @ts-expect-error - TS2345 - Argument of type 'number[]' is not assignable to parameter of type 'readonly Coord[]'.
|
|
1200
1202
|
vector(coords[rel(-1)], coords[rel(1)]),
|
|
1201
1203
|
);
|
|
1202
1204
|
|
|
@@ -1221,7 +1223,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1221
1223
|
|
|
1222
1224
|
return this.graphie?.addPoints(coords[rel(-1)], offset);
|
|
1223
1225
|
}
|
|
1224
|
-
// @ts-expect-error
|
|
1226
|
+
// @ts-expect-error - TS2339 - Property 'snapTo' does not exist on type 'PerseusGraphType'.
|
|
1225
1227
|
if (this.props.graph.snapTo === "sides" && this.points.length > 1) {
|
|
1226
1228
|
// Snap to whole unit side measures
|
|
1227
1229
|
|
|
@@ -1232,7 +1234,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1232
1234
|
[coords[rel(-1)], coords[rel(1)]],
|
|
1233
1235
|
],
|
|
1234
1236
|
function (coords) {
|
|
1235
|
-
// @ts-expect-error
|
|
1237
|
+
// @ts-expect-error - TS2345 - Argument of type 'number[]' is not assignable to parameter of type 'readonly Coord[]'. | TS2556 - A spread argument must either have a tuple type or be passed to a rest parameter.
|
|
1236
1238
|
return magnitude(vector(...coords));
|
|
1237
1239
|
},
|
|
1238
1240
|
);
|
|
@@ -1275,10 +1277,10 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1275
1277
|
const point = Interactive2.addMaybeMobileMovablePoint(this, {
|
|
1276
1278
|
coord: coord,
|
|
1277
1279
|
constraints: [
|
|
1278
|
-
// @ts-expect-error
|
|
1280
|
+
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
1279
1281
|
Interactive2.MovablePoint.constraints.bound(),
|
|
1280
1282
|
snapToGrid
|
|
1281
|
-
? // @ts-expect-error
|
|
1283
|
+
? // @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
1282
1284
|
Interactive2.MovablePoint.constraints.snap()
|
|
1283
1285
|
: null,
|
|
1284
1286
|
graphConstraint,
|
|
@@ -1378,7 +1380,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1378
1380
|
function (segment, i) {
|
|
1379
1381
|
const updateCoordProps = function () {
|
|
1380
1382
|
const graph = _.extend({}, self.props.graph, {
|
|
1381
|
-
// @ts-expect-error
|
|
1383
|
+
// @ts-expect-error - TS2345 - Argument of type 'readonly (readonly Coord[])[] | null | undefined' is not assignable to parameter of type 'Collection<any>'.
|
|
1382
1384
|
coords: _.invoke(self.lines, "coords"),
|
|
1383
1385
|
});
|
|
1384
1386
|
self.onChange({graph: graph});
|
|
@@ -1396,9 +1398,9 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1396
1398
|
createPoint({
|
|
1397
1399
|
coord: coord,
|
|
1398
1400
|
constraints: [
|
|
1399
|
-
// @ts-expect-error
|
|
1401
|
+
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
1400
1402
|
Interactive2.MovablePoint.constraints.bound(),
|
|
1401
|
-
// @ts-expect-error
|
|
1403
|
+
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
1402
1404
|
Interactive2.MovablePoint.constraints.snap(),
|
|
1403
1405
|
(coord: any) => {
|
|
1404
1406
|
const otherPoint = points[1 - i];
|
|
@@ -1426,30 +1428,30 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1426
1428
|
points: points,
|
|
1427
1429
|
static: false,
|
|
1428
1430
|
constraints: [
|
|
1429
|
-
// @ts-expect-error
|
|
1431
|
+
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
1430
1432
|
Interactive2.MovableLine.constraints.bound(),
|
|
1431
|
-
// @ts-expect-error
|
|
1433
|
+
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
1432
1434
|
Interactive2.MovableLine.constraints.snap(),
|
|
1433
1435
|
],
|
|
1434
1436
|
onMove: [
|
|
1435
|
-
// @ts-expect-error
|
|
1437
|
+
// @ts-expect-error - TS2339 - Property 'onMove' does not exist on type '(graphie: any, movable: any, options: any) => void'.
|
|
1436
1438
|
Interactive2.MovableLine.onMove.updatePoints,
|
|
1437
1439
|
updateCoordProps,
|
|
1438
1440
|
],
|
|
1439
1441
|
normalStyle: {
|
|
1440
|
-
// @ts-expect-error
|
|
1442
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1441
1443
|
stroke: this.props.apiOptions.isMobile
|
|
1442
1444
|
? KhanColors.BLUE_C
|
|
1443
1445
|
: KhanColors.INTERACTIVE,
|
|
1444
|
-
// @ts-expect-error
|
|
1446
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1445
1447
|
...this._lineStroke(),
|
|
1446
1448
|
},
|
|
1447
1449
|
highlightStyle: {
|
|
1448
|
-
// @ts-expect-error
|
|
1450
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1449
1451
|
stroke: this.props.apiOptions.isMobile
|
|
1450
1452
|
? KhanColors.BLUE_C
|
|
1451
1453
|
: KhanColors.INTERACTING,
|
|
1452
|
-
// @ts-expect-error
|
|
1454
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1453
1455
|
...this._lineStroke(),
|
|
1454
1456
|
},
|
|
1455
1457
|
});
|
|
@@ -1463,7 +1465,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1463
1465
|
|
|
1464
1466
|
removeSegmentControls: () => void = () => {
|
|
1465
1467
|
_.invoke(this.points, "remove");
|
|
1466
|
-
// @ts-expect-error
|
|
1468
|
+
// @ts-expect-error - TS2345 - Argument of type 'readonly (readonly Coord[])[] | null | undefined' is not assignable to parameter of type 'Collection<any>'.
|
|
1467
1469
|
_.invoke(this.lines, "remove");
|
|
1468
1470
|
};
|
|
1469
1471
|
|
|
@@ -1517,13 +1519,13 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1517
1519
|
n,
|
|
1518
1520
|
function (i) {
|
|
1519
1521
|
if (
|
|
1520
|
-
// @ts-expect-error
|
|
1522
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1521
1523
|
!this.props.graph.showAngles ||
|
|
1522
1524
|
(!closed && (i === 0 || i === n - 1))
|
|
1523
1525
|
) {
|
|
1524
1526
|
return "";
|
|
1525
1527
|
}
|
|
1526
|
-
// @ts-expect-error
|
|
1528
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1527
1529
|
if (this.props.graph.snapTo === "angles") {
|
|
1528
1530
|
return "$deg0";
|
|
1529
1531
|
}
|
|
@@ -1544,7 +1546,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1544
1546
|
n,
|
|
1545
1547
|
function (i) {
|
|
1546
1548
|
if (
|
|
1547
|
-
// @ts-expect-error
|
|
1549
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1548
1550
|
this.props.graph.showAngles &&
|
|
1549
1551
|
(closed || (i !== 0 && i !== n - 1))
|
|
1550
1552
|
) {
|
|
@@ -1558,11 +1560,11 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1558
1560
|
const sideLabels = _.times(
|
|
1559
1561
|
n,
|
|
1560
1562
|
function (i) {
|
|
1561
|
-
// @ts-expect-error
|
|
1563
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1562
1564
|
if (!this.props.graph.showSides || (!closed && i === n - 1)) {
|
|
1563
1565
|
return "";
|
|
1564
1566
|
}
|
|
1565
|
-
// @ts-expect-error
|
|
1567
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1566
1568
|
if (this.props.graph.snapTo === "sides") {
|
|
1567
1569
|
return "$len0";
|
|
1568
1570
|
}
|
|
@@ -1575,10 +1577,10 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1575
1577
|
const self = this;
|
|
1576
1578
|
self.polygon = Interactive2.addMovablePolygon(graphie, {
|
|
1577
1579
|
constraints: [
|
|
1578
|
-
// @ts-expect-error
|
|
1580
|
+
// @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => undefined'.
|
|
1579
1581
|
Interactive2.MovablePolygon.constraints.bound(),
|
|
1580
1582
|
snapToGrid
|
|
1581
|
-
? // @ts-expect-error
|
|
1583
|
+
? // @ts-expect-error - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => undefined'.
|
|
1582
1584
|
Interactive2.MovablePolygon.constraints.snap()
|
|
1583
1585
|
: null,
|
|
1584
1586
|
],
|
|
@@ -1589,10 +1591,10 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1589
1591
|
numArcs: numArcs,
|
|
1590
1592
|
sideLabels: sideLabels,
|
|
1591
1593
|
onMove: [
|
|
1592
|
-
// @ts-expect-error
|
|
1594
|
+
// @ts-expect-error - TS2339 - Property 'onMove' does not exist on type '(graphie: any, movable: any, options: any) => undefined'.
|
|
1593
1595
|
Interactive2.MovablePolygon.onMove.updatePoints,
|
|
1594
1596
|
function () {
|
|
1595
|
-
// @ts-expect-error
|
|
1597
|
+
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
|
|
1596
1598
|
if (this.closed()) {
|
|
1597
1599
|
self.updateCoordsFromPoints();
|
|
1598
1600
|
}
|
|
@@ -1782,7 +1784,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1782
1784
|
const denom = (p1[0] - p2[0]) * (p1[0] - p3[0]) * (p2[0] - p3[0]);
|
|
1783
1785
|
if (denom === 0) {
|
|
1784
1786
|
// Many of the callers assume that the return value is always defined.
|
|
1785
|
-
// @ts-expect-error
|
|
1787
|
+
// @ts-expect-error - TS2322 - Type 'undefined' is not assignable to type 'QuadraticCoefficient'.
|
|
1786
1788
|
return;
|
|
1787
1789
|
}
|
|
1788
1790
|
const a =
|
|
@@ -1828,7 +1830,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1828
1830
|
props: Props,
|
|
1829
1831
|
): ReadonlyArray<Coord> {
|
|
1830
1832
|
return (
|
|
1831
|
-
// @ts-expect-error
|
|
1833
|
+
// @ts-expect-error - TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'.
|
|
1832
1834
|
graph.coords ||
|
|
1833
1835
|
InteractiveGraph.pointsFromNormalized(props, [
|
|
1834
1836
|
[0.25, 0.75],
|
|
@@ -1906,7 +1908,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1906
1908
|
[-10, 10],
|
|
1907
1909
|
[-10, 10],
|
|
1908
1910
|
];
|
|
1909
|
-
// @ts-expect-error
|
|
1911
|
+
// @ts-expect-error - TS2345 - Argument of type 'readonly Coord[] | undefined' is not assignable to parameter of type 'readonly Coord[]'.
|
|
1910
1912
|
const newCoords = InteractiveGraph.normalizeCoords(coords, range);
|
|
1911
1913
|
|
|
1912
1914
|
return InteractiveGraph.pointsFromNormalized(props, newCoords);
|
|
@@ -1922,7 +1924,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1922
1924
|
): ReadonlyArray<ReadonlyArray<Coord>> {
|
|
1923
1925
|
return (
|
|
1924
1926
|
// The callers assume that we're return an array of points
|
|
1925
|
-
// @ts-expect-error
|
|
1927
|
+
// @ts-expect-error - TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'.
|
|
1926
1928
|
graph.coords ||
|
|
1927
1929
|
_.map(
|
|
1928
1930
|
[
|
|
@@ -1936,7 +1938,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
1936
1938
|
],
|
|
1937
1939
|
],
|
|
1938
1940
|
(coords) => {
|
|
1939
|
-
// @ts-expect-error
|
|
1941
|
+
// @ts-expect-error - TS2345 - Argument of type 'number[][]' is not assignable to parameter of type 'readonly Coord[]'.
|
|
1940
1942
|
return InteractiveGraph.pointsFromNormalized(props, coords);
|
|
1941
1943
|
},
|
|
1942
1944
|
)
|
|
@@ -2012,7 +2014,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2012
2014
|
}
|
|
2013
2015
|
|
|
2014
2016
|
const n = graph.numSegments || 1;
|
|
2015
|
-
// @ts-expect-error
|
|
2017
|
+
// @ts-expect-error - TS2322 - Type 'number[] | undefined' is not assignable to type 'readonly number[]'.
|
|
2016
2018
|
const ys: ReadonlyArray<number> = {
|
|
2017
2019
|
1: [5],
|
|
2018
2020
|
2: [5, -5],
|
|
@@ -2026,15 +2028,15 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2026
2028
|
[-10, 10],
|
|
2027
2029
|
];
|
|
2028
2030
|
|
|
2029
|
-
// @ts-expect-error
|
|
2031
|
+
// @ts-expect-error - TS2322 - Type 'number[][][]' is not assignable to type 'readonly (readonly Coord[])[]'.
|
|
2030
2032
|
return ys.map(function (y) {
|
|
2031
2033
|
let segment = [
|
|
2032
2034
|
[-5, y],
|
|
2033
2035
|
[5, y],
|
|
2034
2036
|
];
|
|
2035
|
-
// @ts-expect-error
|
|
2037
|
+
// @ts-expect-error - TS4104 - The type 'readonly Coord[]' is 'readonly' and cannot be assigned to the mutable type 'number[][]'. | TS2345 - Argument of type 'number[][]' is not assignable to parameter of type 'readonly Coord[]'.
|
|
2036
2038
|
segment = InteractiveGraph.normalizeCoords(segment, range);
|
|
2037
|
-
// @ts-expect-error
|
|
2039
|
+
// @ts-expect-error - TS4104 - The type 'readonly Coord[]' is 'readonly' and cannot be assigned to the mutable type 'number[][]'. | TS2345 - Argument of type 'number[][]' is not assignable to parameter of type 'readonly Coord[]'.
|
|
2038
2040
|
segment = InteractiveGraph.pointsFromNormalized(props, segment);
|
|
2039
2041
|
return segment;
|
|
2040
2042
|
});
|
|
@@ -2066,18 +2068,18 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2066
2068
|
[0.5, 0.5],
|
|
2067
2069
|
]);
|
|
2068
2070
|
|
|
2069
|
-
// @ts-expect-error
|
|
2071
|
+
// @ts-expect-error - TS2345 - Argument of type 'number[]' is not assignable to parameter of type 'readonly Coord[]'. | TS2556 - A spread argument must either have a tuple type or be passed to a rest parameter.
|
|
2070
2072
|
const radius = magnitude(vector(...coords));
|
|
2071
2073
|
|
|
2072
2074
|
// Adjust the lower point by angleOffsetDeg degrees
|
|
2073
|
-
// @ts-expect-error
|
|
2075
|
+
// @ts-expect-error - TS2542 - Index signature in type 'readonly Coord[]' only permits reading.
|
|
2074
2076
|
coords[0] = [
|
|
2075
2077
|
coords[1][0] + radius * Math.cos(offset),
|
|
2076
2078
|
coords[1][1] + radius * Math.sin(offset),
|
|
2077
2079
|
];
|
|
2078
2080
|
// Position the upper point angle radians from the
|
|
2079
2081
|
// lower point
|
|
2080
|
-
// @ts-expect-error
|
|
2082
|
+
// @ts-expect-error - TS2542 - Index signature in type 'readonly Coord[]' only permits reading.
|
|
2081
2083
|
coords[2] = [
|
|
2082
2084
|
coords[1][0] + radius * Math.cos(angle + offset),
|
|
2083
2085
|
coords[1][1] + radius * Math.sin(angle + offset),
|
|
@@ -2090,7 +2092,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2090
2092
|
coordsList: ReadonlyArray<Coord>,
|
|
2091
2093
|
ranges: [Range, Range],
|
|
2092
2094
|
): ReadonlyArray<Coord> {
|
|
2093
|
-
// @ts-expect-error
|
|
2095
|
+
// @ts-expect-error - TS2322 - Type 'number[][]' is not assignable to type 'readonly Coord[]'.
|
|
2094
2096
|
return _.map(coordsList, function (coords) {
|
|
2095
2097
|
return _.map(coords, function (coord, i) {
|
|
2096
2098
|
const extent = ranges[i][1] - ranges[i][0];
|
|
@@ -2110,7 +2112,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2110
2112
|
coordsList: ReadonlyArray<Coord>,
|
|
2111
2113
|
noSnap?: boolean,
|
|
2112
2114
|
): ReadonlyArray<Coord> {
|
|
2113
|
-
// @ts-expect-error
|
|
2115
|
+
// @ts-expect-error - TS2322 - Type 'number[][]' is not assignable to type 'readonly Coord[]'.
|
|
2114
2116
|
return _.map(coordsList, function (coords) {
|
|
2115
2117
|
return _.map(coords, function (coord, i) {
|
|
2116
2118
|
const range: Range = props.range[i];
|
|
@@ -2141,7 +2143,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2141
2143
|
static getCurrentQuadraticCoefficients(props: Props): QuadraticCoefficient {
|
|
2142
2144
|
// TODO(alpert): Don't duplicate
|
|
2143
2145
|
const coords =
|
|
2144
|
-
// @ts-expect-error
|
|
2146
|
+
// @ts-expect-error - TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'.
|
|
2145
2147
|
props.graph.coords ||
|
|
2146
2148
|
InteractiveGraph.defaultQuadraticCoords(props);
|
|
2147
2149
|
return InteractiveGraph.getQuadraticCoefficients(coords);
|
|
@@ -2153,7 +2155,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2153
2155
|
[0.5, 0.25],
|
|
2154
2156
|
[0.75, 0.75],
|
|
2155
2157
|
];
|
|
2156
|
-
// @ts-expect-error
|
|
2158
|
+
// @ts-expect-error - TS2345 - Argument of type 'number[][]' is not assignable to parameter of type 'readonly Coord[]'.
|
|
2157
2159
|
return InteractiveGraph.pointsFromNormalized(props, coords);
|
|
2158
2160
|
}
|
|
2159
2161
|
|
|
@@ -2171,7 +2173,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2171
2173
|
|
|
2172
2174
|
static getCurrentSinusoidCoefficients(props: Props): SineCoefficient {
|
|
2173
2175
|
const coords =
|
|
2174
|
-
// @ts-expect-error
|
|
2176
|
+
// @ts-expect-error - TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'.
|
|
2175
2177
|
props.graph.coords || InteractiveGraph.defaultSinusoidCoords(props);
|
|
2176
2178
|
return InteractiveGraph.getSinusoidCoefficients(coords);
|
|
2177
2179
|
}
|
|
@@ -2181,7 +2183,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2181
2183
|
[0.5, 0.5],
|
|
2182
2184
|
[0.65, 0.6],
|
|
2183
2185
|
];
|
|
2184
|
-
// @ts-expect-error
|
|
2186
|
+
// @ts-expect-error - TS2345 - Argument of type 'number[][]' is not assignable to parameter of type 'readonly Coord[]'.
|
|
2185
2187
|
return InteractiveGraph.pointsFromNormalized(props, coords);
|
|
2186
2188
|
}
|
|
2187
2189
|
|
|
@@ -2202,9 +2204,9 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2202
2204
|
static getCircleEquationString(props: Props): string {
|
|
2203
2205
|
const graph = props.graph;
|
|
2204
2206
|
// TODO(alpert): Don't duplicate
|
|
2205
|
-
// @ts-expect-error
|
|
2207
|
+
// @ts-expect-error - TS2339 - Property 'center' does not exist on type 'PerseusGraphType'.
|
|
2206
2208
|
const center = graph.center || [0, 0];
|
|
2207
|
-
// @ts-expect-error
|
|
2209
|
+
// @ts-expect-error - TS2339 - Property 'radius' does not exist on type 'PerseusGraphType'.
|
|
2208
2210
|
const radius = graph.radius || 2;
|
|
2209
2211
|
return (
|
|
2210
2212
|
"center (" + center[0] + ", " + center[1] + "), radius " + radius
|
|
@@ -2315,7 +2317,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2315
2317
|
// When nothing has moved, there will neither be coords nor the
|
|
2316
2318
|
// circle's center/radius fields. When those fields are absent, skip
|
|
2317
2319
|
// all these checks; just go mark the answer as empty.
|
|
2318
|
-
// @ts-expect-error
|
|
2320
|
+
// @ts-expect-error - TS2339 - Property 'coords' does not exist on type 'PerseusGraphType'. | TS2339 - Property 'center' does not exist on type 'PerseusGraphType'. | TS2339 - Property 'radius' does not exist on type 'PerseusGraphType'.
|
|
2319
2321
|
const hasValue = !!(state.coords || (state.center && state.radius));
|
|
2320
2322
|
|
|
2321
2323
|
if (state.type === rubric.correct.type && hasValue) {
|
|
@@ -2330,9 +2332,9 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2330
2332
|
// If both of the guess points are on the correct line, it's
|
|
2331
2333
|
// correct.
|
|
2332
2334
|
if (
|
|
2333
|
-
// @ts-expect-error
|
|
2335
|
+
// @ts-expect-error - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
2334
2336
|
collinear(correct[0], correct[1], guess[0]) &&
|
|
2335
|
-
// @ts-expect-error
|
|
2337
|
+
// @ts-expect-error - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
2336
2338
|
collinear(correct[0], correct[1], guess[1])
|
|
2337
2339
|
) {
|
|
2338
2340
|
return {
|
|
@@ -2377,7 +2379,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2377
2379
|
// If the parabola coefficients match, it's correct.
|
|
2378
2380
|
const guessCoeffs = this.getQuadraticCoefficients(state.coords);
|
|
2379
2381
|
const correctCoeffs = this.getQuadraticCoefficients(
|
|
2380
|
-
// @ts-expect-error
|
|
2382
|
+
// @ts-expect-error - TS2345 - Argument of type 'readonly Coord[] | undefined' is not assignable to parameter of type 'readonly Coord[]'.
|
|
2381
2383
|
rubric.correct.coords,
|
|
2382
2384
|
);
|
|
2383
2385
|
if (deepEq(guessCoeffs, correctCoeffs)) {
|
|
@@ -2395,7 +2397,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2395
2397
|
) {
|
|
2396
2398
|
const guessCoeffs = this.getSinusoidCoefficients(state.coords);
|
|
2397
2399
|
const correctCoeffs = this.getSinusoidCoefficients(
|
|
2398
|
-
// @ts-expect-error
|
|
2400
|
+
// @ts-expect-error - TS2345 - Argument of type 'readonly Coord[] | undefined' is not assignable to parameter of type 'readonly Coord[]'.
|
|
2399
2401
|
rubric.correct.coords,
|
|
2400
2402
|
);
|
|
2401
2403
|
|
|
@@ -2443,7 +2445,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2443
2445
|
// eq() anyway. The sort should be fine because it'll stringify
|
|
2444
2446
|
// it and -0 converted to a string is "0"
|
|
2445
2447
|
guess?.sort();
|
|
2446
|
-
// @ts-expect-error
|
|
2448
|
+
// @ts-expect-error - TS2339 - Property 'sort' does not exist on type 'readonly Coord[]'.
|
|
2447
2449
|
correct.sort();
|
|
2448
2450
|
if (deepEq(guess, correct)) {
|
|
2449
2451
|
return {
|
|
@@ -2459,7 +2461,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2459
2461
|
state.coords != null
|
|
2460
2462
|
) {
|
|
2461
2463
|
const guess: Array<Coord> = state.coords?.slice();
|
|
2462
|
-
// @ts-expect-error
|
|
2464
|
+
// @ts-expect-error - TS2322 - Type 'Coord[] | undefined' is not assignable to type 'Coord[]'.
|
|
2463
2465
|
const correct: Array<Coord> = rubric.correct.coords?.slice();
|
|
2464
2466
|
|
|
2465
2467
|
let match;
|
|
@@ -2492,7 +2494,7 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2492
2494
|
let guess = state.coords.slice();
|
|
2493
2495
|
let correct = rubric.correct.coords?.slice();
|
|
2494
2496
|
guess = _.invoke(guess, "sort").sort();
|
|
2495
|
-
// @ts-expect-error
|
|
2497
|
+
// @ts-expect-error - TS2345 - Argument of type '(readonly Coord[])[] | undefined' is not assignable to parameter of type 'Collection<any>'.
|
|
2496
2498
|
correct = _.invoke(correct, "sort").sort();
|
|
2497
2499
|
if (deepEq(guess, correct)) {
|
|
2498
2500
|
return {
|
|
@@ -2510,9 +2512,9 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2510
2512
|
const guess = state.coords;
|
|
2511
2513
|
const correct = rubric.correct.coords;
|
|
2512
2514
|
if (
|
|
2513
|
-
// @ts-expect-error
|
|
2515
|
+
// @ts-expect-error - TS2532 - Object is possibly 'undefined'.
|
|
2514
2516
|
deepEq(guess[0], correct[0]) &&
|
|
2515
|
-
// @ts-expect-error
|
|
2517
|
+
// @ts-expect-error - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
2516
2518
|
collinear(correct[0], correct[1], guess[1])
|
|
2517
2519
|
) {
|
|
2518
2520
|
return {
|
|
@@ -2533,24 +2535,24 @@ class InteractiveGraph extends React.Component<Props, State> {
|
|
|
2533
2535
|
if (rubric.correct.match === "congruent") {
|
|
2534
2536
|
const angles = _.map([guess, correct], function (coords) {
|
|
2535
2537
|
const angle = GraphUtils.findAngle(
|
|
2536
|
-
// @ts-expect-error
|
|
2538
|
+
// @ts-expect-error - TS2532 - Object is possibly 'undefined'.
|
|
2537
2539
|
coords[2],
|
|
2538
|
-
// @ts-expect-error
|
|
2540
|
+
// @ts-expect-error - TS2532 - Object is possibly 'undefined'.
|
|
2539
2541
|
coords[0],
|
|
2540
|
-
// @ts-expect-error
|
|
2542
|
+
// @ts-expect-error - TS2532 - Object is possibly 'undefined'.
|
|
2541
2543
|
coords[1],
|
|
2542
2544
|
);
|
|
2543
2545
|
return (angle + 360) % 360;
|
|
2544
2546
|
});
|
|
2545
|
-
// @ts-expect-error
|
|
2547
|
+
// @ts-expect-error - TS2556 - A spread argument must either have a tuple type or be passed to a rest parameter.
|
|
2546
2548
|
match = eq(...angles);
|
|
2547
2549
|
} else {
|
|
2548
2550
|
/* exact */
|
|
2549
|
-
match = // @ts-expect-error
|
|
2551
|
+
match = // @ts-expect-error - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
2550
2552
|
deepEq(guess[1], correct[1]) &&
|
|
2551
|
-
// @ts-expect-error
|
|
2553
|
+
// @ts-expect-error - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
2552
2554
|
collinear(correct[1], correct[0], guess[0]) &&
|
|
2553
|
-
// @ts-expect-error
|
|
2555
|
+
// @ts-expect-error - TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'. | TS2532 - Object is possibly 'undefined'.
|
|
2554
2556
|
collinear(correct[1], correct[2], guess[2]);
|
|
2555
2557
|
}
|
|
2556
2558
|
|