In an effort to try to get TypeScript definitions for React Native consistent with the cononical Flow types, I have been looking into the possibility of automating this process.
My initial approach was to see how far I could get without any help needed from Facebook’s side. This process looks something like this:
- Transform Flow codebase to TypeScript by leveraging existing tooling with a few additional changes, which mostly replaces Flow utility types with TypeScript ones. (This tooling is presumably meant for people migrating from Flow to TypeScript and thus it is ok for these tools to not deliver perfect conversions.)
- Replace
$ObjMap
usage with a mapped type, as RN’s usage of$ObjMap
is trivial (return types are static). - Replace
import type {Foo} from "./some-module"
withimport {Foo} from "./some-module"
. - Replace `m