Skip to content

Commit f182dd0

Browse files
Mbd06bclaude
andcommitted
fix: resolve TS2742/TS7056 and TS18048 in interactive-graph-editor
- Define InteractiveGraphProps using perseus-core types directly instead of deriving from typeof InteractiveGraphWidget.widget (avoids deep internal path references that break declaration emit) - Add non-null assertions for defaultProps access (fixes TS18048) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e6ed6e3 commit f182dd0

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

packages/sophia-editor/src/widgets/interactive-graph-editor/interactive-graph-editor.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
type AxisLabelLocation,
99
interactiveGraphLogic,
1010
type ShowAxisArrows,
11+
type PerseusInteractiveGraphUserInput,
1112
} from "@ethosengine/perseus-core";
1213
import {
1314
containerSizeClass,
@@ -39,15 +40,14 @@ import {shouldShowStartCoordsUI} from "./start-coords/util";
3940

4041
import type {APIOptionsWithDefaults} from "@ethosengine/sophia";
4142

42-
// Explicit annotation needed: TS2742/TS7056 — inferred type references
43-
// deep internal paths and exceeds serialization limits for declaration emit.
44-
const InteractiveGraph: React.ComponentType<
45-
React.ComponentProps<typeof InteractiveGraphWidget.widget>
46-
> = InteractiveGraphWidget.widget;
43+
const InteractiveGraph = InteractiveGraphWidget.widget;
4744

48-
type InteractiveGraphProps = React.ComponentProps<
49-
typeof InteractiveGraphWidget.widget
50-
>;
45+
// Defined using perseus-core types directly rather than PropsFor<typeof InteractiveGraph>
46+
// to avoid TS2742/TS7056 — the inferred widget type references deep internal
47+
// paths of @ethosengine/sophia that aren't portable for declaration emit.
48+
type InteractiveGraphProps = {
49+
userInput: PerseusInteractiveGraphUserInput;
50+
};
5151

5252
type Range = [min: number, max: number];
5353

@@ -334,7 +334,8 @@ class InteractiveGraphEditor extends React.Component<Props> {
334334
<GraphTypeSelector
335335
graphType={
336336
this.props.graph?.type ??
337-
InteractiveGraph.defaultProps.userInput.type
337+
InteractiveGraph.defaultProps!.userInput!
338+
.type
338339
}
339340
// TODO(LEMS-2656): remove TS suppression
340341
onChange={

0 commit comments

Comments
 (0)