Photo by Aksonsat Uanthoeng from Pexels

What we’re building in 2020

Andrew Pardoe
Mar 9, 2020 · 4 min read

Our plan for 2020 covers three areas:

  • Improve the capabilities and responsiveness of our VS Code editing and browsing experience
  • Make our type system more simple, expressive, and correct
  • Reduce our peak memory usage while holding the line on recheck performance

VS Code editing and browsing

Flow provides a language server to provide rich editing and code browsing features such as in-editor diagnostics (type errors), autocomplete and “go to definition”. While our focus is on providing a best-in-class experience in VS Code, any editor that uses LSP can take advantage of Flow’s language server.

In 2020 we’ll focus on two kinds of investments in our editing and browsing experience. First, we’ll continue to improve the reliability and responsiveness of our IDE features. Second, we’ll add support for some top-requested IntelliSense features.

The Flow language server doesn’t always respond immediately because it needs to initialize when first starting up, and sometimes needs to restart after events like large rebases. Most language features require that the Flow server be running continuously while you edit code. Where possible, we’ll convert our edit and browse requests to make them possible to complete without requiring the server. We’ll also continue to reduce the situations where the Flow server needs to restart itself.

A second set of investments come from adding support for the top-requested IntelliSense features: parameter info, quick info, and quick fixes.

  • Quick info shows the declaration when you hover over an identifier in your code. Flow already shows function signatures. We’ll improve the formatting for quick info and add documentation comments similar to parameter info.
  • We’ve just added our first quick fix feature — a “Did You Mean?” that suggests corrections to your code as you type. For example, if you write foo.bar on an object foo that doesn’t have a field named bar but does have a field named baz, the quick fix will apply that suggestion. We're also investigating adding Flow error suppressions and automatic generation of static import statements.

Enhanced type system

We believe that a thoughtfully designed type system that is simple, expressive, and correct can provide a better experience for developers.

  • Expressive: can developers do what they need to do without being blocked by Flow?
  • Correct: can developers rely on Flow to help them avoid common costly mistakes?
  • Unsealed object types are used to model empty object literals and properties on functions. Unsealed objects allow new properties to be written at any time. They’re useful for scenarios like enabling object initialization across multiple statements. But Flow doesn’t check reads from unsealed objects with no matching writes. We’ll work on addressing this unsoundness, by carefully tracking common initialization patterns.
  • Many of Flow’s utility types, such as $ObjMap and $PropertyType, don't reflect the semantics of the corresponding runtime operations. We'll create first-class designs for those types.
  • Flow error suppressions are very coarse. Adding a $FlowFixMe above a line of code to suppress one kind of error actually suppresses all errors introduced by that code, potentially masking future errors. We're designing error codes that will allow you to suppress specific errors without hiding another error on the same line of code. And we'll move suppressions to the primary position of an error, preventing a suppression attached to a definition from hiding errors where that definition is used.
  • Generic types and functions currently have unpredictable behavior, with generic type parameters able to escape their scope and calls to generic functions able to accumulate new bounds far away from the call-site. We are designing new behavior for generics, including more reliable detection of errors in generic functions, a test to prevent escaped type parameters, and a check to ensure function calls are properly constrained.

Performance improvements

The Flow team delivered massive performance improvements last year, such as reducing our recheck times by 70%. We’ve heard overwhelming positive feedback from Facebook developers about our performance improvements. We aim to hold the line on performance, even as our JavaScript codebases grow. We’re also working to reduce the Flow’s memory usage in all situations.

In closing

In 2020, the Flow team will deliver a developer experience that is on par with industry-wide standards of reliability, feature completeness, and delight. As part of this developer experience, we’ll continue to improve on fundamentals: memory usage and reliability. We’ll deliver the most-requested IDE edit and browse features. And we’ll enhance Flow’s type system to make it easier for developers to write safe, correct code.

We’ll keep in touch with you on this blog, on GitHub, and in our Flowtype Discord channel.

Flow

The official publication for the Flow static type checker…

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store