New Features:
- Bigint values inside of template literals now coerce to strings, e.g.
`${1n}`
. Addition with string (e.g.1n + 'blah'
) is still banned. - Add ability to resolve node package entrypoints/exports
- Flow now allows inference of type guards for simple expression arrow functions with one parameter. For example, in
["a", null].filter(s => s != null)
it will automatically infer that the arrow function encodes ax is string
type guard and will apply it on the input array resulting in aArray<string>
. (try-Flow) module.system.node.root_relative_dirname
will allow conditional mapping likemodule.system.node.root_relative_dirname='<PROJECT_ROOT>/foo' -> 'bar'
. Under such config,import 'a'
will only be resolved to<PROJECT_ROOT>/bar/a
ifimport 'a'
is in a file in the<PROJECT_ROOT>/foo
directory. This feature will be helpful if you want to combine two flow roots with differentmodule.system.node.root_relative_dirname
config.
Likely to cause new Flow errors:
- When an opaque type is refined to be not null/undefined, we now refine the opaque type's upper bound rather than returning the opaque type unmodified.
Notable bug fixes:
- Flow will error more consistently on incompatible uses of refined string, number and boolean literal types (e.g. try-Flow)
- Fixed some cases of type filtering during type guard refinement (e.g. try-Flow)
- Fixed a bug of missing errors when certain functions were checked against interfaces (e.g. try-Flow)
- Fixed negation of refinement of type-guard functions with multiple parameters (e.g. try-Flow)
- Relaxed type-guard consistency checks when the function returns with
true
orfalse
. (e.g. try-Flow)
Parser:
- We now provide parsing support for
declare global {...}
(using it will still result in an error). The AST will have the shape of
{
"type":"DeclareNamespace",
"loc": ...,
"range": ...,
"global":true,
"id":{
"type":"Identifier",
"loc": ...,
"range":...,
"name":"global",
"typeAnnotation":null,
"optional":false
},
"body":{
"type":"BlockStatement",
...
},
}
Library Definitions:
- The global
React$PureComponent
is removed. If you want to refer to it, it needs to be imported fromreact
.