Flow
SWC can parse Flow syntax and strip Flow type-only constructs during transform.
This guide covers the most common ways to use Flow support:
.swcrc@swc/core@swc/cli
.swcrc
Configure the parser with syntax: "flow":
For Flow code that uses a file pragma, enable requireDirective:
Other supported Flow parser options map to the Flow parser configuration in SWC:
@swc/core
Use jsc.parser.syntax = "flow" when transforming Flow input:
You can also parse Flow syntax directly:
@swc/cli
Point the CLI at a .swcrc with syntax: "flow":
For JSX-flavored Flow input, set jsx: true and compile .jsx inputs with the
same config:
