@babel/preset-flow
In
Out
function foo(one, two, three) {}
npm install --save-dev @babel/preset-flow
babel --presets @babel/preset-flow script.js
presets: ["@babel/preset-flow"],
});
boolean
, defaults to false
.
If you are using the all
option in your Flow config, be sure to set this option to true
to get matching behavior.
For example, without either of the above set, the following call expression with a type argument:
Would get parsed as a nested binary expression:
When enabled, type-only class fields are only removed if they are prefixed with the declare
modifier:
class A {
declare foo: string; // Removed
bar: string; // Initialized to undefined
You can read more about configuring preset options