Skip to content

Commit 2ee7c8b

Browse files
committed
Merge branch 'fix/widen-node-attributes-type'
2 parents 451eb53 + 47ef56a commit 2ee7c8b

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ By default, `Tree` expects each node object in `data` to implement the [`RawNode
129129
```ts
130130
interface RawNodeDatum {
131131
name: string;
132-
attributes?: Record<string, string>;
132+
attributes?: Record<string, string | number | boolean>;
133133
children?: RawNodeDatum[];
134134
}
135135
```

src/Node/DefaultNodeElement.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const DefaultNodeElement: React.FunctionComponent<DefaultNodeElementProps> = ({
4545
{nodeDatum.attributes &&
4646
Object.entries(nodeDatum.attributes).map(([labelKey, labelValue], i) => (
4747
<tspan key={`${labelKey}-${i}`} {...textLayout.attribute}>
48-
{labelKey}: {labelValue}
48+
{labelKey}: {typeof labelValue === 'boolean' ? labelValue.toString() : labelValue}
4949
</tspan>
5050
))}
5151
</text>

src/types/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface Point {
1010

1111
export interface RawNodeDatum {
1212
name: string;
13-
attributes?: Record<string, string>;
13+
attributes?: Record<string, string | number | boolean>;
1414
children?: RawNodeDatum[];
1515
}
1616

0 commit comments

Comments
 (0)