Skip to content

Commit

Permalink
topics [nfc]: Cut a few redundant type annotations.
Browse files Browse the repository at this point in the history
Flow infers these just fine.

They don't add much for the reader, as the selectors that feed
these parameters are right there in the lines above and are
generally pretty clear.  (The reader might be surprised to learn
that `getMute` returns a list of pairs... but this annotation, as
`MuteState`, wasn't helping with that anyway.)

And by repeating the expected types for these selectors to return,
they add friction for changing them.  So take them out.

(A lot of our other createSelector calls could usefully get the
same treatment.)
  • Loading branch information
gnprice committed Jan 13, 2021
1 parent 444d0e5 commit 47496ee
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/topics/topicSelectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
import { createSelector } from 'reselect';

import type {
MuteState,
Narrow,
GlobalState,
Selector,
Stream,
StreamsState,
StreamUnreadItem,
Topic,
TopicExtended,
TopicsState,
} from '../types';
Expand Down Expand Up @@ -49,12 +45,7 @@ export const getTopicsForStream: Selector<?(TopicExtended[]), number> = createSe
state => getMute(state),
(state, streamId) => getStreamsById(state).get(streamId),
state => getUnreadStreams(state),
(
topicList: Topic[],
mute: MuteState,
stream: Stream | void,
unreadStreams: StreamUnreadItem[],
) => {
(topicList, mute, stream, unreadStreams) => {
if (!topicList || !stream) {
return undefined;
}
Expand Down

0 comments on commit 47496ee

Please sign in to comment.