Flow needs to know which files to parse and of those how to handle any Flow types within them. For third party libraries you may wish to not parse, parse but not preserve types, or parse but not raise errors, depending on the quality and compatibility of their Flow implementation.
Different sections are available to specify different behaviours, and by combining them most use cases are expected to be met.
[untyped] section in a
.flowconfig file tells Flow to not typecheck files matching the specified regular expressions and instead throw away types and treat modules as
This is different from the
[ignore] config section that causes matching files to be ignored by the module resolver, which inherently makes them un-typechecked, and also unresolvable by
require. When ignored
[libs] must then be specified for each
flow-typed, which may not always be desired.
It is also different from the
[declarations] section. This also does not typecheck the file contents, but
[declarations] does extract and use the signatures of functions, classes, etc, when checking other code.
[untyped] instead causes a file to be ignored by the typechecker as if it had
noflow in it, resolve modules as
any type, but allow them to NOT be ignored by the module resolver. Any matching file is skipped by Flow (not even parsed, like other
noflow files!), but can still be
Things to keep in mind:
[untyped] section might look like:
[untyped] .*/third_party/.* .*/src/\(foo\|bar\)/.* .*\.untype\.js
[untyped] section will parse:
Starting with Flow v0.23.0, you may use the
<PROJECT_ROOT> placeholder in your regular expressions. At runtime, Flow will treat the placeholder as if it were the absolute path to the project’s root directory. This is useful for writing regular expressions that are relative rather than absolute.
For example, you can write:
Which would parse in declaration mode any file or directory under the directory named
third_party/ within the project root. However, unlike the previous example’s
.*/third_party/.*, it would NOT parse files or directories under directories named
© 2013–present Facebook Inc.
Licensed under the MIT License.