You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cutting these explicit type annotations makes our reducer modules a
lot shorter and simpler to read, which I'm happy about.
A crucial ingredient in making this work is that Flow now understands
this code, following our recent fixes to reducer and action types:
7ea0b89 redux: Fix thoroughly-bogus type signatures on most reducers.
ea2b119 actions: Make EventAction complete.
e6868d8 actions: Clarify to Flow that these constants are type-tags.
... and some neighboring commits.
In particular, this change means zero loss of type coverage.
Both before and after, `yarn test:flow-coverage` shows:
Percent Total Covered Uncovered
94 % 28871 27173 1698
---
To perform this refactor automatically, I wrote the following commands:
perl -i -0pe '
s{^ const \s+ \w+ \s* = \s* \(
\K \s* state (: \s* \w+)? ,
\s* action (: \s* [^)]+)? ,?
\s* \)(:
\s* \w+State)? }
{state, action)}xmsg;
s{^ ( import\ type\ .*? )
(?: ,? \s+ \w+Action )+ \b
( [^\}]* \}\ from\ .\. ) }
{$1$2}xmsg
' \
src/*/*Reducer*.js
tools/fmt
0 commit comments