11import { number , withKnobs } from '@storybook/addon-knobs' ;
22import { storiesOf } from '@storybook/react' ;
3- import * as React from 'react' ;
3+ import React , { FC } from 'react' ;
44import AutoSizer from 'react-virtualized-auto-sizer' ;
55import {
66 FixedSizeNodeComponentProps ,
@@ -27,7 +27,7 @@ type StackElement = Readonly<{
2727 node : DataNode ;
2828} > ;
2929
30- type ExtendedData = FixedSizeNodeData &
30+ type TreeData = FixedSizeNodeData &
3131 Readonly < {
3232 isLeaf : boolean ;
3333 name : string ;
@@ -62,7 +62,7 @@ const defaultButtonStyle = {fontFamily: 'Courier New'};
6262
6363function * treeWalker (
6464 refresh : boolean ,
65- ) : Generator < ExtendedData | string | symbol , void , boolean > {
65+ ) : Generator < TreeData | string | symbol , void , boolean > {
6666 const stack : StackElement [ ] = [ ] ;
6767
6868 stack . push ( {
@@ -95,9 +95,12 @@ function* treeWalker(
9595 }
9696}
9797
98- const Node : React . FunctionComponent < FixedSizeNodeComponentProps <
99- ExtendedData
100- > > = ( { data : { isLeaf, name, nestingLevel} , isOpen, style, toggle} ) => (
98+ const Node : FC < FixedSizeNodeComponentProps < TreeData > > = ( {
99+ data : { isLeaf, name, nestingLevel} ,
100+ isOpen,
101+ style,
102+ toggle,
103+ } ) => (
101104 < div
102105 style = { {
103106 ...style ,
@@ -117,13 +120,11 @@ const Node: React.FunctionComponent<FixedSizeNodeComponentProps<
117120 </ div >
118121) ;
119122
120- type TreePresenterProps = {
121- readonly itemSize : number ;
122- } ;
123+ type TreePresenterProps = Readonly < {
124+ itemSize : number ;
125+ } > ;
123126
124- const TreePresenter : React . FunctionComponent < TreePresenterProps > = ( {
125- itemSize,
126- } ) => (
127+ const TreePresenter : FC < TreePresenterProps > = ( { itemSize} ) => (
127128 < AutoSizer disableWidth >
128129 { ( { height} ) => (
129130 < FixedSizeTree
0 commit comments