Adds static typing to JavaScript to improve developer productivity and code quality.
MIT License
Bot releases are visible (Hide)
Published by facebook-github-bot over 5 years ago
React.createClass({})
will contain defaultProps: void
, instead of defaultProps: {||}
(unsealed empty object).JSON.stringify
allowing mixed
input, which returns string | void
. Without this, you can't call JSON.stringify
on a mixed
value at all, because while Flow does allow refining mixed
to "not void" (e.g. x === undefined ? undefined : JSON.stringify(x)
), it does not support refining mixed
to "not a function" (e.g. imagine you could do x === undefined || typeof x == 'function' ? undefined : JSON.stringify(x)
). This rolls back some of the more restrictive behavior introduced in v0.95.0, but is still more restrictive and more accurate than in <= v0.94.0.Published by facebook-github-bot over 5 years ago
Likely to cause new Flow errors:
undefined
and functions in JSON.stringify
: JSON.stringify(undefined)
returns undefined
instead of string
. Rather than make it always return string | void
, or use overloads to return void
on those inputs, we instead disallow those inputs since they are rarely the intended behavior. (#7447)New features:
flow batch-coverage
: A new command to compute aggregate coverage for directories and file lists. Instead of producing the coverage at each location, it sums them and reports the per-file percentage and the aggregate percentage.Bug fixes:
Other improvements:
Published by facebook-github-bot over 5 years ago
Bug fixes:
dynamic-exports
lint's spurious errors on exported classes and functionsPerformance:
Many libdef fixes and other improvements from the open source community:
Proxy$traps
(thanks @talbenari1!)Additional lib def improvements:
current
write-only in React.Ref
- allowing union types for refsetMediaKeys
API to definition of HTMLMediaElement
http$Agent
covariantPublished by facebook-github-bot over 5 years ago
Likely to cause new Flow errors:
any
types and React proptypes for efficiency. This may result in some errors no longer being reported.New Features:
dynamic-export
) which when enabled will warn when most dynamic types are exported from a file.any
and empty
when computing line coverage. empty
types are colored blue and any
types red when using the --color
option. Note that this may cause new expressions to be considered uncovered.Notable bug fixes:
this
-substitution.inexact-spread
lint errors could appear in the wrong position.Many, many libdef fixes and improvements! Many thanks to the open source community for these, and to @nmote and @jbrown215 for reviewing and merging so many of these!
InputEvent(Listener|Handler|Types|)
(thanks @keithamus!)IntersectionObserver
constructor definition (thanks @apostolos!)ServiceWorkerMessageEvent
extend ExtendableEvent
(thanks @keyiiiii!)module.builtinModules
to core libdef (thanks @simenB!)writable.setDefaultEncoding()
(thanks @dnalborczyk!)util.callbackify
to node type def (thanks @dnalborczyk!)BroadcastChannel
(thanks @schmatz!)timingSafeEqual()
(thanks @rolftimmermans!)destroy
method to streams (thanks @hiikezoe!)XMLHttpRequest
(thanks @robin-pham!)AnimationEvent
(thanks @ngyikp!)Object.getOwnPropertyDescriptors
(thanks @disnet!)EventEmitter
API definition (thanks @antongolub!)Element.prototype.toggleAttribute
(thanks @keithamus!)TransitionEvent
to dom libdef (thanks @koddsson!)appendFile
, appendFileSync
(thanks @cappslock!)navigator.serviceWorker
(thanks @dhui!)Uint8Array
(thanks @cakoose!)dns.lookup()
(thanks @shuhei!)https
interfaces (thanks @cakoose!)createContextualFragment
return a DocumentFragment
(thanks @wincent!)oncontextmenu
to HTMLElement
(thanks @jasonLaster!)MediaDeviceInfo
declaration (thanks @ea167!)userSelect
to CSS declaration (thanks @shubhodeep9!)fs.promises.readFile
being incorreclty overloaded (thanks @Macil!)EventSource
to dom libdef. Likely to cause new errors (thanks @SlIdE42!)XDomainRequest
in bom libdef. Likely to cause new errors (thanks @Mouvedia!)displayName
property to React$Context
(thanks @bvaughn!)typeof x === 'symbol'
(thanks @mroch!)useRef
type non-nullable (thanks @trysound!)Stream
type to Node thanks (thanks @goodmind!)Misc:
Published by facebook-github-bot over 5 years ago
Notable bug fixes:
module.system.haste.name_reducers
option for Windows (#7419 - thanks jamesisaac)Likely to cause new Flow errors:
Some fixes to tagged template literals will surface a new set of pre-existing errors!
New Features:
This release culminates months of hard work on quality of life improvements for IDE support.
Expect your requests to be faster, and your requests to take a bit less time.
watchman
to reduce the number of checked files.Notable bug fixes:
Thank you to the opensource community for these fixes!
React.memo
now accepts any kind of Component
Published by facebook-github-bot almost 6 years ago
Likely to cause new Flow errors:
New Features:
--lazy-mode
flag was added to all commands that may autostart a serverNotable bug fixes:
Misc:
Likely to cause new Flow errors:
Pull Requests:
Notable bug fixes:
Parser:
Published by facebook-github-bot almost 6 years ago
Likely to cause new Flow errors:
Pull Requests:
Notable bug fixes:
Parser:
Likely to cause new Flow errors:
React.forwardRef
and better typing higher-order components. Docs are available here.New Features:
deprecated-utility
lint complains about deprecated Flow types. To start off, $Supertype
and $Subtype
are now deprecated. They were unsound and can usually be replaced using shapes or bounded generics.React.AbstractComponent
makes it way easier to type React higher-order components.React.Config
is also intended to help type React higher-order components.Notable bug fixes:
flow coverage --color
handles multi-byte characters betterflow coverage
now supports --strip-root
Misc:
flow gen-flow-files
due to bitrot. We do plan on building a better version in the future.Published by facebook-github-bot almost 6 years ago
Likely to cause new Flow errors:
Function
and Object
types be aliases for any
. They were always unsafe types, just like any
, but they had peculiar behavior. This change revealed places where they were handled improperly within Flow, and ended up surfacing type errors that were previously missed.New Features:
flow start --lazy-mode watchman
). This improves the lazy mode experience for repositories which use Mercurial and Watchman. We will document it more when/if it proves itself.flow config check
which validates the .flowconfig
.Misc:
.flowconfig
parsing less strict (in particular, if the --ignore-version
flag is passed, do not fatal on unrecognized config options).type-at-pos
to be displayed differently.string
, rather than the singleton type of that literal. Now, this fact is surfaced in error messages.Libdefs:
React.Suspense
.React.useMutationEffect
hook.Published by facebook-github-bot almost 6 years ago
Likely to cause new Flow errors:
React.createRef
definition. Refs are for any type of value,New Features:
flow config find
command thatNotable bug fixes:
flow ls --json
command.Misc:
flow port
command.JSX.frag_closingElement
of the AST to not be an option.import type
and import typeof
with default.Library definition changes:
PositionOptions
optional.calculateChangedBits
parameter to the React.createContext
definition.React.ConcurrentMode
and React.StrictMode
definitions.React.lazy
and React.memo
definitions.Parser:
Published by fishythefish almost 6 years ago
Likely to cause new Flow errors:
any
may result in new errors.New Features:
type-at-pos
can reconstruct spread objects when evaluation of the spread is not possible.type-at-pos
now supports implicit instantiation with _
.$ReadOnlyMap
, $ReadOnlyWeakMap
, $ReadOnlySet
, and $ReadOnlyWeakSet
. These types and their mutable counterparts mostly follow the pattern of $ReadOnlyArray
and Array
: the read-only parent class provides non-mutating methods, and the usual mutable class extends it. Unlike $ReadOnlyArray
, the new types are invariant in their type parameters.
React.StrictMode
type.flowtest
package. flowtest
is a CLI tool for running tests on Flow types.sharedmemory.heap_size
option.Notable bug fixes:
module.exports
objects.declare function
.type-at-pos
.flow suggest
no longer outputs <<anonymous class>>
.Remote
in type-at-pos
.Misc:
WeakMap
keys must now be objects.preserve_inferred_literal_types
is set. This does not change the behavior of type-at-pos
.experimental.cancelable_rechecks
option.Parser:
expression
field from Function
nodes in the AST.flow_parser.js
which should cause it to stack overflow in fewer cases.{}
instead of ;
in pretty mode.var x = (): (string) => number => 123
because the first =>
is ambiguous. However, var x = (): T<(string) => number> => 123
is not ambiguous and we no longer disallow it.Published by facebook-github-bot almost 6 years ago
Likely to cause new Flow errors:
Fixed an issue that caused missing annotations errors to be suppressed.
Please read the full post
for more information on what changed and tips on dealing with the new errors.
Published by facebook-github-bot almost 6 years ago
Likely to cause new Flow errors:
any
and other types would be dropped. Instead, they are nowempty
, whereas now this is an error.New Features:
_
) type arguments to function / constructor calls. This is_
.Notable bug fixes:
get-def
and find-refs
Misc:
get-def
and find-refs
to reuse codegetBoundingClient
returns a DOMRect
instead of a ClientRect
.Parser:
...
to indicate inexactness in object typesPublished by facebook-github-bot about 6 years ago
Likely to cause new Flow errors:
Notable bug fixes:
?T
) or "optional" (essentially T | void
) types{p:T}
to be a subtype of $Shape<{+p:T}>
Misc:
--verbose
to not log while loading flowlibs by default; pass --verbose-flowlibs
to overrideLibrary definition changes:
ResizeObserver
declarationsnet$Server.listening
propertyprocess.cpuUsage()
Parser:
export default async function
to be a FunctionDeclaration
not a FunctionExpression
Published by facebook-github-bot about 6 years ago
Likely to cause new Flow errors:
New Features:
--profile
mode.Misc:
Published by facebook-github-bot about 6 years ago
Likely to cause new Flow errors:
this
to appear in a constructor before a super
call in some cases.typeof
may be reported at a different location than they previously were.require()
is not allowed.Notable bug fixes:
Misc:
prototype
or constructor
.Library definition changes:
scrollIntoView
to match latest spec.String.prototype.toLocaleLowerCase
and toLocaleUpperCase
to allow optional locale
parameter.Object.prototype.valueOf
return mixed
instead of Object
.Object
libdef.TextDecoder
to properly accept a BufferSource
.MediaStreamTrackEvent
definition.String.match
return RegExp$matchResult
.fs
module.Published by facebook-github-bot about 6 years ago
Likely to cause new Flow errors:
// $FlowFixMe
) can still suppress a lint at any mentioned location. Depending on your setup, this change may expose Flow lints which were turned off by accident. For example, a "Sketchy Null Check" lint in a file with that lint set to error would have been turned off if it also mentions a file with that lint off. Now that lint will show up as an error.Headers.get
and URLSearchParams.get
are now annotated to return null | string
instead of string
and File.lastModifiedDate: any
was replaced with File.lastModified: number
.Notable bug fixes:
Misc:
BoundT
(internal representation of type parameter bounds) smaller.Parser:
extends
expression in a class declaration. Moved a couple of properties to their own node.Published by facebook-github-bot about 6 years ago
Notable bug fixes:
flow status --flowconfig-name 'name'