Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getTreeFromFlatData set rootKey as null #934

Open
yongjiaaaa opened this issue Aug 3, 2022 · 0 comments
Open

getTreeFromFlatData set rootKey as null #934

yongjiaaaa opened this issue Aug 3, 2022 · 0 comments

Comments

@yongjiaaaa
Copy link

The function getTreeFromFlatData requires setting rootKey as null for it to work. However, the type of rootKey is set as string | number | undefined, resulting in a type error: Type 'null' is not assignable to type 'string | number | undefined'.ts(2322).

Can someone help to take a look?

code snippet:

    const treeItems = await import("react-sortable-tree").then(treeLib => {
      return treeLib.getTreeFromFlatData({
        flatData,
        getKey: node => node.id,
        getParentKey: node => node.parentId,
        // tslint:disable-next-line:no-null-keyword
        rootKey: null // The value of the parent key when there is no parent (i.e., at root level)
      });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant