import React from 'react' ; import PropTypes from 'prop-types' ; import JSONNestedNode from './JSONNestedNode' ; import { CircularPropsPassedThroughJSONNode } from './types' ; function createItemString ( data ) { return `${ ( data as unknown [ ] ) . length } ${ ( data as unknown [ ] ) . length !== 1 ? 'items' : 'item' }` ; } interface Props extends CircularPropsPassedThroughJSONNode { data : any ; nodeType : string ; } const JSONArrayNode = ( { data , ... props } ) => ( < JSONNestedNode { ... props } data = { data } nodeType = "Array" nodeTypeIndicator = "[]" createItemString = { createItemString } expandable = { data . length > 0 } / > ) ; JSONArrayNode . propTypes = { data : PropTypes . array , } ; export default JSONArrayNode ;