const SliderContainer = ({node, time}) => (<Container> {node.map(program=>(<Slide key={program.id} id={program.id} title={program.title? trimText(program.title,8): trimText(program.name, 8)} overview={trimText(program.overview, 50)} votes={program.vote_average} backgroundImage={program.backdrop_path} poster={program.poster_path} /> ))}</Container>)
i wanna convert this JS Code to TS Code, so i tried
interface NodeProps { node: Nodes time: string}interface Nodes { reactNode :{ id: number title?: string name?: string overview: string vote_average: number backdrop_path: string poster_path: string }}const SliderContainer = ({node, time}: NodeProps) => (<Container><Swiper controlsEnabled={false} loop timeout={time}> {node.map(program => (<Slide key={program.id} id={program.id} title={program.title? trimText(program.title,8): trimText(program.name, 8)} overview={trimText(program.overview, 50)} votes={program.vote_average} backgroundImage={program.backdrop_path} poster={program.poster_path} /> ))}</Swiper></Container>)
in the JS Code, node in Parameter is Proptypes.node. and contains id, title, vote...,etc. ( these things from movie API).and in result, the node.map()
function is not work and i am searching many times how convert that code but i don't know.help me Please...