title: Array filter in typescript?
body: <p>I have to filter array in typescript.</p>
  <pre><code>const { movies, message } = useAppSelector(state =&gt; state.movies);
  
  //Here movies is array getting from backend
  </code></pre>
  <p>Here I have to filter it in typescript.</p>
  <p>I have code in javascript.</p>
  <pre><code>const mathches = movies.filter(movie =&gt; {
      const escapeRegExp = (str) =&gt; str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, &quot;\\$&amp;&quot;)
      const regex = new RegExp(escapeRegExp(search), &quot;gi&quot;);
      return movie.name.match(regex);
  })
  </code></pre>
  <p>I can't understand how can define type here.</p>
  <p>Here I get some error when I paste it in ts file-</p>
  <pre><code>Property 'filter' does not exist on type 'never'.
  Parameter 'movie' implicitly has an 'any' type.
  Parameter 'str' implicitly has an 'any' type.
  </code></pre>
  <p>Please help me to define type here.</p>