dgreene1 / react-accessible-treeview

A react component that implements the treeview pattern as described by the WAI-ARIA Authoring Practices.
https://dgreene1.github.io/react-accessible-treeview
MIT License
261 stars 37 forks source link

`IFlatMetadata`: allow `boolean` values #164

Closed darrylyeo closed 9 months ago

darrylyeo commented 9 months ago

Describe the bug

The IFlatMetadata definition arbitrarily excludes boolean values, which causes usages of flattenTree to fail type checks in some cases.

Code That Causes The Issue

https://github.com/dgreene1/react-accessible-treeview/blob/b3d2ee78e1d2f3bceff29e7b2b6426107b6a3ed8/src/TreeView/utils.ts#L290-L293

To Reproduce

flattenTree([{ name: 'node', metadata: { isModified: true } }])

Expected behavior

export type IFlatMetadata = Record<string, string | number | boolean | undefined | null>;

Or just... copy the metadata object references as is? Not sure why nested objects couldn't be allowed here.

dgreene1 commented 9 months ago

We’re open to a PR if you’d like to try to fix the lack of boolean support.