Skip to content

Commit 8b3009e

Browse files
committed
fix(types): rename AddChildren -> AddChildrenFunction, use type
1 parent cc88ad3 commit 8b3009e

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/Node/index.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import React, { SyntheticEvent } from 'react';
22
import { HierarchyPointNode } from 'd3-hierarchy';
33
import { select } from 'd3-selection';
4-
import { Orientation, Point, TreeNodeDatum, RawNodeDatum, RenderCustomNodeElementFn } from '../types/common.js';
4+
import {
5+
Orientation,
6+
Point,
7+
TreeNodeDatum,
8+
RawNodeDatum,
9+
RenderCustomNodeElementFn,
10+
AddChildrenFunction,
11+
} from '../types/common.js';
512
import DefaultNodeElement from './DefaultNodeElement.js';
613

714
type NodeEventHandler = (
@@ -165,7 +172,7 @@ export default class Node extends React.Component<NodeProps, NodeState> {
165172
this.props.onNodeMouseOut(this.props.hierarchyPointNode, evt);
166173
};
167174

168-
handleAddChildren = childrenData => {
175+
handleAddChildren: AddChildrenFunction = childrenData => {
169176
this.props.handleAddChildrenToNode(this.props.data.__rd3t.id, childrenData);
170177
};
171178

src/types/common.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export type PathFunction = (link: TreeLinkDatum, orientation: Orientation) => st
3333
export type PathClassFunction = PathFunction;
3434

3535
export type SyntheticEventHandler = (evt: SyntheticEvent) => void;
36-
export type AddChildren = (children: RawNodeDatum[]) => void;
36+
export type AddChildrenFunction = (children: RawNodeDatum[]) => void;
3737

3838
/**
3939
* The properties that are passed to the user-defined `renderCustomNodeElement` render function.
@@ -70,7 +70,7 @@ export interface CustomNodeElementProps {
7070
/**
7171
* The `Node` class's internal `addChildren` handler.
7272
*/
73-
addChildren: AddChildren;
73+
addChildren: AddChildrenFunction;
7474
}
7575

7676
export type RenderCustomNodeElementFn = (rd3tNodeProps: CustomNodeElementProps) => JSX.Element;

0 commit comments

Comments
 (0)