mirror of
https://github.com/AykutSarac/jsoncrack.com.git
synced 2025-02-04 01:32:54 +08:00
improve types
This commit is contained in:
parent
1f477e99d9
commit
897ceabfe0
@ -24,7 +24,7 @@ export const CustomNode = (nodeProps: NodeProps) => {
|
||||
return (
|
||||
<Node {...nodeProps} label={<Label style={baseLabelStyle} />}>
|
||||
{({ width, height, x, y, node }) => {
|
||||
if (properties.text instanceof Object) {
|
||||
if (Array.isArray(properties.text)) {
|
||||
return (
|
||||
<ObjectNode
|
||||
value={properties.text}
|
||||
@ -38,7 +38,7 @@ export const CustomNode = (nodeProps: NodeProps) => {
|
||||
|
||||
return (
|
||||
<TextNode
|
||||
node={node}
|
||||
node={node as NodeData}
|
||||
isParent={properties.data.isParent}
|
||||
value={properties.text}
|
||||
width={width}
|
||||
|
8
src/types.d.ts
vendored
8
src/types.d.ts
vendored
@ -1,4 +1,10 @@
|
||||
type CanvasDirection = "LEFT" | "RIGHT" | "DOWN" | "UP"
|
||||
type CanvasDirection = "LEFT" | "RIGHT" | "DOWN" | "UP";
|
||||
|
||||
interface CustomNodeData {
|
||||
isParent: true;
|
||||
hasChild: !!children.length;
|
||||
children;
|
||||
}
|
||||
|
||||
interface NodeData<T = any> {
|
||||
id: string;
|
||||
|
Loading…
x
Reference in New Issue
Block a user