title: How can I fix the error Failed to compile. Type error: 'type aliases' can only be used in a .ts file. TS8008
body: <p>I'm using Create React App with Flow, Prettier, ESLint, and Emotion. After installing flow and creating a .babelrc file with <code>{ "presets": ["flow"] }</code>, I still get the following compile error when running <code>yarn start</code>:</p>
  
  <pre><code>Failed to compile. Type error: 'type aliases' can only be used in a .ts file. TS8008
  </code></pre>
  
  <p>That's because I have the following code in <code>App.jsx</code>:</p>
  
  <pre><code>type PropsType = {
    history: any
  };
  </code></pre>
  
  <p>I have another project where I can use <code>.js</code> files with flow with no issues, but I can't find why I have this error in this project.</p>
  
  <p>I've also noticed this file being created <code>src/react-app-env.d.ts</code> and the contents of .flowconfig being changed by the react-scripts</p>
  
  <p>What am I missing?</p>