Skip to content

Commit

Permalink
fix: 馃悰 fixed types and def for FilteringContainer render prop (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
diogofcunha committed May 7, 2019
1 parent 0f8148e commit e963624
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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};
}
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/FilteringContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e963624

Please sign in to comment.