My current project uses React.js ( 16.8.6 ) with Flow.js ( 0.109.0 ) and I want to migrate to Typescript. I am using Next.js version 9.1.1 and I don't want to change all my JS files to TS. I want to use both JS and TS files in my project. The problem is that I am using Flow.js and every time I start my development server, a typecheck error comes that says something like this -
'type aliases' can only be used in a .ts file.
6 | import cx from 'classnames';
7 |
> 8 | type Props = {
| ^
9 | heading: string,
10 | children: React.Node,
11 | headerStyles?: Object,
How should I configure my setup so that the JS files are ignored for typecheck and only TS files are considered?
My tsconfig.json files look like this -
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"checkJs": false,
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
},
}