Safely use untyped values in Flow

Safely use untyped values in Flow

By Guillaume Claret

At OuiCar, we use the static type checker FlowType to detect bugs in our Javascript applications. Since we have a lot of historical code or third party libraries, our code is a mix of typed Javascript and untyped Javascript. This can be the source of some subtle bugs, like runtime type errors in the typed code. We present a small assertion library in order to help to better embed untyped values in Flow programs.

Decode

We designed a Decode library, whose code is given in the appendix below. The aim of the Decode library is to dynamically check that some untyped value has some expected type. This is especially useful to check that our server API returns well-formed results.

read more

Talk meetup Paris.js, Elm for Javascript

Talk meetup Paris.js, Elm for Javascript

By Guillaume Claret

We presented a talk at the Paris.js Meetup on the Elm architecture for the Javascript developer with Theophile Kalumbu and Guillaume Claret. The slides are available here (in French). Here is a translation of the abstract:

The web applications are more and more complex, and thus harder and harder to write and maintain. Moreover, due to the history of the Web, Javascript is often the only language we can use with all its known limitations.
At OuiCar, we try to take example on the Elm language and architecture, in order to better structure our existing code. Thanks to this approach, we are able to gradually make our code more robust and easier to maintain.
We will present our solutions and our remaining questions.

read more

Flow tips

Flow tips

By Guillaume Claret

Flow is a type checker for JavaScript developed by Facebook. By adding type annotations to JavaScript programs, we get the safety and the simplicity of typed programming languages while staying in the JavaScript ecosystem. At OuiCar, we have been using the Flow type checker for over a month with great success. We present here some tips we found useful.

Declarations for the DOM and React

You can read the Flow declarations for the DOM and React in the sources of Flow itself. This is also an excellent source to learn Flow by the example.

read more