github facebook/flow v0.238.0

latest releases: v0.238.3, v0.238.2, v0.238.1...
15 days ago

Likely to cause new Flow errors:

  • In v0.237.2, we shipped the flag react.disable_function_components_default_props that will make Flow ignore defaultProps on function components for React component typing purposes. This flag is now on by default. If this is too disruptive for your codebase, you can turn this off for now. Note that we do not intend to keep this flag forever, so you should try to turn this flag on as soon as possible.
  • We made React.createElement have an opaque type, which means calling this function directly will be an error. This will be helpful to prepare for React 19 changes. Note that JSX typing is unaffected. If you are not ready for this change, you can override your library definition like this to approximate the previous behavior as much as possible.
  • When there is an invalid-component-prop error, Flow will no longer make the entire props to be any type. Instead, Flow will create a Props type as if these invalid props do not exist. example
  • We are making the typing of the exported object of a module more strict. If you see errors when casting the exported type of a module to a writable object, try either casting it to a readonly version instead, or casting the exported object to the writable object type.
  • We now infer the type for Object.freeze({ A: "a", B: "b" }) as {+A: "a", +B: "b"}, ie we use readonly properties and singleton types for literal initializers. Casts like this example will now be an error.
  • We now error more consistently when a property is missing from an intersection of objects (e.g. try-Flow)
  • untyped-import errors are now on the import source rather than imported names.

New Features:

  • Under files.implictly_include_root=false (default is true, which is the current behavior), Flow will no longer include everything under the directory where the flowconfig is in by default.

Notable bug fixes:

  • Fixed a category of spurious errors when using Array.reduce and returning a union type (e.g. try-Flow)
  • Explicit type arguments in JSX are now considered for contextual typing. example
  • Fixed spread of empty array when calculating tuple elements, e.g. [...[]] as [] now works.
  • nested-component errors can now be suppressed.

IDE:

  • Flow now suggests properties of objects that are contextually typed with optional types. For example, in ({ foo: { | } } as ?{ foo: { x: number }}) it will populate x, when calling autocomplete at the point of the cursor |. (try-Flow)
  • We now provide autocomplete for types in the global React type-only namespace.
  • We now support go-to-definition for JSX member expression like <Foo.Bar />.
  • Re-exported values from export {Foo} from 'bar' statements will now appear in autoimport results.
  • autoimports_ranked_by_usage is now enabled by default.
  • Flow will now show the type of the constructor of a class (instantiated if it is generic) when hovering over the "new" keyword in new C(e)
  • Hover types will now show the specialized version of a polymorphic component used at a JSX expression
  • Hover types won't add unnecessary parentheses around union types.

Library Definitions:

  • Add React 19 useOptimistic and useActionState API definitions
  • Add libdef for TextDecoderStream

Don't miss a new flow release

NewReleases is sending notifications on new releases.