From aa12eaf17ffef02f66c4cc6773245d6eb5ce890c Mon Sep 17 00:00:00 2001 From: Diogo Cunha Date: Tue, 7 May 2019 18:59:45 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20fixed=20types=20and=20def?= =?UTF-8?q?=20for=20FilteringContainer=20render=20prop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.d.ts | 6 ++++-- src/FilteringContainer.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/index.d.ts b/index.d.ts index 73667b4..88ec3d5 100644 --- a/index.d.ts +++ b/index.d.ts @@ -3,8 +3,10 @@ import * as React from 'react'; +type NodeId = number | string; + interface BasicNode { - id: number | string; + id: NodeId; name: string; state?: {[stateKey: string]: any}; } @@ -94,7 +96,7 @@ interface GroupRendererProps { } export interface FilteringContainerProps { - children: (nodes: Node[]) => JSX.Element; + children: (params: {nodes: Node[]; nodeParentMappings: {[id: NodeId]: NodeId[]}}) => JSX.Element; debouncer?: (func: (...p: any[]) => any, timeout: number) => void; groups?: {[g: string]: Group}; selectedGroup?: string; diff --git a/src/FilteringContainer.js b/src/FilteringContainer.js index f518a0a..701fc2b 100644 --- a/src/FilteringContainer.js +++ b/src/FilteringContainer.js @@ -65,7 +65,7 @@ export default class FilteringContainer extends React.Component { const relevantNodes = groups && selectedGroup && groups[selectedGroup] ? filterNodes(groups[selectedGroup].filter, nodes) - : {nodes, nodeParentMappings: []}; + : {nodes, nodeParentMappings: {}}; const {nodes: filteredNodes, nodeParentMappings} = filterTerm ? filterNodes(nameMatchesSearchTerm(filterTerm), relevantNodes.nodes)