Flow best practices

flow type logo
Reading Time: 12 minutes

Current, Flow is not released even in version 1.0.0, but it is already flexible enough to allow creation type systems in different ways. I decided to share a set of rules, that from my experience, are making types system based on Flow more stable, reliable, predictable, and useful.

Why add Flow to the project

1. Refactoring freedom

When flow annotations are added to the files, it looks like the right thing to do, but it fully shines when one decides to refactor component or function, as there will be no need to keep in memory where the component or function was used. For example, one has changed the type of the arguments, that utility function will accept as arguments. If the project has sufficient flow coverage, logs of flow errors will lead to all places where this change will require changing the arguments with which function was called.Continue reading →

Chrome Dev Summit 2019 – Big Web Quiz – Day 1

chrome dev summit
Reading Time: < 1 minute

This autumn, I first ever went to Chrome Dev Summit. It was a tremendously inspiring conference that intellectually put me far beyond my everyday tech routine. One of the fascinating experiences was Big Web Quiz. I like it both as an attendee as it was an entertaining way to catch up on what I missed in the Chrome development and from an event organizing perspective as it was a positive way to recap and further promote all the work that the Chrome team did in the previous year.Continue reading →

Idea night: Voluntary data sacrifice

Reading Time: 3 minutes

Accessibility is a hot topic in the last few years. Nearly any web-conference has at least one talk, that is dedicated to this theme.

These talks contain quite convincing arguments. One of the best persuasive and at the same explanatory rich visualization of the accessibility problem was done a while ago in the “Inclusive. A Microsoft Design Toolkit”Continue reading →

2 dimensions of the code review process complexity

Reading Time: 3 minutes

Photo by Pankaj Patel on Unsplash

You have probably been in my place. You have perfectly planned working day ahead, there are around 2-3 tasks that you need to do, and you think: “Wow, I finally have it under control,” and then you open your laptop, and realize, that at least three code review requests are waiting for your feedback. And even though you have recently working in some of the files, that PR is changing, CRs take much more time than you would expect.

Continue reading →

Visualizing sorting algorithms

Reading Time: 2 minutes

Currently, I am going through course JavaScript Algorithms and Data Structures (which I highly recommend by the way). For me, one of the strongest parts of this course was Colt ability to explain everything, not only how to implement code, but also what exactly one or other part is doing. Among all instruments used there, one of my favourites were ones, that visualize what is happening, when sorting algorithms are run.Continue reading →

Inexact vs exact flow object types: spreading

Reading Time: 3 minutes

If one wants to add flow annotation to object type and reuse some of the types, that was annotated in another object type, it can be done like:

type SharedProperties = {
length: number,
name: string,
};
type NewProperties = {
age: number,
...SharedProperties,
};

However, in this case, not all will run smoothly here, as if to check age will accept, not only number type as valid but other as well.Continue reading →

Debugging tips – console.trace

Reading Time: < 1 minute

From my observation, debugging is the best-kept secret of the developer life. Everyone is doing quite often, some are doing it even every day, but rarely anyone is talking (not moaning :)) about it publicly. Have you seen excellent tech talk at the recent conference, that has addressed some debussing techniques or anything that can be used next time one should find a way to fix the bug? If yes, please, please, please, share it in the comments.Continue reading →

What I have learned from the Kent C. Dodds testing JavaScript course

Reading Time: 4 minutes

The strange thing is happening when one is gaining more experience – it is harder to identify or to find what new to learn. It definitely depends on the width of the area, as some things can be learned in a few hours, and for some, even a few years are not enough. And with this more broad areas it is easier to experience this phenomenon when even though you do know that you do not know everything, it is hard to identify what you do not know.Continue reading →