Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Latest commit

 

History

History

flux-flow

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

flux-flow

This is a very simple example that highlights how to set up Flux and Flow in the same project. Flow is a static-type checking tool that will help catch errors in your code statically. It complements Flux well since it supports refining the action based on a type string.

Usage

cd path/to/flux-flow
flow

Note: Since flow is a static analysis tool you don't actually need to build anything for this example.

Differences from flux-shell

The primary differences from the flux-shell project that are necessary to use Flow are:

  1. Copy the Flux library definitions from ./flow
  2. Create a .flowconfig file with the correct options

After that you can navigate to your project and run flow in the terminal.

Kinds of errors caught by flow

Const params

You may notice that .flowconfig has experimental.const_params=true in it. This is generally necessary to make refinements on the payload stronger. If for other reasons it's not possible to use this option in your project you may need to do this to work around Flow refinement issues:

function reduce(state: State, _action: Action): State {
  const action = _action;
  ...
}