I have an old react-native module using Flow. There are several thousand lines of code. Now, I would like to migrate these codes to a new project using TypeScript. I am looking for an auto-tool to help me solve tedious type-converting works. If it would solve about 90% of problems, I would appreciate it. For example,
- Changing all the
.js
file to 'ts
ortsx
file, like:
for f in `find . -type f -name '*.js'`;
do
git mv -- "$f""${f%.js}.ts"
done
- convert types
// Flow
import type { Type1, Type2 } from ./dir/to/path
// Typescript
import { Type1, Type2 } from ./dir/to/path
// Flow
type Date = {
toString: () => string,
setTime: (time: number) => number
}
// TypeScript
interface Date {
toString(): string;
setTime(time: number): number;
}
// Flow
value: ?string
// TypeScript
value: string | null
Any suggestions?