Likely to cause new Flow errors:
- Support for special function type
$Flow$DebugPrintwas removed. To see the internal representation of type, use theflow type-at-poscommand with flag--debug-print-internal-repr. Note that this is for debugging purpose only, and you should never depend on the output of--debug-print-internal-repr - More invalid compare errors will be consistently caught when using
==and!=. invalid-rendererrors can no longer be suppressed without specific error code.- Flow can now detect more bad cyclic types, including across module boundaries. example
- You may see some errors moved around when
$Exact<...>is involved. Some invalid$Exact<...>type will now havenot-an-objecterror code. - Fixed a bug that makes some exported types accidentally any. Previously hidden errors might be exposed.
New Features:
declare namespacesupport is enabled by default.- Added "Add Missing Attributes" quickfix for JSX. This is available when the cursor is over the name of a JSX element that is missing a required attribute.
- Added a
StringSuffixtype, which goes along with the recently addedStringPrefixtype.StringSuffixcan be used to type strings with a specified suffix. E.g.StringSuffix<'!'>allows for'yay!'and'woo!'. The type argument for the suffix must be a string literal. The second, optional, type argument can be used for the type of the remainder of the string after the suffix is removed.
Notable bug fixes:
- Fix a bug that caused Flow to infer incorrect render types for elements of polymorphic components under niche circumstances
IDE:
- Flow now supports symlinked node_modules in autoimports better. If allowed by the node resolution algorithm, autoimport will insert import specifier like
my-packageormy-package/fooinstead of a relative path import.
Library Definitions:
- CredMgmtCredentialRequestOptions properties are now optional
Reflect.setPrototypeofare no longer special-cased, and the backing special typeObject$SetPrototypeOfis removed. The new typing is intentionally loose. Similar toObject.setPrototypeof, this is inherently unsafe since Flow won't track prototype mutations.Object.assignis still special cased, but the special-casing is only available for a syntacticObject.assign(...)call. If you try to use Object.assign in some other ways (e.g.const f = Object.assign; f(...)), you will get a a less precise and accurate typing for it. If you don't like the default fallback type, you can override theObject$Assigntype. While the special-casing behavior will stay for the syntactic call, you should migrate your code to use the spread syntax instead.