title: Typescript compiler giving " 'type aliases' can only be used in a .ts file." in a js file
body: <p>I recently migrated a react js project to a react js with typescript. As you know typescript accepts js files so what I have done is moving all the code to the typescript react app. Also I have added types for every library I needed.</p>
  <p>I have this file named HeatLayer.js which is a modified version of react-leaflet-heatmap made by OpenGov.</p>
  <p>When I do npm start on the react typescript project I get this error</p>
  <pre><code>'type aliases' can only be used in a .ts file.  TS8008
  
  11 | import PropTypes from 'prop-types';
  12 | 
  13 | export type LngLat = {
     |             ^
  14 |   lng: number;
  15 |   lat: number;
  16 | }
  </code></pre>
  <p>When I do <strong>npm start in the react js</strong> app <strong>everything works as expected</strong>.
  This is the HeatLayer.js file:</p>
  <p><a href="https://github.com/OpenGov/react-leaflet-heatmap-layer/blob/master/src/HeatmapLayer.js" rel="nofollow noreferrer">https://github.com/OpenGov/react-leaflet-heatmap-layer/blob/master/src/HeatmapLayer.js</a></p>
  <h2>SOLUTION:</h2>
  <p>Turns out Heatmalayer.js was made with javascript + flow and typescript compiler is unable to process flow. So <strong>I deleted all types</strong> en used it as a pure javascript file. A better solution would refactor it to be typescript adding typescript syntax and types.</p>