React native flow, typescript and Visual Studio Code

Viewed 982

Could someone explain me this:

When I create new React native project with react-native init it also generates .flowconfig

does it also add dependency on flow at the same time?

When using Visual Studio code it provides some intellisense capabilities but I didn't install TypeScript or anything. Do I have to additionally install TypeScript if I want to use TypeScript instead of Flow?

I'm just confused, because in directory of my project I have .flowconfig and when using VS Code it uses TypeScript anyway.

And what if I just want to use Flow and disable TypeScript completely? There isn't much information about it.

1 Answers

Flow is not being installed with base RN scaffolding. This .flowconfig file is only to help you get efficient type-checking process for Flow, in case if you're willing to use Flow. Otherwise, you can delete it. Note that to use Flow you still have to install some packages and maybe editor plugins, also its better to turn off vscode analysis.

TypeScript has to be configured too, even if vscode uses it undercover. One thing (1) is to get intellisense & other helping stuff inside editor and other thing (2) is to use TS to transpile your code.

In first case you can grab some type definitions and feel almost happy with raw JavaScript - vscode still helps with some tips and suggestions. For this I used vscode-react-native plugin, which downloaded RN's type definitions.

In second case - tbh, I don't know much about how popular TS is among RN devs, but you can grab some setup from create-xp-app or similar projects.

Related