Skip to content

Commit 1decd25

Browse files
Improve types in various places
1 parent 7fa47cf commit 1decd25

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/components/PropertyValuePair/PropertyValueList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { PropertyValuePair } from "./PropertyValuePair";
77
export interface PropertyValueListProps extends React.HTMLAttributes<HTMLDListElement> {
88
/**
99
* Only use one single column and put property label and value below each other.
10-
* This property is forwardd to direct `PropertyValuePair` children.
10+
* This property is forward to direct `PropertyValuePair` children.
1111
*/
1212
singleColumn?: boolean;
1313
}
@@ -22,7 +22,7 @@ export const PropertyValueList = ({
2222
? React.Children.map(children, (child) => {
2323
const originalChild = child as React.ReactElement;
2424
if (originalChild && originalChild.type && originalChild.type === PropertyValuePair) {
25-
return React.cloneElement(originalChild as React.ReactElement<{singleColumn: boolean}>, { singleColumn: true });
25+
return React.cloneElement(originalChild, { singleColumn: true });
2626
}
2727
return child;
2828
})

src/components/PropertyValuePair/PropertyValuePair.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const PropertyValuePair = ({
3737
? React.Children.map(children, (child) => {
3838
const originalChild = child as React.ReactElement;
3939
if (originalChild.type && (originalChild.type === PropertyName || originalChild.type === PropertyValue)) {
40-
return React.cloneElement(originalChild as React.ReactElement<{nowrap: boolean}>, { nowrap: true });
40+
return React.cloneElement(originalChild, { nowrap: true });
4141
}
4242
return child;
4343
})

src/extensions/react-flow/edges/EdgeLabel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export interface EdgeLabelObjectProps extends React.SVGAttributes<SVGForeignObje
113113
export const EdgeLabelObject = memo(
114114
({ children, edgeCenter, resizeTimeout = -1, ...otherForeignObjectProps }: EdgeLabelObjectProps) => {
115115
const containerCallback = React.useCallback(
116-
(containerRef:any) => {
116+
(containerRef: SVGForeignObjectElement | null) => {
117117
if (containerRef) labelSize(containerRef);
118118
},
119119
[edgeCenter]

src/extensions/react-flow/nodes/NodeContent.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from "react";
22
import {Position, useStoreState as getStoreStateFlowV9} from "react-flow-renderer";
33
import {useStore as getStoreStateFlowV12} from "@xyflow/react";
44
import Color from "color";
5-
import {NumberSize, Resizable, ResizeCallback} from "re-resizable";
5+
import {NumberSize, Resizable, ResizableProps, ResizeCallback} from "re-resizable";
66

77
import {intentClassName, IntentTypes} from "../../../common/Intent";
88
import {Depiction, DepictionProps} from "../../../components";
@@ -16,6 +16,7 @@ import {NodeDefaultProps} from "./NodeDefault";
1616
import {NodeHighlightColor} from "./sharedTypes";
1717
import Icon from "../../../components/Icon/Icon";
1818
import OverflowText from "../../../components/Typography/OverflowText";
19+
import {Direction} from "re-resizable/lib/resizer";
1920

2021
/**
2122
* @deprecated (v26) use `HandleDefaultProps`
@@ -736,7 +737,7 @@ export function NodeContent<CONTENT_PROPS = React.HTMLAttributes<HTMLElement>>({
736737
return validatedHeight;
737738
};
738739

739-
const onResize = React.useCallback((_0:any, _1:any, _2:any, d:any) => {
740+
const onResize: ResizableProps["onResize"] = React.useCallback((_0, _1, _2, d) => {
740741
if (nodeContentRef.current) {
741742
const nextWidth = resizeDirections.right
742743
? (width ?? originalSize.current.width ?? 0) + d.width

0 commit comments

Comments
 (0)