Likely to cause new Flow errors:
- We now require all generic functions to be fully annotated to prevent generic-escape issues. Some escaped-generic errors will be removed with
missing-local-annot
errors on return type annotation positions. - Under LTI, we will no longer silently give unannotated parameters in destructuring assignment
any
type. Instead, they will be properly contextually typed. e.g. try Flow example. - Some additional errors might be revealed after a correctness fix in implicit instantiation. e.g. try Flow example
- The
exact_by_default
option is now required to be set in the[options]
section of the.flowconfig
. Add eitherexact_by_default=true
orexact_by_default=false
to your[options]
section. Previously the absence of the option was equivalent toexact_by_default=false
. In the future, we will make the absence of the option equivalent toexact_by_default=true
. Read more about the option here: https://flow.org/en/docs/config/options/#toc-exact-by-default-boolean. To create a valid new.flowconfig
, useflow init
. - Changes to type variable unification may cause new errors to surface or old errors to be shifted to new locations.
- Fixed a bug where an unannotated parameter does not cause a
missing-local-annot
error under LTI. e.g. try Flow example - Flow will stop emitting some spurious errors and uncover some hidden bugs under local type inference, as a result of removing a cache that no longer makes sense.
- The
this
type of exported classes' methods are no longer unsoundly typed asany
. As a result, more underconstrained implicit instantiation errors might show up in LTI. - Relational comparisons between dates and numbers are no longer allowed.
New Features:
- We added
flow autofix missing-local-annot
command that will try to add annotations to autofix allmissing-local-annot
errors in a given file. - We now provide autofixes in IDE for all
missing-local-annot
errors where we can locally infer a type. Previously, this kind of autofix is only provided for unannotated parameters. - Added an
unused-promise-in-sync-scope
lint which will detect unused promises in sync scopes (likeunused-promise-in-async-scope
does for async scopes). Enablingunused-promise
will enable both of these rules. The individual rules will be removed in a future release. - Pragmas (e.g.
// @flow strict
,// @jsx custom_jsx_fun
) are now supported in try-flow.
IDE:
- Added autocomplete for jsdoc comments on functions.
- Added autocomplete for
$FlowFixMe
comments. - Autocomplete will no longer suggest existing type names for type binding identifiers (e.g., in the name of a type alias).
Notable bug fixes:
- We will no longer warn about
missing-local-annot
when there is a proper typing context insuper
call. e.g.super(x => x)
will now pass type checking under LTI if the super constructor call expects such function. - Builtin types like
$ReadOnly
will no longer shadow your local definitions with the same name. - We will no longer emit spurious errors when we are doing contextual typing while trying to resolve an overload. e.g. try Flow example
- We fixed a bug that over-zealously uses contextual type information from sibling nodes to type generic function calls. As a result, examples like the following no longer error: try Flow example
- fixed a bug where optional chaining on a value typed as a type application would not filter out the null or undefined value. e.g. try Flow example
- Some spurious errors might be removed as a result of Flow doing proper cache invalidation.
- Fix sorting of auto-imports with the same similarity score and length.
Parser:
- Parse and error on JSX type arguments.
- Add custom parse error for abstract classes.
- Add custom parse error when attempting to use template literal types in Flow.
- Add custom parse errors for TS class visibility modifiers public/private/protected.
- Remove
function
as an alias toFunction
, and don't allowfunction
as a type name in general. (closes issue #9000).